Skip to content

Commit

Permalink
Merge branch 'develop' into docs
Browse files Browse the repository at this point in the history
  • Loading branch information
prashant-shahi authored Dec 19, 2024
2 parents fe98c42 + 7405bfb commit a27e629
Show file tree
Hide file tree
Showing 555 changed files with 12,255 additions and 3,493 deletions.
15 changes: 9 additions & 6 deletions deploy/docker-swarm/clickhouse-setup/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,12 @@ services:
condition: on-failure

query-service:
image: signoz/query-service:0.56.0
image: signoz/query-service:0.61.0
command:
[
"-config=/root/config/prometheus.yml",
"--use-logs-new-schema=true"
"--use-logs-new-schema=true",
"--use-trace-new-schema=true"
]
# ports:
# - "6060:6060" # pprof port
Expand Down Expand Up @@ -186,7 +187,7 @@ services:
<<: *db-depend

frontend:
image: signoz/frontend:0.56.0
image: signoz/frontend:0.61.0
deploy:
restart_policy:
condition: on-failure
Expand All @@ -199,7 +200,7 @@ services:
- ../common/nginx-config.conf:/etc/nginx/conf.d/default.conf

otel-collector:
image: signoz/signoz-otel-collector:0.111.5
image: signoz/signoz-otel-collector:0.111.14
command:
[
"--config=/etc/otel-collector-config.yaml",
Expand Down Expand Up @@ -237,13 +238,15 @@ services:
- query-service

otel-collector-migrator:
image: signoz/signoz-schema-migrator:0.111.5
image: signoz/signoz-schema-migrator:0.111.14
deploy:
restart_policy:
condition: on-failure
delay: 5s
command:
- "--dsn=tcp://clickhouse:9000"
- "sync"
- "--dsn=tcp://clickhouse:9000"
- "--up="
depends_on:
- clickhouse
# - clickhouse-2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ exporters:
clickhousetraces:
datasource: tcp://clickhouse:9000/signoz_traces
low_cardinal_exception_grouping: ${env:LOW_CARDINAL_EXCEPTION_GROUPING}
use_new_schema: true
clickhousemetricswrite:
endpoint: tcp://clickhouse:9000/signoz_metrics
resource_to_telemetry_conversion:
Expand Down
6 changes: 4 additions & 2 deletions deploy/docker/clickhouse-setup/docker-compose-core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,12 @@ services:
- --storage.path=/data

otel-collector-migrator:
image: signoz/signoz-schema-migrator:${OTELCOL_TAG:-0.111.5}
image: signoz/signoz-schema-migrator:${OTELCOL_TAG:-0.111.14}
container_name: otel-migrator
command:
- "sync"
- "--dsn=tcp://clickhouse:9000"
- "--up="
depends_on:
clickhouse:
condition: service_healthy
Expand All @@ -84,7 +86,7 @@ services:
# Notes for Maintainers/Contributors who will change Line Numbers of Frontend & Query-Section. Please Update Line Numbers in `./scripts/commentLinesForSetup.sh` & `./CONTRIBUTING.md`
otel-collector:
container_name: signoz-otel-collector
image: signoz/signoz-otel-collector:0.111.5
image: signoz/signoz-otel-collector:0.111.14
command:
[
"--config=/etc/otel-collector-config.yaml",
Expand Down
3 changes: 2 additions & 1 deletion deploy/docker/clickhouse-setup/docker-compose-local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ services:
command:
[
"-config=/root/config/prometheus.yml",
"--use-logs-new-schema=true"
"--use-logs-new-schema=true",
"--use-trace-new-schema=true"
]
ports:
- "6060:6060"
Expand Down
13 changes: 7 additions & 6 deletions deploy/docker/clickhouse-setup/docker-compose-minimal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,13 @@ services:
# Notes for Maintainers/Contributors who will change Line Numbers of Frontend & Query-Section. Please Update Line Numbers in `./scripts/commentLinesForSetup.sh` & `./CONTRIBUTING.md`

query-service:
image: signoz/query-service:${DOCKER_TAG:-0.56.0}
image: signoz/query-service:${DOCKER_TAG:-0.61.0}
container_name: signoz-query-service
command:
[
"-config=/root/config/prometheus.yml",
"--use-logs-new-schema=true"
"--use-logs-new-schema=true",
"--use-trace-new-schema=true"
]
# ports:
# - "6060:6060" # pprof port
Expand Down Expand Up @@ -201,7 +202,7 @@ services:
<<: *db-depend

frontend:
image: signoz/frontend:${DOCKER_TAG:-0.56.0}
image: signoz/frontend:${DOCKER_TAG:-0.61.0}
container_name: signoz-frontend
restart: on-failure
depends_on:
Expand All @@ -213,7 +214,7 @@ services:
- ../common/nginx-config.conf:/etc/nginx/conf.d/default.conf

otel-collector-migrator-sync:
image: signoz/signoz-schema-migrator:${OTELCOL_TAG:-0.111.5}
image: signoz/signoz-schema-migrator:${OTELCOL_TAG:-0.111.14}
container_name: otel-migrator-sync
command:
- "sync"
Expand All @@ -228,7 +229,7 @@ services:
# condition: service_healthy

otel-collector-migrator-async:
image: signoz/signoz-schema-migrator:${OTELCOL_TAG:-0.111.5}
image: signoz/signoz-schema-migrator:${OTELCOL_TAG:-0.111.14}
container_name: otel-migrator-async
command:
- "async"
Expand All @@ -245,7 +246,7 @@ services:
# condition: service_healthy

otel-collector:
image: signoz/signoz-otel-collector:${OTELCOL_TAG:-0.111.5}
image: signoz/signoz-otel-collector:${OTELCOL_TAG:-0.111.14}
container_name: signoz-otel-collector
command:
[
Expand Down
11 changes: 6 additions & 5 deletions deploy/docker/clickhouse-setup/docker-compose.testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,14 @@ services:
# Notes for Maintainers/Contributors who will change Line Numbers of Frontend & Query-Section. Please Update Line Numbers in `./scripts/commentLinesForSetup.sh` & `./CONTRIBUTING.md`

query-service:
image: signoz/query-service:${DOCKER_TAG:-0.56.0}
image: signoz/query-service:${DOCKER_TAG:-0.61.0}
container_name: signoz-query-service
command:
[
"-config=/root/config/prometheus.yml",
"-gateway-url=https://api.staging.signoz.cloud",
"--use-logs-new-schema=true"
"--use-logs-new-schema=true",
"--use-trace-new-schema=true"
]
# ports:
# - "6060:6060" # pprof port
Expand Down Expand Up @@ -208,7 +209,7 @@ services:
<<: *db-depend

frontend:
image: signoz/frontend:${DOCKER_TAG:-0.56.0}
image: signoz/frontend:${DOCKER_TAG:-0.61.0}
container_name: signoz-frontend
restart: on-failure
depends_on:
Expand All @@ -220,7 +221,7 @@ services:
- ../common/nginx-config.conf:/etc/nginx/conf.d/default.conf

otel-collector-migrator:
image: signoz/signoz-schema-migrator:${OTELCOL_TAG:-0.111.5}
image: signoz/signoz-schema-migrator:${OTELCOL_TAG:-0.111.14}
container_name: otel-migrator
command:
- "--dsn=tcp://clickhouse:9000"
Expand All @@ -234,7 +235,7 @@ services:


otel-collector:
image: signoz/signoz-otel-collector:${OTELCOL_TAG:-0.111.5}
image: signoz/signoz-otel-collector:${OTELCOL_TAG:-0.111.14}
container_name: signoz-otel-collector
command:
[
Expand Down
1 change: 1 addition & 0 deletions deploy/docker/clickhouse-setup/otel-collector-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ exporters:
clickhousetraces:
datasource: tcp://clickhouse:9000/signoz_traces
low_cardinal_exception_grouping: ${env:LOW_CARDINAL_EXCEPTION_GROUPING}
use_new_schema: true
clickhousemetricswrite:
endpoint: tcp://clickhouse:9000/signoz_metrics
resource_to_telemetry_conversion:
Expand Down
23 changes: 8 additions & 15 deletions ee/query-service/app/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ type APIHandlerOptions struct {
Cache cache.Cache
Gateway *httputil.ReverseProxy
// Querier Influx Interval
FluxInterval time.Duration
UseLogsNewSchema bool
UseLicensesV3 bool
FluxInterval time.Duration
UseLogsNewSchema bool
UseTraceNewSchema bool
}

type APIHandler struct {
Expand All @@ -66,7 +66,7 @@ func NewAPIHandler(opts APIHandlerOptions) (*APIHandler, error) {
Cache: opts.Cache,
FluxInterval: opts.FluxInterval,
UseLogsNewSchema: opts.UseLogsNewSchema,
UseLicensesV3: opts.UseLicensesV3,
UseTraceNewSchema: opts.UseTraceNewSchema,
})

if err != nil {
Expand Down Expand Up @@ -181,17 +181,10 @@ func (ah *APIHandler) RegisterRoutes(router *mux.Router, am *baseapp.AuthMiddlew
Methods(http.MethodGet)

// v3
router.HandleFunc("/api/v3/licenses",
am.ViewAccess(ah.listLicensesV3)).
Methods(http.MethodGet)

router.HandleFunc("/api/v3/licenses",
am.AdminAccess(ah.applyLicenseV3)).
Methods(http.MethodPost)

router.HandleFunc("/api/v3/licenses",
am.AdminAccess(ah.refreshLicensesV3)).
Methods(http.MethodPut)
router.HandleFunc("/api/v3/licenses", am.ViewAccess(ah.listLicensesV3)).Methods(http.MethodGet)
router.HandleFunc("/api/v3/licenses", am.AdminAccess(ah.applyLicenseV3)).Methods(http.MethodPost)
router.HandleFunc("/api/v3/licenses", am.AdminAccess(ah.refreshLicensesV3)).Methods(http.MethodPut)
router.HandleFunc("/api/v3/licenses/active", am.ViewAccess(ah.getActiveLicenseV3)).Methods(http.MethodGet)

// v4
router.HandleFunc("/api/v4/query_range", am.ViewAccess(ah.queryRangeV4)).Methods(http.MethodPost)
Expand Down
41 changes: 23 additions & 18 deletions ee/query-service/app/api/license.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (ah *APIHandler) applyLicense(w http.ResponseWriter, r *http.Request) {
RespondError(w, model.BadRequest(fmt.Errorf("license key is required")), nil)
return
}
license, apiError := ah.LM().Activate(r.Context(), l.Key)
license, apiError := ah.LM().ActivateV3(r.Context(), l.Key)
if apiError != nil {
RespondError(w, apiError, nil)
return
Expand All @@ -115,6 +115,23 @@ func (ah *APIHandler) listLicensesV3(w http.ResponseWriter, r *http.Request) {
ah.Respond(w, convertLicenseV3ToListLicenseResponse(licenses))
}

func (ah *APIHandler) getActiveLicenseV3(w http.ResponseWriter, r *http.Request) {
activeLicense, err := ah.LM().GetRepo().GetActiveLicenseV3(r.Context())
if err != nil {
RespondError(w, &model.ApiError{Typ: model.ErrorInternal, Err: err}, nil)
return
}
// return 404 not found if there is no active license
if activeLicense == nil {
RespondError(w, &model.ApiError{Typ: model.ErrorNotFound, Err: fmt.Errorf("no active license found")}, nil)
return
}

// TODO deprecate this when we move away from key for stripe
activeLicense.Data["key"] = activeLicense.Key
render.Success(w, http.StatusOK, activeLicense.Data)
}

// this function is called by zeus when inserting licenses in the query-service
func (ah *APIHandler) applyLicenseV3(w http.ResponseWriter, r *http.Request) {
var licenseKey ApplyLicenseRequest
Expand Down Expand Up @@ -241,24 +258,12 @@ func convertLicenseV3ToLicenseV2(licenses []*model.LicenseV3) []model.License {
}

func (ah *APIHandler) listLicensesV2(w http.ResponseWriter, r *http.Request) {

var licenses []model.License

if ah.UseLicensesV3 {
licensesV3, err := ah.LM().GetLicensesV3(r.Context())
if err != nil {
RespondError(w, err, nil)
return
}
licenses = convertLicenseV3ToLicenseV2(licensesV3)
} else {
_licenses, apiError := ah.LM().GetLicenses(r.Context())
if apiError != nil {
RespondError(w, apiError, nil)
return
}
licenses = _licenses
licensesV3, apierr := ah.LM().GetLicensesV3(r.Context())
if apierr != nil {
RespondError(w, apierr, nil)
return
}
licenses := convertLicenseV3ToLicenseV2(licensesV3)

resp := model.Licenses{
TrialStart: -1,
Expand Down
3 changes: 2 additions & 1 deletion ee/query-service/app/db/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ func NewDataConnector(
dialTimeout time.Duration,
cluster string,
useLogsNewSchema bool,
useTraceNewSchema bool,
) *ClickhouseReader {
ch := basechr.NewReader(localDB, promConfigPath, lm, maxIdleConns, maxOpenConns, dialTimeout, cluster, useLogsNewSchema)
ch := basechr.NewReader(localDB, promConfigPath, lm, maxIdleConns, maxOpenConns, dialTimeout, cluster, useLogsNewSchema, useTraceNewSchema)
return &ClickhouseReader{
conn: ch.GetConn(),
appdb: localDB,
Expand Down
Loading

0 comments on commit a27e629

Please sign in to comment.