mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-15 21:15:56 +08:00
chore(use-*): remove use-new-traces-schema and use-new-logs-schema flags (#7741)
### Summary remove use-new-traces-schema and use-new-logs-schema flags
This commit is contained in:
parent
e73e1bd078
commit
accb77f227
@ -66,8 +66,6 @@ func NewAPIHandler(opts APIHandlerOptions, signoz *signoz.SigNoz) (*APIHandler,
|
|||||||
LogsParsingPipelineController: opts.LogsParsingPipelineController,
|
LogsParsingPipelineController: opts.LogsParsingPipelineController,
|
||||||
Cache: opts.Cache,
|
Cache: opts.Cache,
|
||||||
FluxInterval: opts.FluxInterval,
|
FluxInterval: opts.FluxInterval,
|
||||||
UseLogsNewSchema: opts.UseLogsNewSchema,
|
|
||||||
UseTraceNewSchema: opts.UseTraceNewSchema,
|
|
||||||
AlertmanagerAPI: alertmanager.NewAPI(signoz.Alertmanager),
|
AlertmanagerAPI: alertmanager.NewAPI(signoz.Alertmanager),
|
||||||
FieldsAPI: fields.NewAPI(signoz.TelemetryStore),
|
FieldsAPI: fields.NewAPI(signoz.TelemetryStore),
|
||||||
Signoz: signoz,
|
Signoz: signoz,
|
||||||
|
@ -23,12 +23,10 @@ func NewDataConnector(
|
|||||||
telemetryStore telemetrystore.TelemetryStore,
|
telemetryStore telemetrystore.TelemetryStore,
|
||||||
prometheus prometheus.Prometheus,
|
prometheus prometheus.Prometheus,
|
||||||
cluster string,
|
cluster string,
|
||||||
useLogsNewSchema bool,
|
|
||||||
useTraceNewSchema bool,
|
|
||||||
fluxIntervalForTraceDetail time.Duration,
|
fluxIntervalForTraceDetail time.Duration,
|
||||||
cache cache.Cache,
|
cache cache.Cache,
|
||||||
) *ClickhouseReader {
|
) *ClickhouseReader {
|
||||||
chReader := basechr.NewReader(sqlDB, telemetryStore, prometheus, cluster, useLogsNewSchema, useTraceNewSchema, fluxIntervalForTraceDetail, cache)
|
chReader := basechr.NewReader(sqlDB, telemetryStore, prometheus, cluster, fluxIntervalForTraceDetail, cache)
|
||||||
return &ClickhouseReader{
|
return &ClickhouseReader{
|
||||||
conn: telemetryStore.ClickhouseDB(),
|
conn: telemetryStore.ClickhouseDB(),
|
||||||
appdb: sqlDB,
|
appdb: sqlDB,
|
||||||
|
@ -62,8 +62,6 @@ type ServerOptions struct {
|
|||||||
FluxIntervalForTraceDetail string
|
FluxIntervalForTraceDetail string
|
||||||
Cluster string
|
Cluster string
|
||||||
GatewayUrl string
|
GatewayUrl string
|
||||||
UseLogsNewSchema bool
|
|
||||||
UseTraceNewSchema bool
|
|
||||||
Jwt *authtypes.JWT
|
Jwt *authtypes.JWT
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,8 +130,6 @@ func NewServer(serverOptions *ServerOptions) (*Server, error) {
|
|||||||
serverOptions.SigNoz.TelemetryStore,
|
serverOptions.SigNoz.TelemetryStore,
|
||||||
serverOptions.SigNoz.Prometheus,
|
serverOptions.SigNoz.Prometheus,
|
||||||
serverOptions.Cluster,
|
serverOptions.Cluster,
|
||||||
serverOptions.UseLogsNewSchema,
|
|
||||||
serverOptions.UseTraceNewSchema,
|
|
||||||
fluxIntervalForTraceDetail,
|
fluxIntervalForTraceDetail,
|
||||||
serverOptions.SigNoz.Cache,
|
serverOptions.SigNoz.Cache,
|
||||||
)
|
)
|
||||||
@ -151,8 +147,6 @@ func NewServer(serverOptions *ServerOptions) (*Server, error) {
|
|||||||
serverOptions.SigNoz.SQLStore.SQLxDB(),
|
serverOptions.SigNoz.SQLStore.SQLxDB(),
|
||||||
reader,
|
reader,
|
||||||
c,
|
c,
|
||||||
serverOptions.UseLogsNewSchema,
|
|
||||||
serverOptions.UseTraceNewSchema,
|
|
||||||
serverOptions.SigNoz.Alertmanager,
|
serverOptions.SigNoz.Alertmanager,
|
||||||
serverOptions.SigNoz.SQLStore,
|
serverOptions.SigNoz.SQLStore,
|
||||||
serverOptions.SigNoz.TelemetryStore,
|
serverOptions.SigNoz.TelemetryStore,
|
||||||
@ -233,8 +227,6 @@ func NewServer(serverOptions *ServerOptions) (*Server, error) {
|
|||||||
FluxInterval: fluxInterval,
|
FluxInterval: fluxInterval,
|
||||||
Gateway: gatewayProxy,
|
Gateway: gatewayProxy,
|
||||||
GatewayUrl: serverOptions.GatewayUrl,
|
GatewayUrl: serverOptions.GatewayUrl,
|
||||||
UseLogsNewSchema: serverOptions.UseLogsNewSchema,
|
|
||||||
UseTraceNewSchema: serverOptions.UseTraceNewSchema,
|
|
||||||
JWT: serverOptions.Jwt,
|
JWT: serverOptions.Jwt,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,8 +236,6 @@ func NewServer(serverOptions *ServerOptions) (*Server, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
s := &Server{
|
s := &Server{
|
||||||
// logger: logger,
|
|
||||||
// tracer: tracer,
|
|
||||||
ruleManager: rm,
|
ruleManager: rm,
|
||||||
serverOptions: serverOptions,
|
serverOptions: serverOptions,
|
||||||
unavailableChannel: make(chan healthcheck.Status),
|
unavailableChannel: make(chan healthcheck.Status),
|
||||||
@ -486,8 +476,6 @@ func makeRulesManager(
|
|||||||
db *sqlx.DB,
|
db *sqlx.DB,
|
||||||
ch baseint.Reader,
|
ch baseint.Reader,
|
||||||
cache cache.Cache,
|
cache cache.Cache,
|
||||||
useLogsNewSchema bool,
|
|
||||||
useTraceNewSchema bool,
|
|
||||||
alertmanager alertmanager.Alertmanager,
|
alertmanager alertmanager.Alertmanager,
|
||||||
sqlstore sqlstore.SQLStore,
|
sqlstore sqlstore.SQLStore,
|
||||||
telemetryStore telemetrystore.TelemetryStore,
|
telemetryStore telemetrystore.TelemetryStore,
|
||||||
@ -504,8 +492,6 @@ func makeRulesManager(
|
|||||||
Cache: cache,
|
Cache: cache,
|
||||||
EvalDelay: baseconst.GetEvalDelay(),
|
EvalDelay: baseconst.GetEvalDelay(),
|
||||||
PrepareTaskFunc: rules.PrepareTaskFunc,
|
PrepareTaskFunc: rules.PrepareTaskFunc,
|
||||||
UseLogsNewSchema: useLogsNewSchema,
|
|
||||||
UseTraceNewSchema: useTraceNewSchema,
|
|
||||||
PrepareTestRuleFunc: rules.TestNotification,
|
PrepareTestRuleFunc: rules.TestNotification,
|
||||||
Alertmanager: alertmanager,
|
Alertmanager: alertmanager,
|
||||||
SQLStore: sqlstore,
|
SQLStore: sqlstore,
|
||||||
|
@ -23,6 +23,7 @@ import (
|
|||||||
"go.uber.org/zap/zapcore"
|
"go.uber.org/zap/zapcore"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Deprecated: Please use the logger from pkg/instrumentation.
|
||||||
func initZapLog() *zap.Logger {
|
func initZapLog() *zap.Logger {
|
||||||
config := zap.NewProductionConfig()
|
config := zap.NewProductionConfig()
|
||||||
config.EncoderConfig.TimeKey = "timestamp"
|
config.EncoderConfig.TimeKey = "timestamp"
|
||||||
@ -52,7 +53,9 @@ func main() {
|
|||||||
var gatewayUrl string
|
var gatewayUrl string
|
||||||
var useLicensesV3 bool
|
var useLicensesV3 bool
|
||||||
|
|
||||||
|
// Deprecated
|
||||||
flag.BoolVar(&useLogsNewSchema, "use-logs-new-schema", false, "use logs_v2 schema for logs")
|
flag.BoolVar(&useLogsNewSchema, "use-logs-new-schema", false, "use logs_v2 schema for logs")
|
||||||
|
// Deprecated
|
||||||
flag.BoolVar(&useTraceNewSchema, "use-trace-new-schema", false, "use new schema for traces")
|
flag.BoolVar(&useTraceNewSchema, "use-trace-new-schema", false, "use new schema for traces")
|
||||||
// Deprecated
|
// Deprecated
|
||||||
flag.StringVar(&promConfigPath, "config", "./config/prometheus.yml", "(prometheus config to read metrics)")
|
flag.StringVar(&promConfigPath, "config", "./config/prometheus.yml", "(prometheus config to read metrics)")
|
||||||
@ -140,8 +143,6 @@ func main() {
|
|||||||
FluxIntervalForTraceDetail: fluxIntervalForTraceDetail,
|
FluxIntervalForTraceDetail: fluxIntervalForTraceDetail,
|
||||||
Cluster: cluster,
|
Cluster: cluster,
|
||||||
GatewayUrl: gatewayUrl,
|
GatewayUrl: gatewayUrl,
|
||||||
UseLogsNewSchema: useLogsNewSchema,
|
|
||||||
UseTraceNewSchema: useTraceNewSchema,
|
|
||||||
Jwt: jwt,
|
Jwt: jwt,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,8 +25,6 @@ func PrepareTaskFunc(opts baserules.PrepareTaskOptions) (baserules.Task, error)
|
|||||||
ruleId,
|
ruleId,
|
||||||
opts.Rule,
|
opts.Rule,
|
||||||
opts.Reader,
|
opts.Reader,
|
||||||
opts.UseLogsNewSchema,
|
|
||||||
opts.UseTraceNewSchema,
|
|
||||||
baserules.WithEvalDelay(opts.ManagerOpts.EvalDelay),
|
baserules.WithEvalDelay(opts.ManagerOpts.EvalDelay),
|
||||||
baserules.WithSQLStore(opts.SQLStore),
|
baserules.WithSQLStore(opts.SQLStore),
|
||||||
)
|
)
|
||||||
@ -123,8 +121,6 @@ func TestNotification(opts baserules.PrepareTestRuleOptions) (int, *basemodel.Ap
|
|||||||
alertname,
|
alertname,
|
||||||
parsedRule,
|
parsedRule,
|
||||||
opts.Reader,
|
opts.Reader,
|
||||||
opts.UseLogsNewSchema,
|
|
||||||
opts.UseTraceNewSchema,
|
|
||||||
baserules.WithSendAlways(),
|
baserules.WithSendAlways(),
|
||||||
baserules.WithSendUnmatched(),
|
baserules.WithSendUnmatched(),
|
||||||
baserules.WithSQLStore(opts.SQLStore),
|
baserules.WithSQLStore(opts.SQLStore),
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -118,9 +118,6 @@ type APIHandler struct {
|
|||||||
// Websocket connection upgrader
|
// Websocket connection upgrader
|
||||||
Upgrader *websocket.Upgrader
|
Upgrader *websocket.Upgrader
|
||||||
|
|
||||||
UseLogsNewSchema bool
|
|
||||||
UseTraceNewSchema bool
|
|
||||||
|
|
||||||
hostsRepo *inframetrics.HostsRepo
|
hostsRepo *inframetrics.HostsRepo
|
||||||
processesRepo *inframetrics.ProcessesRepo
|
processesRepo *inframetrics.ProcessesRepo
|
||||||
podsRepo *inframetrics.PodsRepo
|
podsRepo *inframetrics.PodsRepo
|
||||||
@ -177,11 +174,6 @@ type APIHandlerOpts struct {
|
|||||||
// Querier Influx Interval
|
// Querier Influx Interval
|
||||||
FluxInterval time.Duration
|
FluxInterval time.Duration
|
||||||
|
|
||||||
// Use Logs New schema
|
|
||||||
UseLogsNewSchema bool
|
|
||||||
|
|
||||||
UseTraceNewSchema bool
|
|
||||||
|
|
||||||
JWT *authtypes.JWT
|
JWT *authtypes.JWT
|
||||||
|
|
||||||
AlertmanagerAPI *alertmanager.API
|
AlertmanagerAPI *alertmanager.API
|
||||||
@ -194,21 +186,17 @@ type APIHandlerOpts struct {
|
|||||||
// NewAPIHandler returns an APIHandler
|
// NewAPIHandler returns an APIHandler
|
||||||
func NewAPIHandler(opts APIHandlerOpts) (*APIHandler, error) {
|
func NewAPIHandler(opts APIHandlerOpts) (*APIHandler, error) {
|
||||||
querierOpts := querier.QuerierOptions{
|
querierOpts := querier.QuerierOptions{
|
||||||
Reader: opts.Reader,
|
Reader: opts.Reader,
|
||||||
Cache: opts.Cache,
|
Cache: opts.Cache,
|
||||||
KeyGenerator: queryBuilder.NewKeyGenerator(),
|
KeyGenerator: queryBuilder.NewKeyGenerator(),
|
||||||
FluxInterval: opts.FluxInterval,
|
FluxInterval: opts.FluxInterval,
|
||||||
UseLogsNewSchema: opts.UseLogsNewSchema,
|
|
||||||
UseTraceNewSchema: opts.UseTraceNewSchema,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
querierOptsV2 := querierV2.QuerierOptions{
|
querierOptsV2 := querierV2.QuerierOptions{
|
||||||
Reader: opts.Reader,
|
Reader: opts.Reader,
|
||||||
Cache: opts.Cache,
|
Cache: opts.Cache,
|
||||||
KeyGenerator: queryBuilder.NewKeyGenerator(),
|
KeyGenerator: queryBuilder.NewKeyGenerator(),
|
||||||
FluxInterval: opts.FluxInterval,
|
FluxInterval: opts.FluxInterval,
|
||||||
UseLogsNewSchema: opts.UseLogsNewSchema,
|
|
||||||
UseTraceNewSchema: opts.UseTraceNewSchema,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
querier := querier.NewQuerier(querierOpts)
|
querier := querier.NewQuerier(querierOpts)
|
||||||
@ -239,8 +227,6 @@ func NewAPIHandler(opts APIHandlerOpts) (*APIHandler, error) {
|
|||||||
LogsParsingPipelineController: opts.LogsParsingPipelineController,
|
LogsParsingPipelineController: opts.LogsParsingPipelineController,
|
||||||
querier: querier,
|
querier: querier,
|
||||||
querierV2: querierv2,
|
querierV2: querierv2,
|
||||||
UseLogsNewSchema: opts.UseLogsNewSchema,
|
|
||||||
UseTraceNewSchema: opts.UseTraceNewSchema,
|
|
||||||
hostsRepo: hostsRepo,
|
hostsRepo: hostsRepo,
|
||||||
processesRepo: processesRepo,
|
processesRepo: processesRepo,
|
||||||
podsRepo: podsRepo,
|
podsRepo: podsRepo,
|
||||||
@ -259,15 +245,8 @@ func NewAPIHandler(opts APIHandlerOpts) (*APIHandler, error) {
|
|||||||
FieldsAPI: opts.FieldsAPI,
|
FieldsAPI: opts.FieldsAPI,
|
||||||
}
|
}
|
||||||
|
|
||||||
logsQueryBuilder := logsv3.PrepareLogsQuery
|
logsQueryBuilder := logsv4.PrepareLogsQuery
|
||||||
if opts.UseLogsNewSchema {
|
tracesQueryBuilder := tracesV4.PrepareTracesQuery
|
||||||
logsQueryBuilder = logsv4.PrepareLogsQuery
|
|
||||||
}
|
|
||||||
|
|
||||||
tracesQueryBuilder := tracesV3.PrepareTracesQuery
|
|
||||||
if opts.UseTraceNewSchema {
|
|
||||||
tracesQueryBuilder = tracesV4.PrepareTracesQuery
|
|
||||||
}
|
|
||||||
|
|
||||||
builderOpts := queryBuilder.QueryBuilderOptions{
|
builderOpts := queryBuilder.QueryBuilderOptions{
|
||||||
BuildMetricQuery: metricsv3.PrepareMetricQuery,
|
BuildMetricQuery: metricsv3.PrepareMetricQuery,
|
||||||
@ -4839,11 +4818,7 @@ func (aH *APIHandler) queryRangeV3(ctx context.Context, queryRangeParams *v3.Que
|
|||||||
RespondError(w, apiErrObj, errQuriesByName)
|
RespondError(w, apiErrObj, errQuriesByName)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if aH.UseTraceNewSchema {
|
tracesV4.Enrich(queryRangeParams, spanKeys)
|
||||||
tracesV4.Enrich(queryRangeParams, spanKeys)
|
|
||||||
} else {
|
|
||||||
tracesV3.Enrich(queryRangeParams, spanKeys)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5202,88 +5177,7 @@ func (aH *APIHandler) liveTailLogsV2(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (aH *APIHandler) liveTailLogs(w http.ResponseWriter, r *http.Request) {
|
func (aH *APIHandler) liveTailLogs(w http.ResponseWriter, r *http.Request) {
|
||||||
if aH.UseLogsNewSchema {
|
aH.liveTailLogsV2(w, r)
|
||||||
aH.liveTailLogsV2(w, r)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// get the param from url and add it to body
|
|
||||||
stringReader := strings.NewReader(r.URL.Query().Get("q"))
|
|
||||||
r.Body = io.NopCloser(stringReader)
|
|
||||||
|
|
||||||
queryRangeParams, apiErrorObj := ParseQueryRangeParams(r)
|
|
||||||
if apiErrorObj != nil {
|
|
||||||
zap.L().Error(apiErrorObj.Err.Error())
|
|
||||||
RespondError(w, apiErrorObj, nil)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
var err error
|
|
||||||
var queryString string
|
|
||||||
switch queryRangeParams.CompositeQuery.QueryType {
|
|
||||||
case v3.QueryTypeBuilder:
|
|
||||||
// check if any enrichment is required for logs if yes then enrich them
|
|
||||||
if logsv3.EnrichmentRequired(queryRangeParams) {
|
|
||||||
logsFields, err := aH.reader.GetLogFields(r.Context())
|
|
||||||
if err != nil {
|
|
||||||
apiErrObj := &model.ApiError{Typ: model.ErrorInternal, Err: err}
|
|
||||||
RespondError(w, apiErrObj, nil)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// get the fields if any logs query is present
|
|
||||||
fields := model.GetLogFieldsV3(r.Context(), queryRangeParams, logsFields)
|
|
||||||
logsv3.Enrich(queryRangeParams, fields)
|
|
||||||
}
|
|
||||||
|
|
||||||
queryString, err = aH.queryBuilder.PrepareLiveTailQuery(queryRangeParams)
|
|
||||||
if err != nil {
|
|
||||||
RespondError(w, &model.ApiError{Typ: model.ErrorBadData, Err: err}, nil)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
err = fmt.Errorf("invalid query type")
|
|
||||||
RespondError(w, &model.ApiError{Typ: model.ErrorBadData, Err: err}, nil)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// create the client
|
|
||||||
client := &model.LogsLiveTailClient{Name: r.RemoteAddr, Logs: make(chan *model.SignozLog, 1000), Done: make(chan *bool), Error: make(chan error)}
|
|
||||||
go aH.reader.LiveTailLogsV3(r.Context(), queryString, uint64(queryRangeParams.Start), "", client)
|
|
||||||
|
|
||||||
w.Header().Set("Connection", "keep-alive")
|
|
||||||
w.Header().Set("Content-Type", "text/event-stream")
|
|
||||||
w.Header().Set("Cache-Control", "no-cache")
|
|
||||||
w.Header().Set("Access-Control-Allow-Origin", "*")
|
|
||||||
w.WriteHeader(200)
|
|
||||||
|
|
||||||
flusher, ok := w.(http.Flusher)
|
|
||||||
if !ok {
|
|
||||||
err := model.ApiError{Typ: model.ErrorStreamingNotSupported, Err: nil}
|
|
||||||
RespondError(w, &err, "streaming is not supported")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// flush the headers
|
|
||||||
flusher.Flush()
|
|
||||||
for {
|
|
||||||
select {
|
|
||||||
case log := <-client.Logs:
|
|
||||||
var buf bytes.Buffer
|
|
||||||
enc := json.NewEncoder(&buf)
|
|
||||||
enc.Encode(log)
|
|
||||||
fmt.Fprintf(w, "data: %v\n\n", buf.String())
|
|
||||||
flusher.Flush()
|
|
||||||
case <-client.Done:
|
|
||||||
zap.L().Debug("done!")
|
|
||||||
return
|
|
||||||
case err := <-client.Error:
|
|
||||||
zap.L().Error("error occurred", zap.Error(err))
|
|
||||||
fmt.Fprintf(w, "event: error\ndata: %v\n\n", err.Error())
|
|
||||||
flusher.Flush()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (aH *APIHandler) getMetricMetadata(w http.ResponseWriter, r *http.Request) {
|
func (aH *APIHandler) getMetricMetadata(w http.ResponseWriter, r *http.Request) {
|
||||||
@ -5324,11 +5218,7 @@ func (aH *APIHandler) queryRangeV4(ctx context.Context, queryRangeParams *v3.Que
|
|||||||
RespondError(w, apiErrObj, errQuriesByName)
|
RespondError(w, apiErrObj, errQuriesByName)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if aH.UseTraceNewSchema {
|
tracesV4.Enrich(queryRangeParams, spanKeys)
|
||||||
tracesV4.Enrich(queryRangeParams, spanKeys)
|
|
||||||
} else {
|
|
||||||
tracesV3.Enrich(queryRangeParams, spanKeys)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// WARN: Only works for AND operator in traces query
|
// WARN: Only works for AND operator in traces query
|
||||||
|
@ -6,10 +6,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
logsV3 "github.com/SigNoz/signoz/pkg/query-service/app/logs/v3"
|
|
||||||
logsV4 "github.com/SigNoz/signoz/pkg/query-service/app/logs/v4"
|
logsV4 "github.com/SigNoz/signoz/pkg/query-service/app/logs/v4"
|
||||||
metricsV3 "github.com/SigNoz/signoz/pkg/query-service/app/metrics/v3"
|
metricsV3 "github.com/SigNoz/signoz/pkg/query-service/app/metrics/v3"
|
||||||
tracesV3 "github.com/SigNoz/signoz/pkg/query-service/app/traces/v3"
|
|
||||||
tracesV4 "github.com/SigNoz/signoz/pkg/query-service/app/traces/v4"
|
tracesV4 "github.com/SigNoz/signoz/pkg/query-service/app/traces/v4"
|
||||||
"github.com/SigNoz/signoz/pkg/query-service/common"
|
"github.com/SigNoz/signoz/pkg/query-service/common"
|
||||||
"github.com/SigNoz/signoz/pkg/query-service/constants"
|
"github.com/SigNoz/signoz/pkg/query-service/constants"
|
||||||
@ -19,19 +17,15 @@ import (
|
|||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
||||||
func prepareLogsQuery(_ context.Context,
|
func prepareLogsQuery(
|
||||||
useLogsNewSchema bool,
|
_ context.Context,
|
||||||
start,
|
start,
|
||||||
end int64,
|
end int64,
|
||||||
builderQuery *v3.BuilderQuery,
|
builderQuery *v3.BuilderQuery,
|
||||||
params *v3.QueryRangeParamsV3,
|
params *v3.QueryRangeParamsV3,
|
||||||
) (string, error) {
|
) (string, error) {
|
||||||
query := ""
|
query := ""
|
||||||
|
logsQueryBuilder := logsV4.PrepareLogsQuery
|
||||||
logsQueryBuilder := logsV3.PrepareLogsQuery
|
|
||||||
if useLogsNewSchema {
|
|
||||||
logsQueryBuilder = logsV4.PrepareLogsQuery
|
|
||||||
}
|
|
||||||
|
|
||||||
if params == nil || builderQuery == nil {
|
if params == nil || builderQuery == nil {
|
||||||
return query, fmt.Errorf("params and builderQuery cannot be nil")
|
return query, fmt.Errorf("params and builderQuery cannot be nil")
|
||||||
@ -102,7 +96,7 @@ func (q *querier) runBuilderQuery(
|
|||||||
var err error
|
var err error
|
||||||
if _, ok := cacheKeys[queryName]; !ok || params.NoCache {
|
if _, ok := cacheKeys[queryName]; !ok || params.NoCache {
|
||||||
zap.L().Info("skipping cache for logs query", zap.String("queryName", queryName), zap.Int64("start", start), zap.Int64("end", end), zap.Int64("step", builderQuery.StepInterval), zap.Bool("noCache", params.NoCache), zap.String("cacheKey", cacheKeys[queryName]))
|
zap.L().Info("skipping cache for logs query", zap.String("queryName", queryName), zap.Int64("start", start), zap.Int64("end", end), zap.Int64("step", builderQuery.StepInterval), zap.Bool("noCache", params.NoCache), zap.String("cacheKey", cacheKeys[queryName]))
|
||||||
query, err = prepareLogsQuery(ctx, q.UseLogsNewSchema, start, end, builderQuery, params)
|
query, err = prepareLogsQuery(ctx, start, end, builderQuery, params)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ch <- channelResult{Err: err, Name: queryName, Query: query, Series: nil}
|
ch <- channelResult{Err: err, Name: queryName, Query: query, Series: nil}
|
||||||
return
|
return
|
||||||
@ -117,7 +111,7 @@ func (q *querier) runBuilderQuery(
|
|||||||
missedSeries := make([]querycache.CachedSeriesData, 0)
|
missedSeries := make([]querycache.CachedSeriesData, 0)
|
||||||
filteredMissedSeries := make([]querycache.CachedSeriesData, 0)
|
filteredMissedSeries := make([]querycache.CachedSeriesData, 0)
|
||||||
for _, miss := range misses {
|
for _, miss := range misses {
|
||||||
query, err = prepareLogsQuery(ctx, q.UseLogsNewSchema, miss.Start, miss.End, builderQuery, params)
|
query, err = prepareLogsQuery(ctx, miss.Start, miss.End, builderQuery, params)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ch <- channelResult{Err: err, Name: queryName, Query: query, Series: nil}
|
ch <- channelResult{Err: err, Name: queryName, Query: query, Series: nil}
|
||||||
return
|
return
|
||||||
@ -169,11 +163,7 @@ func (q *querier) runBuilderQuery(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if builderQuery.DataSource == v3.DataSourceTraces {
|
if builderQuery.DataSource == v3.DataSourceTraces {
|
||||||
|
tracesQueryBuilder := tracesV4.PrepareTracesQuery
|
||||||
tracesQueryBuilder := tracesV3.PrepareTracesQuery
|
|
||||||
if q.UseTraceNewSchema {
|
|
||||||
tracesQueryBuilder = tracesV4.PrepareTracesQuery
|
|
||||||
}
|
|
||||||
|
|
||||||
var query string
|
var query string
|
||||||
var err error
|
var err error
|
||||||
|
@ -6,11 +6,9 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
logsV3 "github.com/SigNoz/signoz/pkg/query-service/app/logs/v3"
|
|
||||||
logsV4 "github.com/SigNoz/signoz/pkg/query-service/app/logs/v4"
|
logsV4 "github.com/SigNoz/signoz/pkg/query-service/app/logs/v4"
|
||||||
metricsV3 "github.com/SigNoz/signoz/pkg/query-service/app/metrics/v3"
|
metricsV3 "github.com/SigNoz/signoz/pkg/query-service/app/metrics/v3"
|
||||||
"github.com/SigNoz/signoz/pkg/query-service/app/queryBuilder"
|
"github.com/SigNoz/signoz/pkg/query-service/app/queryBuilder"
|
||||||
tracesV3 "github.com/SigNoz/signoz/pkg/query-service/app/traces/v3"
|
|
||||||
tracesV4 "github.com/SigNoz/signoz/pkg/query-service/app/traces/v4"
|
tracesV4 "github.com/SigNoz/signoz/pkg/query-service/app/traces/v4"
|
||||||
"github.com/SigNoz/signoz/pkg/query-service/common"
|
"github.com/SigNoz/signoz/pkg/query-service/common"
|
||||||
"github.com/SigNoz/signoz/pkg/query-service/constants"
|
"github.com/SigNoz/signoz/pkg/query-service/constants"
|
||||||
@ -52,9 +50,6 @@ type querier struct {
|
|||||||
timeRanges [][]int
|
timeRanges [][]int
|
||||||
returnedSeries []*v3.Series
|
returnedSeries []*v3.Series
|
||||||
returnedErr error
|
returnedErr error
|
||||||
|
|
||||||
UseLogsNewSchema bool
|
|
||||||
UseTraceNewSchema bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type QuerierOptions struct {
|
type QuerierOptions struct {
|
||||||
@ -64,22 +59,14 @@ type QuerierOptions struct {
|
|||||||
FluxInterval time.Duration
|
FluxInterval time.Duration
|
||||||
|
|
||||||
// used for testing
|
// used for testing
|
||||||
TestingMode bool
|
TestingMode bool
|
||||||
ReturnedSeries []*v3.Series
|
ReturnedSeries []*v3.Series
|
||||||
ReturnedErr error
|
ReturnedErr error
|
||||||
UseLogsNewSchema bool
|
|
||||||
UseTraceNewSchema bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewQuerier(opts QuerierOptions) interfaces.Querier {
|
func NewQuerier(opts QuerierOptions) interfaces.Querier {
|
||||||
logsQueryBuilder := logsV3.PrepareLogsQuery
|
logsQueryBuilder := logsV4.PrepareLogsQuery
|
||||||
if opts.UseLogsNewSchema {
|
tracesQueryBuilder := tracesV4.PrepareTracesQuery
|
||||||
logsQueryBuilder = logsV4.PrepareLogsQuery
|
|
||||||
}
|
|
||||||
tracesQueryBuilder := tracesV3.PrepareTracesQuery
|
|
||||||
if opts.UseTraceNewSchema {
|
|
||||||
tracesQueryBuilder = tracesV4.PrepareTracesQuery
|
|
||||||
}
|
|
||||||
|
|
||||||
qc := querycache.NewQueryCache(querycache.WithCache(opts.Cache), querycache.WithFluxInterval(opts.FluxInterval))
|
qc := querycache.NewQueryCache(querycache.WithCache(opts.Cache), querycache.WithFluxInterval(opts.FluxInterval))
|
||||||
|
|
||||||
@ -96,11 +83,9 @@ func NewQuerier(opts QuerierOptions) interfaces.Querier {
|
|||||||
BuildMetricQuery: metricsV3.PrepareMetricQuery,
|
BuildMetricQuery: metricsV3.PrepareMetricQuery,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
testingMode: opts.TestingMode,
|
testingMode: opts.TestingMode,
|
||||||
returnedSeries: opts.ReturnedSeries,
|
returnedSeries: opts.ReturnedSeries,
|
||||||
returnedErr: opts.ReturnedErr,
|
returnedErr: opts.ReturnedErr,
|
||||||
UseLogsNewSchema: opts.UseLogsNewSchema,
|
|
||||||
UseTraceNewSchema: opts.UseTraceNewSchema,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -445,11 +430,6 @@ func (q *querier) runBuilderListQueries(ctx context.Context, params *v3.QueryRan
|
|||||||
len(params.CompositeQuery.BuilderQueries) == 1 &&
|
len(params.CompositeQuery.BuilderQueries) == 1 &&
|
||||||
params.CompositeQuery.PanelType != v3.PanelTypeTrace {
|
params.CompositeQuery.PanelType != v3.PanelTypeTrace {
|
||||||
for _, v := range params.CompositeQuery.BuilderQueries {
|
for _, v := range params.CompositeQuery.BuilderQueries {
|
||||||
if (v.DataSource == v3.DataSourceLogs && !q.UseLogsNewSchema) ||
|
|
||||||
(v.DataSource == v3.DataSourceTraces && !q.UseTraceNewSchema) {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
// only allow of logs queries with timestamp ordering desc
|
// only allow of logs queries with timestamp ordering desc
|
||||||
// TODO(nitya): allow for timestamp asc
|
// TODO(nitya): allow for timestamp asc
|
||||||
if (v.DataSource == v3.DataSourceLogs || v.DataSource == v3.DataSourceTraces) &&
|
if (v.DataSource == v3.DataSourceLogs || v.DataSource == v3.DataSourceTraces) &&
|
||||||
|
@ -1370,8 +1370,6 @@ func Test_querier_runWindowBasedListQuery(t *testing.T) {
|
|||||||
telemetryStore,
|
telemetryStore,
|
||||||
prometheustest.New(instrumentationtest.New().Logger(), prometheus.Config{}),
|
prometheustest.New(instrumentationtest.New().Logger(), prometheus.Config{}),
|
||||||
"",
|
"",
|
||||||
true,
|
|
||||||
true,
|
|
||||||
time.Duration(time.Second),
|
time.Duration(time.Second),
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
|
@ -6,11 +6,9 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
logsV3 "github.com/SigNoz/signoz/pkg/query-service/app/logs/v3"
|
|
||||||
logsV4 "github.com/SigNoz/signoz/pkg/query-service/app/logs/v4"
|
logsV4 "github.com/SigNoz/signoz/pkg/query-service/app/logs/v4"
|
||||||
metricsV3 "github.com/SigNoz/signoz/pkg/query-service/app/metrics/v3"
|
metricsV3 "github.com/SigNoz/signoz/pkg/query-service/app/metrics/v3"
|
||||||
metricsV4 "github.com/SigNoz/signoz/pkg/query-service/app/metrics/v4"
|
metricsV4 "github.com/SigNoz/signoz/pkg/query-service/app/metrics/v4"
|
||||||
tracesV3 "github.com/SigNoz/signoz/pkg/query-service/app/traces/v3"
|
|
||||||
tracesV4 "github.com/SigNoz/signoz/pkg/query-service/app/traces/v4"
|
tracesV4 "github.com/SigNoz/signoz/pkg/query-service/app/traces/v4"
|
||||||
"github.com/SigNoz/signoz/pkg/query-service/common"
|
"github.com/SigNoz/signoz/pkg/query-service/common"
|
||||||
"github.com/SigNoz/signoz/pkg/query-service/constants"
|
"github.com/SigNoz/signoz/pkg/query-service/constants"
|
||||||
@ -19,17 +17,14 @@ import (
|
|||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
||||||
func prepareLogsQuery(_ context.Context,
|
func prepareLogsQuery(
|
||||||
useLogsNewSchema bool,
|
_ context.Context,
|
||||||
start,
|
start,
|
||||||
end int64,
|
end int64,
|
||||||
builderQuery *v3.BuilderQuery,
|
builderQuery *v3.BuilderQuery,
|
||||||
params *v3.QueryRangeParamsV3,
|
params *v3.QueryRangeParamsV3,
|
||||||
) (string, error) {
|
) (string, error) {
|
||||||
logsQueryBuilder := logsV3.PrepareLogsQuery
|
logsQueryBuilder := logsV4.PrepareLogsQuery
|
||||||
if useLogsNewSchema {
|
|
||||||
logsQueryBuilder = logsV4.PrepareLogsQuery
|
|
||||||
}
|
|
||||||
query := ""
|
query := ""
|
||||||
|
|
||||||
if params == nil || builderQuery == nil {
|
if params == nil || builderQuery == nil {
|
||||||
@ -102,7 +97,7 @@ func (q *querier) runBuilderQuery(
|
|||||||
var err error
|
var err error
|
||||||
if _, ok := cacheKeys[queryName]; !ok || params.NoCache {
|
if _, ok := cacheKeys[queryName]; !ok || params.NoCache {
|
||||||
zap.L().Info("skipping cache for logs query", zap.String("queryName", queryName), zap.Int64("start", params.Start), zap.Int64("end", params.End), zap.Int64("step", params.Step), zap.Bool("noCache", params.NoCache), zap.String("cacheKey", cacheKeys[queryName]))
|
zap.L().Info("skipping cache for logs query", zap.String("queryName", queryName), zap.Int64("start", params.Start), zap.Int64("end", params.End), zap.Int64("step", params.Step), zap.Bool("noCache", params.NoCache), zap.String("cacheKey", cacheKeys[queryName]))
|
||||||
query, err = prepareLogsQuery(ctx, q.UseLogsNewSchema, start, end, builderQuery, params)
|
query, err = prepareLogsQuery(ctx, start, end, builderQuery, params)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ch <- channelResult{Err: err, Name: queryName, Query: query, Series: nil}
|
ch <- channelResult{Err: err, Name: queryName, Query: query, Series: nil}
|
||||||
return
|
return
|
||||||
@ -116,7 +111,7 @@ func (q *querier) runBuilderQuery(
|
|||||||
missedSeries := make([]querycache.CachedSeriesData, 0)
|
missedSeries := make([]querycache.CachedSeriesData, 0)
|
||||||
filteredMissedSeries := make([]querycache.CachedSeriesData, 0)
|
filteredMissedSeries := make([]querycache.CachedSeriesData, 0)
|
||||||
for _, miss := range misses {
|
for _, miss := range misses {
|
||||||
query, err = prepareLogsQuery(ctx, q.UseLogsNewSchema, miss.Start, miss.End, builderQuery, params)
|
query, err = prepareLogsQuery(ctx, miss.Start, miss.End, builderQuery, params)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ch <- channelResult{Err: err, Name: queryName, Query: query, Series: nil}
|
ch <- channelResult{Err: err, Name: queryName, Query: query, Series: nil}
|
||||||
return
|
return
|
||||||
@ -169,11 +164,7 @@ func (q *querier) runBuilderQuery(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if builderQuery.DataSource == v3.DataSourceTraces {
|
if builderQuery.DataSource == v3.DataSourceTraces {
|
||||||
|
tracesQueryBuilder := tracesV4.PrepareTracesQuery
|
||||||
tracesQueryBuilder := tracesV3.PrepareTracesQuery
|
|
||||||
if q.UseTraceNewSchema {
|
|
||||||
tracesQueryBuilder = tracesV4.PrepareTracesQuery
|
|
||||||
}
|
|
||||||
|
|
||||||
var query string
|
var query string
|
||||||
var err error
|
var err error
|
||||||
|
@ -6,11 +6,9 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
logsV3 "github.com/SigNoz/signoz/pkg/query-service/app/logs/v3"
|
|
||||||
logsV4 "github.com/SigNoz/signoz/pkg/query-service/app/logs/v4"
|
logsV4 "github.com/SigNoz/signoz/pkg/query-service/app/logs/v4"
|
||||||
metricsV4 "github.com/SigNoz/signoz/pkg/query-service/app/metrics/v4"
|
metricsV4 "github.com/SigNoz/signoz/pkg/query-service/app/metrics/v4"
|
||||||
"github.com/SigNoz/signoz/pkg/query-service/app/queryBuilder"
|
"github.com/SigNoz/signoz/pkg/query-service/app/queryBuilder"
|
||||||
tracesV3 "github.com/SigNoz/signoz/pkg/query-service/app/traces/v3"
|
|
||||||
tracesV4 "github.com/SigNoz/signoz/pkg/query-service/app/traces/v4"
|
tracesV4 "github.com/SigNoz/signoz/pkg/query-service/app/traces/v4"
|
||||||
"github.com/SigNoz/signoz/pkg/query-service/common"
|
"github.com/SigNoz/signoz/pkg/query-service/common"
|
||||||
"github.com/SigNoz/signoz/pkg/query-service/constants"
|
"github.com/SigNoz/signoz/pkg/query-service/constants"
|
||||||
@ -49,11 +47,9 @@ type querier struct {
|
|||||||
testingMode bool
|
testingMode bool
|
||||||
queriesExecuted []string
|
queriesExecuted []string
|
||||||
// tuple of start and end time in milliseconds
|
// tuple of start and end time in milliseconds
|
||||||
timeRanges [][]int
|
timeRanges [][]int
|
||||||
returnedSeries []*v3.Series
|
returnedSeries []*v3.Series
|
||||||
returnedErr error
|
returnedErr error
|
||||||
UseLogsNewSchema bool
|
|
||||||
UseTraceNewSchema bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type QuerierOptions struct {
|
type QuerierOptions struct {
|
||||||
@ -63,23 +59,14 @@ type QuerierOptions struct {
|
|||||||
FluxInterval time.Duration
|
FluxInterval time.Duration
|
||||||
|
|
||||||
// used for testing
|
// used for testing
|
||||||
TestingMode bool
|
TestingMode bool
|
||||||
ReturnedSeries []*v3.Series
|
ReturnedSeries []*v3.Series
|
||||||
ReturnedErr error
|
ReturnedErr error
|
||||||
UseLogsNewSchema bool
|
|
||||||
UseTraceNewSchema bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewQuerier(opts QuerierOptions) interfaces.Querier {
|
func NewQuerier(opts QuerierOptions) interfaces.Querier {
|
||||||
logsQueryBuilder := logsV3.PrepareLogsQuery
|
logsQueryBuilder := logsV4.PrepareLogsQuery
|
||||||
if opts.UseLogsNewSchema {
|
tracesQueryBuilder := tracesV4.PrepareTracesQuery
|
||||||
logsQueryBuilder = logsV4.PrepareLogsQuery
|
|
||||||
}
|
|
||||||
|
|
||||||
tracesQueryBuilder := tracesV3.PrepareTracesQuery
|
|
||||||
if opts.UseTraceNewSchema {
|
|
||||||
tracesQueryBuilder = tracesV4.PrepareTracesQuery
|
|
||||||
}
|
|
||||||
|
|
||||||
qc := querycache.NewQueryCache(querycache.WithCache(opts.Cache), querycache.WithFluxInterval(opts.FluxInterval))
|
qc := querycache.NewQueryCache(querycache.WithCache(opts.Cache), querycache.WithFluxInterval(opts.FluxInterval))
|
||||||
|
|
||||||
@ -96,11 +83,9 @@ func NewQuerier(opts QuerierOptions) interfaces.Querier {
|
|||||||
BuildMetricQuery: metricsV4.PrepareMetricQuery,
|
BuildMetricQuery: metricsV4.PrepareMetricQuery,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
testingMode: opts.TestingMode,
|
testingMode: opts.TestingMode,
|
||||||
returnedSeries: opts.ReturnedSeries,
|
returnedSeries: opts.ReturnedSeries,
|
||||||
returnedErr: opts.ReturnedErr,
|
returnedErr: opts.ReturnedErr,
|
||||||
UseLogsNewSchema: opts.UseLogsNewSchema,
|
|
||||||
UseTraceNewSchema: opts.UseTraceNewSchema,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -446,11 +431,6 @@ func (q *querier) runBuilderListQueries(ctx context.Context, params *v3.QueryRan
|
|||||||
len(params.CompositeQuery.BuilderQueries) == 1 &&
|
len(params.CompositeQuery.BuilderQueries) == 1 &&
|
||||||
params.CompositeQuery.PanelType != v3.PanelTypeTrace {
|
params.CompositeQuery.PanelType != v3.PanelTypeTrace {
|
||||||
for _, v := range params.CompositeQuery.BuilderQueries {
|
for _, v := range params.CompositeQuery.BuilderQueries {
|
||||||
if (v.DataSource == v3.DataSourceLogs && !q.UseLogsNewSchema) ||
|
|
||||||
(v.DataSource == v3.DataSourceTraces && !q.UseTraceNewSchema) {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
// only allow of logs queries with timestamp ordering desc
|
// only allow of logs queries with timestamp ordering desc
|
||||||
// TODO(nitya): allow for timestamp asc
|
// TODO(nitya): allow for timestamp asc
|
||||||
if (v.DataSource == v3.DataSourceLogs || v.DataSource == v3.DataSourceTraces) &&
|
if (v.DataSource == v3.DataSourceLogs || v.DataSource == v3.DataSourceTraces) &&
|
||||||
|
@ -1424,8 +1424,6 @@ func Test_querier_runWindowBasedListQuery(t *testing.T) {
|
|||||||
telemetryStore,
|
telemetryStore,
|
||||||
prometheustest.New(instrumentationtest.New().Logger(), prometheus.Config{}),
|
prometheustest.New(instrumentationtest.New().Logger(), prometheus.Config{}),
|
||||||
"",
|
"",
|
||||||
true,
|
|
||||||
true,
|
|
||||||
time.Duration(time.Second),
|
time.Duration(time.Second),
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
|
@ -53,8 +53,6 @@ type ServerOptions struct {
|
|||||||
FluxInterval string
|
FluxInterval string
|
||||||
FluxIntervalForTraceDetail string
|
FluxIntervalForTraceDetail string
|
||||||
Cluster string
|
Cluster string
|
||||||
UseLogsNewSchema bool
|
|
||||||
UseTraceNewSchema bool
|
|
||||||
SigNoz *signoz.SigNoz
|
SigNoz *signoz.SigNoz
|
||||||
Jwt *authtypes.JWT
|
Jwt *authtypes.JWT
|
||||||
}
|
}
|
||||||
@ -110,8 +108,6 @@ func NewServer(serverOptions *ServerOptions) (*Server, error) {
|
|||||||
serverOptions.SigNoz.TelemetryStore,
|
serverOptions.SigNoz.TelemetryStore,
|
||||||
serverOptions.SigNoz.Prometheus,
|
serverOptions.SigNoz.Prometheus,
|
||||||
serverOptions.Cluster,
|
serverOptions.Cluster,
|
||||||
serverOptions.UseLogsNewSchema,
|
|
||||||
serverOptions.UseTraceNewSchema,
|
|
||||||
fluxIntervalForTraceDetail,
|
fluxIntervalForTraceDetail,
|
||||||
serverOptions.SigNoz.Cache,
|
serverOptions.SigNoz.Cache,
|
||||||
)
|
)
|
||||||
@ -129,8 +125,6 @@ func NewServer(serverOptions *ServerOptions) (*Server, error) {
|
|||||||
serverOptions.SigNoz.SQLStore.SQLxDB(),
|
serverOptions.SigNoz.SQLStore.SQLxDB(),
|
||||||
reader,
|
reader,
|
||||||
c,
|
c,
|
||||||
serverOptions.UseLogsNewSchema,
|
|
||||||
serverOptions.UseTraceNewSchema,
|
|
||||||
serverOptions.SigNoz.SQLStore,
|
serverOptions.SigNoz.SQLStore,
|
||||||
serverOptions.SigNoz.TelemetryStore,
|
serverOptions.SigNoz.TelemetryStore,
|
||||||
serverOptions.SigNoz.Prometheus,
|
serverOptions.SigNoz.Prometheus,
|
||||||
@ -173,8 +167,6 @@ func NewServer(serverOptions *ServerOptions) (*Server, error) {
|
|||||||
LogsParsingPipelineController: logParsingPipelineController,
|
LogsParsingPipelineController: logParsingPipelineController,
|
||||||
Cache: c,
|
Cache: c,
|
||||||
FluxInterval: fluxInterval,
|
FluxInterval: fluxInterval,
|
||||||
UseLogsNewSchema: serverOptions.UseLogsNewSchema,
|
|
||||||
UseTraceNewSchema: serverOptions.UseTraceNewSchema,
|
|
||||||
JWT: serverOptions.Jwt,
|
JWT: serverOptions.Jwt,
|
||||||
AlertmanagerAPI: alertmanager.NewAPI(serverOptions.SigNoz.Alertmanager),
|
AlertmanagerAPI: alertmanager.NewAPI(serverOptions.SigNoz.Alertmanager),
|
||||||
FieldsAPI: fields.NewAPI(serverOptions.SigNoz.TelemetryStore),
|
FieldsAPI: fields.NewAPI(serverOptions.SigNoz.TelemetryStore),
|
||||||
@ -435,25 +427,21 @@ func makeRulesManager(
|
|||||||
db *sqlx.DB,
|
db *sqlx.DB,
|
||||||
ch interfaces.Reader,
|
ch interfaces.Reader,
|
||||||
cache cache.Cache,
|
cache cache.Cache,
|
||||||
useLogsNewSchema bool,
|
|
||||||
useTraceNewSchema bool,
|
|
||||||
sqlstore sqlstore.SQLStore,
|
sqlstore sqlstore.SQLStore,
|
||||||
telemetryStore telemetrystore.TelemetryStore,
|
telemetryStore telemetrystore.TelemetryStore,
|
||||||
prometheus prometheus.Prometheus,
|
prometheus prometheus.Prometheus,
|
||||||
) (*rules.Manager, error) {
|
) (*rules.Manager, error) {
|
||||||
// create manager opts
|
// create manager opts
|
||||||
managerOpts := &rules.ManagerOptions{
|
managerOpts := &rules.ManagerOptions{
|
||||||
TelemetryStore: telemetryStore,
|
TelemetryStore: telemetryStore,
|
||||||
Prometheus: prometheus,
|
Prometheus: prometheus,
|
||||||
DBConn: db,
|
DBConn: db,
|
||||||
Context: context.Background(),
|
Context: context.Background(),
|
||||||
Logger: zap.L(),
|
Logger: zap.L(),
|
||||||
Reader: ch,
|
Reader: ch,
|
||||||
Cache: cache,
|
Cache: cache,
|
||||||
EvalDelay: constants.GetEvalDelay(),
|
EvalDelay: constants.GetEvalDelay(),
|
||||||
UseLogsNewSchema: useLogsNewSchema,
|
SQLStore: sqlstore,
|
||||||
UseTraceNewSchema: useTraceNewSchema,
|
|
||||||
SQLStore: sqlstore,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// create Manager
|
// create Manager
|
||||||
|
@ -47,7 +47,9 @@ func main() {
|
|||||||
var maxOpenConns int
|
var maxOpenConns int
|
||||||
var dialTimeout time.Duration
|
var dialTimeout time.Duration
|
||||||
|
|
||||||
|
// Deprecated
|
||||||
flag.BoolVar(&useLogsNewSchema, "use-logs-new-schema", false, "use logs_v2 schema for logs")
|
flag.BoolVar(&useLogsNewSchema, "use-logs-new-schema", false, "use logs_v2 schema for logs")
|
||||||
|
// Deprecated
|
||||||
flag.BoolVar(&useTraceNewSchema, "use-trace-new-schema", false, "use new schema for traces")
|
flag.BoolVar(&useTraceNewSchema, "use-trace-new-schema", false, "use new schema for traces")
|
||||||
// Deprecated
|
// Deprecated
|
||||||
flag.StringVar(&promConfigPath, "config", "./config/prometheus.yml", "(prometheus config to read metrics)")
|
flag.StringVar(&promConfigPath, "config", "./config/prometheus.yml", "(prometheus config to read metrics)")
|
||||||
@ -130,8 +132,6 @@ func main() {
|
|||||||
FluxInterval: fluxInterval,
|
FluxInterval: fluxInterval,
|
||||||
FluxIntervalForTraceDetail: fluxIntervalForTraceDetail,
|
FluxIntervalForTraceDetail: fluxIntervalForTraceDetail,
|
||||||
Cluster: cluster,
|
Cluster: cluster,
|
||||||
UseLogsNewSchema: useLogsNewSchema,
|
|
||||||
UseTraceNewSchema: useTraceNewSchema,
|
|
||||||
SigNoz: signoz,
|
SigNoz: signoz,
|
||||||
Jwt: jwt,
|
Jwt: jwt,
|
||||||
}
|
}
|
||||||
|
@ -34,33 +34,29 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type PrepareTaskOptions struct {
|
type PrepareTaskOptions struct {
|
||||||
Rule *ruletypes.PostableRule
|
Rule *ruletypes.PostableRule
|
||||||
TaskName string
|
TaskName string
|
||||||
RuleStore ruletypes.RuleStore
|
RuleStore ruletypes.RuleStore
|
||||||
MaintenanceStore ruletypes.MaintenanceStore
|
MaintenanceStore ruletypes.MaintenanceStore
|
||||||
Logger *zap.Logger
|
Logger *zap.Logger
|
||||||
Reader interfaces.Reader
|
Reader interfaces.Reader
|
||||||
Cache cache.Cache
|
Cache cache.Cache
|
||||||
ManagerOpts *ManagerOptions
|
ManagerOpts *ManagerOptions
|
||||||
NotifyFunc NotifyFunc
|
NotifyFunc NotifyFunc
|
||||||
SQLStore sqlstore.SQLStore
|
SQLStore sqlstore.SQLStore
|
||||||
UseLogsNewSchema bool
|
OrgID string
|
||||||
UseTraceNewSchema bool
|
|
||||||
OrgID string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type PrepareTestRuleOptions struct {
|
type PrepareTestRuleOptions struct {
|
||||||
Rule *ruletypes.PostableRule
|
Rule *ruletypes.PostableRule
|
||||||
RuleStore ruletypes.RuleStore
|
RuleStore ruletypes.RuleStore
|
||||||
MaintenanceStore ruletypes.MaintenanceStore
|
MaintenanceStore ruletypes.MaintenanceStore
|
||||||
Logger *zap.Logger
|
Logger *zap.Logger
|
||||||
Reader interfaces.Reader
|
Reader interfaces.Reader
|
||||||
Cache cache.Cache
|
Cache cache.Cache
|
||||||
ManagerOpts *ManagerOptions
|
ManagerOpts *ManagerOptions
|
||||||
NotifyFunc NotifyFunc
|
NotifyFunc NotifyFunc
|
||||||
SQLStore sqlstore.SQLStore
|
SQLStore sqlstore.SQLStore
|
||||||
UseLogsNewSchema bool
|
|
||||||
UseTraceNewSchema bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const taskNamesuffix = "webAppEditor"
|
const taskNamesuffix = "webAppEditor"
|
||||||
@ -95,10 +91,7 @@ type ManagerOptions struct {
|
|||||||
|
|
||||||
EvalDelay time.Duration
|
EvalDelay time.Duration
|
||||||
|
|
||||||
PrepareTaskFunc func(opts PrepareTaskOptions) (Task, error)
|
PrepareTaskFunc func(opts PrepareTaskOptions) (Task, error)
|
||||||
|
|
||||||
UseLogsNewSchema bool
|
|
||||||
UseTraceNewSchema bool
|
|
||||||
PrepareTestRuleFunc func(opts PrepareTestRuleOptions) (int, *model.ApiError)
|
PrepareTestRuleFunc func(opts PrepareTestRuleOptions) (int, *model.ApiError)
|
||||||
Alertmanager alertmanager.Alertmanager
|
Alertmanager alertmanager.Alertmanager
|
||||||
SQLStore sqlstore.SQLStore
|
SQLStore sqlstore.SQLStore
|
||||||
@ -121,9 +114,6 @@ type Manager struct {
|
|||||||
prepareTaskFunc func(opts PrepareTaskOptions) (Task, error)
|
prepareTaskFunc func(opts PrepareTaskOptions) (Task, error)
|
||||||
prepareTestRuleFunc func(opts PrepareTestRuleOptions) (int, *model.ApiError)
|
prepareTestRuleFunc func(opts PrepareTestRuleOptions) (int, *model.ApiError)
|
||||||
|
|
||||||
UseLogsNewSchema bool
|
|
||||||
UseTraceNewSchema bool
|
|
||||||
|
|
||||||
alertmanager alertmanager.Alertmanager
|
alertmanager alertmanager.Alertmanager
|
||||||
sqlstore sqlstore.SQLStore
|
sqlstore sqlstore.SQLStore
|
||||||
}
|
}
|
||||||
@ -156,8 +146,6 @@ func defaultPrepareTaskFunc(opts PrepareTaskOptions) (Task, error) {
|
|||||||
ruleId,
|
ruleId,
|
||||||
opts.Rule,
|
opts.Rule,
|
||||||
opts.Reader,
|
opts.Reader,
|
||||||
opts.UseLogsNewSchema,
|
|
||||||
opts.UseTraceNewSchema,
|
|
||||||
WithEvalDelay(opts.ManagerOpts.EvalDelay),
|
WithEvalDelay(opts.ManagerOpts.EvalDelay),
|
||||||
WithSQLStore(opts.SQLStore),
|
WithSQLStore(opts.SQLStore),
|
||||||
)
|
)
|
||||||
@ -407,19 +395,17 @@ func (m *Manager) editTask(_ context.Context, orgID string, rule *ruletypes.Post
|
|||||||
zap.L().Debug("editing a rule task", zap.String("name", taskName))
|
zap.L().Debug("editing a rule task", zap.String("name", taskName))
|
||||||
|
|
||||||
newTask, err := m.prepareTaskFunc(PrepareTaskOptions{
|
newTask, err := m.prepareTaskFunc(PrepareTaskOptions{
|
||||||
Rule: rule,
|
Rule: rule,
|
||||||
TaskName: taskName,
|
TaskName: taskName,
|
||||||
RuleStore: m.ruleStore,
|
RuleStore: m.ruleStore,
|
||||||
MaintenanceStore: m.maintenanceStore,
|
MaintenanceStore: m.maintenanceStore,
|
||||||
Logger: m.logger,
|
Logger: m.logger,
|
||||||
Reader: m.reader,
|
Reader: m.reader,
|
||||||
Cache: m.cache,
|
Cache: m.cache,
|
||||||
ManagerOpts: m.opts,
|
ManagerOpts: m.opts,
|
||||||
NotifyFunc: m.prepareNotifyFunc(),
|
NotifyFunc: m.prepareNotifyFunc(),
|
||||||
SQLStore: m.sqlstore,
|
SQLStore: m.sqlstore,
|
||||||
UseLogsNewSchema: m.opts.UseLogsNewSchema,
|
OrgID: orgID,
|
||||||
UseTraceNewSchema: m.opts.UseTraceNewSchema,
|
|
||||||
OrgID: orgID,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -595,19 +581,17 @@ func (m *Manager) addTask(_ context.Context, orgID string, rule *ruletypes.Posta
|
|||||||
|
|
||||||
zap.L().Debug("adding a new rule task", zap.String("name", taskName))
|
zap.L().Debug("adding a new rule task", zap.String("name", taskName))
|
||||||
newTask, err := m.prepareTaskFunc(PrepareTaskOptions{
|
newTask, err := m.prepareTaskFunc(PrepareTaskOptions{
|
||||||
Rule: rule,
|
Rule: rule,
|
||||||
TaskName: taskName,
|
TaskName: taskName,
|
||||||
RuleStore: m.ruleStore,
|
RuleStore: m.ruleStore,
|
||||||
MaintenanceStore: m.maintenanceStore,
|
MaintenanceStore: m.maintenanceStore,
|
||||||
Logger: m.logger,
|
Logger: m.logger,
|
||||||
Reader: m.reader,
|
Reader: m.reader,
|
||||||
Cache: m.cache,
|
Cache: m.cache,
|
||||||
ManagerOpts: m.opts,
|
ManagerOpts: m.opts,
|
||||||
NotifyFunc: m.prepareNotifyFunc(),
|
NotifyFunc: m.prepareNotifyFunc(),
|
||||||
SQLStore: m.sqlstore,
|
SQLStore: m.sqlstore,
|
||||||
UseLogsNewSchema: m.opts.UseLogsNewSchema,
|
OrgID: orgID,
|
||||||
UseTraceNewSchema: m.opts.UseTraceNewSchema,
|
|
||||||
OrgID: orgID,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -987,17 +971,15 @@ func (m *Manager) TestNotification(ctx context.Context, ruleStr string) (int, *m
|
|||||||
}
|
}
|
||||||
|
|
||||||
alertCount, apiErr := m.prepareTestRuleFunc(PrepareTestRuleOptions{
|
alertCount, apiErr := m.prepareTestRuleFunc(PrepareTestRuleOptions{
|
||||||
Rule: parsedRule,
|
Rule: parsedRule,
|
||||||
RuleStore: m.ruleStore,
|
RuleStore: m.ruleStore,
|
||||||
MaintenanceStore: m.maintenanceStore,
|
MaintenanceStore: m.maintenanceStore,
|
||||||
Logger: m.logger,
|
Logger: m.logger,
|
||||||
Reader: m.reader,
|
Reader: m.reader,
|
||||||
Cache: m.cache,
|
Cache: m.cache,
|
||||||
ManagerOpts: m.opts,
|
ManagerOpts: m.opts,
|
||||||
NotifyFunc: m.prepareTestNotifyFunc(),
|
NotifyFunc: m.prepareTestNotifyFunc(),
|
||||||
SQLStore: m.sqlstore,
|
SQLStore: m.sqlstore,
|
||||||
UseLogsNewSchema: m.opts.UseLogsNewSchema,
|
|
||||||
UseTraceNewSchema: m.opts.UseTraceNewSchema,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
return alertCount, apiErr
|
return alertCount, apiErr
|
||||||
|
@ -15,7 +15,6 @@ import (
|
|||||||
// TestNotification prepares a dummy rule for given rule parameters and
|
// TestNotification prepares a dummy rule for given rule parameters and
|
||||||
// sends a test notification. returns alert count and error (if any)
|
// sends a test notification. returns alert count and error (if any)
|
||||||
func defaultTestNotification(opts PrepareTestRuleOptions) (int, *model.ApiError) {
|
func defaultTestNotification(opts PrepareTestRuleOptions) (int, *model.ApiError) {
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
if opts.Rule == nil {
|
if opts.Rule == nil {
|
||||||
@ -48,8 +47,6 @@ func defaultTestNotification(opts PrepareTestRuleOptions) (int, *model.ApiError)
|
|||||||
alertname,
|
alertname,
|
||||||
parsedRule,
|
parsedRule,
|
||||||
opts.Reader,
|
opts.Reader,
|
||||||
opts.UseLogsNewSchema,
|
|
||||||
opts.UseTraceNewSchema,
|
|
||||||
WithSendAlways(),
|
WithSendAlways(),
|
||||||
WithSendUnmatched(),
|
WithSendUnmatched(),
|
||||||
WithSQLStore(opts.SQLStore),
|
WithSQLStore(opts.SQLStore),
|
||||||
|
@ -29,7 +29,6 @@ import (
|
|||||||
"github.com/SigNoz/signoz/pkg/query-service/utils/timestamp"
|
"github.com/SigNoz/signoz/pkg/query-service/utils/timestamp"
|
||||||
|
|
||||||
logsv3 "github.com/SigNoz/signoz/pkg/query-service/app/logs/v3"
|
logsv3 "github.com/SigNoz/signoz/pkg/query-service/app/logs/v3"
|
||||||
tracesV3 "github.com/SigNoz/signoz/pkg/query-service/app/traces/v3"
|
|
||||||
tracesV4 "github.com/SigNoz/signoz/pkg/query-service/app/traces/v4"
|
tracesV4 "github.com/SigNoz/signoz/pkg/query-service/app/traces/v4"
|
||||||
"github.com/SigNoz/signoz/pkg/query-service/formatter"
|
"github.com/SigNoz/signoz/pkg/query-service/formatter"
|
||||||
|
|
||||||
@ -52,16 +51,12 @@ type ThresholdRule struct {
|
|||||||
// used for attribute metadata enrichment for logs and traces
|
// used for attribute metadata enrichment for logs and traces
|
||||||
logsKeys map[string]v3.AttributeKey
|
logsKeys map[string]v3.AttributeKey
|
||||||
spansKeys map[string]v3.AttributeKey
|
spansKeys map[string]v3.AttributeKey
|
||||||
|
|
||||||
useTraceNewSchema bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewThresholdRule(
|
func NewThresholdRule(
|
||||||
id string,
|
id string,
|
||||||
p *ruletypes.PostableRule,
|
p *ruletypes.PostableRule,
|
||||||
reader interfaces.Reader,
|
reader interfaces.Reader,
|
||||||
useLogsNewSchema bool,
|
|
||||||
useTraceNewSchema bool,
|
|
||||||
opts ...RuleOption,
|
opts ...RuleOption,
|
||||||
) (*ThresholdRule, error) {
|
) (*ThresholdRule, error) {
|
||||||
|
|
||||||
@ -73,25 +68,20 @@ func NewThresholdRule(
|
|||||||
}
|
}
|
||||||
|
|
||||||
t := ThresholdRule{
|
t := ThresholdRule{
|
||||||
BaseRule: baseRule,
|
BaseRule: baseRule,
|
||||||
version: p.Version,
|
version: p.Version,
|
||||||
useTraceNewSchema: useTraceNewSchema,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
querierOption := querier.QuerierOptions{
|
querierOption := querier.QuerierOptions{
|
||||||
Reader: reader,
|
Reader: reader,
|
||||||
Cache: nil,
|
Cache: nil,
|
||||||
KeyGenerator: queryBuilder.NewKeyGenerator(),
|
KeyGenerator: queryBuilder.NewKeyGenerator(),
|
||||||
UseLogsNewSchema: useLogsNewSchema,
|
|
||||||
UseTraceNewSchema: useTraceNewSchema,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
querierOptsV2 := querierV2.QuerierOptions{
|
querierOptsV2 := querierV2.QuerierOptions{
|
||||||
Reader: reader,
|
Reader: reader,
|
||||||
Cache: nil,
|
Cache: nil,
|
||||||
KeyGenerator: queryBuilder.NewKeyGenerator(),
|
KeyGenerator: queryBuilder.NewKeyGenerator(),
|
||||||
UseLogsNewSchema: useLogsNewSchema,
|
|
||||||
UseTraceNewSchema: useTraceNewSchema,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
t.querier = querier.NewQuerier(querierOption)
|
t.querier = querier.NewQuerier(querierOption)
|
||||||
@ -301,11 +291,7 @@ func (r *ThresholdRule) buildAndRunQuery(ctx context.Context, ts time.Time) (rul
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
r.spansKeys = spanKeys
|
r.spansKeys = spanKeys
|
||||||
if r.useTraceNewSchema {
|
tracesV4.Enrich(params, spanKeys)
|
||||||
tracesV4.Enrich(params, spanKeys)
|
|
||||||
} else {
|
|
||||||
tracesV3.Enrich(params, spanKeys)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -801,7 +801,7 @@ func TestThresholdRuleShouldAlert(t *testing.T) {
|
|||||||
postableRule.RuleCondition.MatchType = ruletypes.MatchType(c.matchType)
|
postableRule.RuleCondition.MatchType = ruletypes.MatchType(c.matchType)
|
||||||
postableRule.RuleCondition.Target = &c.target
|
postableRule.RuleCondition.Target = &c.target
|
||||||
|
|
||||||
rule, err := NewThresholdRule("69", &postableRule, nil, true, true, WithEvalDelay(2*time.Minute))
|
rule, err := NewThresholdRule("69", &postableRule, nil, WithEvalDelay(2*time.Minute))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
}
|
}
|
||||||
@ -889,7 +889,7 @@ func TestPrepareLinksToLogs(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
rule, err := NewThresholdRule("69", &postableRule, nil, true, true, WithEvalDelay(2*time.Minute))
|
rule, err := NewThresholdRule("69", &postableRule, nil, WithEvalDelay(2*time.Minute))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
}
|
}
|
||||||
@ -930,7 +930,7 @@ func TestPrepareLinksToTraces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
rule, err := NewThresholdRule("69", &postableRule, nil, true, true, WithEvalDelay(2*time.Minute))
|
rule, err := NewThresholdRule("69", &postableRule, nil, WithEvalDelay(2*time.Minute))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
}
|
}
|
||||||
@ -1005,7 +1005,7 @@ func TestThresholdRuleLabelNormalization(t *testing.T) {
|
|||||||
postableRule.RuleCondition.MatchType = ruletypes.MatchType(c.matchType)
|
postableRule.RuleCondition.MatchType = ruletypes.MatchType(c.matchType)
|
||||||
postableRule.RuleCondition.Target = &c.target
|
postableRule.RuleCondition.Target = &c.target
|
||||||
|
|
||||||
rule, err := NewThresholdRule("69", &postableRule, nil, true, true, WithEvalDelay(2*time.Minute))
|
rule, err := NewThresholdRule("69", &postableRule, nil, WithEvalDelay(2*time.Minute))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
}
|
}
|
||||||
@ -1057,7 +1057,7 @@ func TestThresholdRuleEvalDelay(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for idx, c := range cases {
|
for idx, c := range cases {
|
||||||
rule, err := NewThresholdRule("69", &postableRule, nil, true, true) // no eval delay
|
rule, err := NewThresholdRule("69", &postableRule, nil) // no eval delay
|
||||||
if err != nil {
|
if err != nil {
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
}
|
}
|
||||||
@ -1105,7 +1105,7 @@ func TestThresholdRuleClickHouseTmpl(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for idx, c := range cases {
|
for idx, c := range cases {
|
||||||
rule, err := NewThresholdRule("69", &postableRule, nil, true, true, WithEvalDelay(2*time.Minute))
|
rule, err := NewThresholdRule("69", &postableRule, nil, WithEvalDelay(2*time.Minute))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
}
|
}
|
||||||
@ -1244,8 +1244,8 @@ func TestThresholdRuleUnitCombinations(t *testing.T) {
|
|||||||
options := clickhouseReader.NewOptions("", "", "archiveNamespace")
|
options := clickhouseReader.NewOptions("", "", "archiveNamespace")
|
||||||
readerCache, err := memorycache.New(context.Background(), factorytest.NewSettings(), cache.Config{Provider: "memory", Memory: cache.Memory{TTL: DefaultFrequency}})
|
readerCache, err := memorycache.New(context.Background(), factorytest.NewSettings(), cache.Config{Provider: "memory", Memory: cache.Memory{TTL: DefaultFrequency}})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
reader := clickhouseReader.NewReaderFromClickhouseConnection(options, nil, telemetryStore, prometheustest.New(instrumentationtest.New().Logger(), prometheus.Config{}), "", true, true, time.Duration(time.Second), readerCache)
|
reader := clickhouseReader.NewReaderFromClickhouseConnection(options, nil, telemetryStore, prometheustest.New(instrumentationtest.New().Logger(), prometheus.Config{}), "", time.Duration(time.Second), readerCache)
|
||||||
rule, err := NewThresholdRule("69", &postableRule, reader, true, true)
|
rule, err := NewThresholdRule("69", &postableRule, reader)
|
||||||
rule.TemporalityMap = map[string]map[v3.Temporality]bool{
|
rule.TemporalityMap = map[string]map[v3.Temporality]bool{
|
||||||
"signoz_calls_total": {
|
"signoz_calls_total": {
|
||||||
v3.Delta: true,
|
v3.Delta: true,
|
||||||
@ -1340,9 +1340,9 @@ func TestThresholdRuleNoData(t *testing.T) {
|
|||||||
}
|
}
|
||||||
readerCache, err := memorycache.New(context.Background(), factorytest.NewSettings(), cache.Config{Provider: "memory", Memory: cache.Memory{TTL: DefaultFrequency}})
|
readerCache, err := memorycache.New(context.Background(), factorytest.NewSettings(), cache.Config{Provider: "memory", Memory: cache.Memory{TTL: DefaultFrequency}})
|
||||||
options := clickhouseReader.NewOptions("", "", "archiveNamespace")
|
options := clickhouseReader.NewOptions("", "", "archiveNamespace")
|
||||||
reader := clickhouseReader.NewReaderFromClickhouseConnection(options, nil, telemetryStore, prometheustest.New(instrumentationtest.New().Logger(), prometheus.Config{}), "", true, true, time.Duration(time.Second), readerCache)
|
reader := clickhouseReader.NewReaderFromClickhouseConnection(options, nil, telemetryStore, prometheustest.New(instrumentationtest.New().Logger(), prometheus.Config{}), "", time.Duration(time.Second), readerCache)
|
||||||
|
|
||||||
rule, err := NewThresholdRule("69", &postableRule, reader, true, true)
|
rule, err := NewThresholdRule("69", &postableRule, reader)
|
||||||
rule.TemporalityMap = map[string]map[v3.Temporality]bool{
|
rule.TemporalityMap = map[string]map[v3.Temporality]bool{
|
||||||
"signoz_calls_total": {
|
"signoz_calls_total": {
|
||||||
v3.Delta: true,
|
v3.Delta: true,
|
||||||
@ -1444,9 +1444,9 @@ func TestThresholdRuleTracesLink(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
options := clickhouseReader.NewOptions("", "", "archiveNamespace")
|
options := clickhouseReader.NewOptions("", "", "archiveNamespace")
|
||||||
reader := clickhouseReader.NewReaderFromClickhouseConnection(options, nil, telemetryStore, prometheustest.New(instrumentationtest.New().Logger(), prometheus.Config{}), "", true, true, time.Duration(time.Second), nil)
|
reader := clickhouseReader.NewReaderFromClickhouseConnection(options, nil, telemetryStore, prometheustest.New(instrumentationtest.New().Logger(), prometheus.Config{}), "", time.Duration(time.Second), nil)
|
||||||
|
|
||||||
rule, err := NewThresholdRule("69", &postableRule, reader, true, true)
|
rule, err := NewThresholdRule("69", &postableRule, reader)
|
||||||
rule.TemporalityMap = map[string]map[v3.Temporality]bool{
|
rule.TemporalityMap = map[string]map[v3.Temporality]bool{
|
||||||
"signoz_calls_total": {
|
"signoz_calls_total": {
|
||||||
v3.Delta: true,
|
v3.Delta: true,
|
||||||
@ -1565,9 +1565,9 @@ func TestThresholdRuleLogsLink(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
options := clickhouseReader.NewOptions("", "", "archiveNamespace")
|
options := clickhouseReader.NewOptions("", "", "archiveNamespace")
|
||||||
reader := clickhouseReader.NewReaderFromClickhouseConnection(options, nil, telemetryStore, prometheustest.New(instrumentationtest.New().Logger(), prometheus.Config{}), "", true, true, time.Duration(time.Second), nil)
|
reader := clickhouseReader.NewReaderFromClickhouseConnection(options, nil, telemetryStore, prometheustest.New(instrumentationtest.New().Logger(), prometheus.Config{}), "", time.Duration(time.Second), nil)
|
||||||
|
|
||||||
rule, err := NewThresholdRule("69", &postableRule, reader, true, true)
|
rule, err := NewThresholdRule("69", &postableRule, reader)
|
||||||
rule.TemporalityMap = map[string]map[v3.Temporality]bool{
|
rule.TemporalityMap = map[string]map[v3.Temporality]bool{
|
||||||
"signoz_calls_total": {
|
"signoz_calls_total": {
|
||||||
v3.Delta: true,
|
v3.Delta: true,
|
||||||
@ -1643,7 +1643,7 @@ func TestThresholdRuleShiftBy(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
rule, err := NewThresholdRule("69", &postableRule, nil, true, true)
|
rule, err := NewThresholdRule("69", &postableRule, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
}
|
}
|
||||||
|
@ -46,8 +46,6 @@ func NewMockClickhouseReader(t *testing.T, testDB sqlstore.SQLStore) (*clickhous
|
|||||||
telemetryStore,
|
telemetryStore,
|
||||||
prometheustest.New(instrumentationtest.New().Logger(), prometheus.Config{}),
|
prometheustest.New(instrumentationtest.New().Logger(), prometheus.Config{}),
|
||||||
"",
|
"",
|
||||||
true,
|
|
||||||
true,
|
|
||||||
time.Duration(time.Second),
|
time.Duration(time.Second),
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user