mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-12 18:29:00 +08:00
chore(ff): remove unused SMART_TRACE_DETAIL feature flag (#7527)
This commit is contained in:
parent
54a82b1664
commit
68f874e433
@ -162,7 +162,6 @@ func (ah *APIHandler) RegisterRoutes(router *mux.Router, am *baseapp.AuthMiddlew
|
|||||||
router.HandleFunc("/api/v1/invite/{token}", am.OpenAccess(ah.getInvite)).Methods(http.MethodGet)
|
router.HandleFunc("/api/v1/invite/{token}", am.OpenAccess(ah.getInvite)).Methods(http.MethodGet)
|
||||||
router.HandleFunc("/api/v1/register", am.OpenAccess(ah.registerUser)).Methods(http.MethodPost)
|
router.HandleFunc("/api/v1/register", am.OpenAccess(ah.registerUser)).Methods(http.MethodPost)
|
||||||
router.HandleFunc("/api/v1/login", am.OpenAccess(ah.loginUser)).Methods(http.MethodPost)
|
router.HandleFunc("/api/v1/login", am.OpenAccess(ah.loginUser)).Methods(http.MethodPost)
|
||||||
router.HandleFunc("/api/v1/traces/{traceId}", am.ViewAccess(ah.searchTraces)).Methods(http.MethodGet)
|
|
||||||
|
|
||||||
// PAT APIs
|
// PAT APIs
|
||||||
router.HandleFunc("/api/v1/pats", am.AdminAccess(ah.createPAT)).Methods(http.MethodPost)
|
router.HandleFunc("/api/v1/pats", am.AdminAccess(ah.createPAT)).Methods(http.MethodPost)
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
package api
|
|
||||||
|
|
||||||
import (
|
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"github.com/SigNoz/signoz/ee/query-service/app/db"
|
|
||||||
"github.com/SigNoz/signoz/ee/query-service/model"
|
|
||||||
baseapp "github.com/SigNoz/signoz/pkg/query-service/app"
|
|
||||||
basemodel "github.com/SigNoz/signoz/pkg/query-service/model"
|
|
||||||
"go.uber.org/zap"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (ah *APIHandler) searchTraces(w http.ResponseWriter, r *http.Request) {
|
|
||||||
|
|
||||||
if !ah.CheckFeature(basemodel.SmartTraceDetail) {
|
|
||||||
zap.L().Info("SmartTraceDetail feature is not enabled in this plan")
|
|
||||||
ah.APIHandler.SearchTraces(w, r)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
searchTracesParams, err := baseapp.ParseSearchTracesParams(r)
|
|
||||||
if err != nil {
|
|
||||||
RespondError(w, &model.ApiError{Typ: model.ErrorBadData, Err: err}, "Error reading params")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err := ah.opts.DataConnector.SearchTraces(r.Context(), searchTracesParams, db.SmartTraceAlgorithm)
|
|
||||||
if ah.HandleError(w, err, http.StatusBadRequest) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
ah.WriteJSON(w, r, result)
|
|
||||||
|
|
||||||
}
|
|
@ -8,7 +8,6 @@ import (
|
|||||||
"github.com/SigNoz/signoz/pkg/cache"
|
"github.com/SigNoz/signoz/pkg/cache"
|
||||||
"github.com/SigNoz/signoz/pkg/prometheus"
|
"github.com/SigNoz/signoz/pkg/prometheus"
|
||||||
basechr "github.com/SigNoz/signoz/pkg/query-service/app/clickhouseReader"
|
basechr "github.com/SigNoz/signoz/pkg/query-service/app/clickhouseReader"
|
||||||
"github.com/SigNoz/signoz/pkg/query-service/interfaces"
|
|
||||||
"github.com/SigNoz/signoz/pkg/sqlstore"
|
"github.com/SigNoz/signoz/pkg/sqlstore"
|
||||||
"github.com/SigNoz/signoz/pkg/telemetrystore"
|
"github.com/SigNoz/signoz/pkg/telemetrystore"
|
||||||
)
|
)
|
||||||
@ -23,14 +22,13 @@ func NewDataConnector(
|
|||||||
sqlDB sqlstore.SQLStore,
|
sqlDB sqlstore.SQLStore,
|
||||||
telemetryStore telemetrystore.TelemetryStore,
|
telemetryStore telemetrystore.TelemetryStore,
|
||||||
prometheus prometheus.Prometheus,
|
prometheus prometheus.Prometheus,
|
||||||
lm interfaces.FeatureLookup,
|
|
||||||
cluster string,
|
cluster string,
|
||||||
useLogsNewSchema bool,
|
useLogsNewSchema bool,
|
||||||
useTraceNewSchema bool,
|
useTraceNewSchema bool,
|
||||||
fluxIntervalForTraceDetail time.Duration,
|
fluxIntervalForTraceDetail time.Duration,
|
||||||
cache cache.Cache,
|
cache cache.Cache,
|
||||||
) *ClickhouseReader {
|
) *ClickhouseReader {
|
||||||
chReader := basechr.NewReader(sqlDB, telemetryStore, prometheus, lm, cluster, useLogsNewSchema, useTraceNewSchema, fluxIntervalForTraceDetail, cache)
|
chReader := basechr.NewReader(sqlDB, telemetryStore, prometheus, cluster, useLogsNewSchema, useTraceNewSchema, fluxIntervalForTraceDetail, cache)
|
||||||
return &ClickhouseReader{
|
return &ClickhouseReader{
|
||||||
conn: telemetryStore.ClickhouseDB(),
|
conn: telemetryStore.ClickhouseDB(),
|
||||||
appdb: sqlDB,
|
appdb: sqlDB,
|
||||||
|
@ -142,7 +142,6 @@ func NewServer(serverOptions *ServerOptions) (*Server, error) {
|
|||||||
serverOptions.SigNoz.SQLStore,
|
serverOptions.SigNoz.SQLStore,
|
||||||
serverOptions.SigNoz.TelemetryStore,
|
serverOptions.SigNoz.TelemetryStore,
|
||||||
serverOptions.SigNoz.Prometheus,
|
serverOptions.SigNoz.Prometheus,
|
||||||
lm,
|
|
||||||
serverOptions.Cluster,
|
serverOptions.Cluster,
|
||||||
serverOptions.UseLogsNewSchema,
|
serverOptions.UseLogsNewSchema,
|
||||||
serverOptions.UseTraceNewSchema,
|
serverOptions.UseTraceNewSchema,
|
||||||
|
@ -52,13 +52,6 @@ var BasicPlan = basemodel.FeatureSet{
|
|||||||
UsageLimit: -1,
|
UsageLimit: -1,
|
||||||
Route: "",
|
Route: "",
|
||||||
},
|
},
|
||||||
basemodel.Feature{
|
|
||||||
Name: basemodel.SmartTraceDetail,
|
|
||||||
Active: false,
|
|
||||||
Usage: 0,
|
|
||||||
UsageLimit: -1,
|
|
||||||
Route: "",
|
|
||||||
},
|
|
||||||
basemodel.Feature{
|
basemodel.Feature{
|
||||||
Name: basemodel.CustomMetricsFunction,
|
Name: basemodel.CustomMetricsFunction,
|
||||||
Active: false,
|
Active: false,
|
||||||
@ -181,13 +174,6 @@ var ProPlan = basemodel.FeatureSet{
|
|||||||
UsageLimit: -1,
|
UsageLimit: -1,
|
||||||
Route: "",
|
Route: "",
|
||||||
},
|
},
|
||||||
basemodel.Feature{
|
|
||||||
Name: basemodel.SmartTraceDetail,
|
|
||||||
Active: true,
|
|
||||||
Usage: 0,
|
|
||||||
UsageLimit: -1,
|
|
||||||
Route: "",
|
|
||||||
},
|
|
||||||
basemodel.Feature{
|
basemodel.Feature{
|
||||||
Name: basemodel.CustomMetricsFunction,
|
Name: basemodel.CustomMetricsFunction,
|
||||||
Active: true,
|
Active: true,
|
||||||
@ -310,13 +296,6 @@ var EnterprisePlan = basemodel.FeatureSet{
|
|||||||
UsageLimit: -1,
|
UsageLimit: -1,
|
||||||
Route: "",
|
Route: "",
|
||||||
},
|
},
|
||||||
basemodel.Feature{
|
|
||||||
Name: basemodel.SmartTraceDetail,
|
|
||||||
Active: true,
|
|
||||||
Usage: 0,
|
|
||||||
UsageLimit: -1,
|
|
||||||
Route: "",
|
|
||||||
},
|
|
||||||
basemodel.Feature{
|
basemodel.Feature{
|
||||||
Name: basemodel.CustomMetricsFunction,
|
Name: basemodel.CustomMetricsFunction,
|
||||||
Active: true,
|
Active: true,
|
||||||
|
@ -10,7 +10,6 @@ export enum FeatureKeys {
|
|||||||
ALERT_CHANNEL_MSTEAMS = 'ALERT_CHANNEL_MSTEAMS',
|
ALERT_CHANNEL_MSTEAMS = 'ALERT_CHANNEL_MSTEAMS',
|
||||||
DurationSort = 'DurationSort',
|
DurationSort = 'DurationSort',
|
||||||
TimestampSort = 'TimestampSort',
|
TimestampSort = 'TimestampSort',
|
||||||
SMART_TRACE_DETAIL = 'SMART_TRACE_DETAIL',
|
|
||||||
CUSTOM_METRICS_FUNCTION = 'CUSTOM_METRICS_FUNCTION',
|
CUSTOM_METRICS_FUNCTION = 'CUSTOM_METRICS_FUNCTION',
|
||||||
QUERY_BUILDER_PANELS = 'QUERY_BUILDER_PANELS',
|
QUERY_BUILDER_PANELS = 'QUERY_BUILDER_PANELS',
|
||||||
QUERY_BUILDER_ALERTS = 'QUERY_BUILDER_ALERTS',
|
QUERY_BUILDER_ALERTS = 'QUERY_BUILDER_ALERTS',
|
||||||
|
@ -200,13 +200,6 @@ export function getAppContextMock(
|
|||||||
usage_limit: -1,
|
usage_limit: -1,
|
||||||
route: '',
|
route: '',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: FeatureKeys.SMART_TRACE_DETAIL,
|
|
||||||
active: true,
|
|
||||||
usage: 0,
|
|
||||||
usage_limit: -1,
|
|
||||||
route: '',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: FeatureKeys.CUSTOM_METRICS_FUNCTION,
|
name: FeatureKeys.CUSTOM_METRICS_FUNCTION,
|
||||||
active: true,
|
active: true,
|
||||||
|
2
go.mod
2
go.mod
@ -77,7 +77,6 @@ require (
|
|||||||
gopkg.in/segmentio/analytics-go.v3 v3.1.0
|
gopkg.in/segmentio/analytics-go.v3 v3.1.0
|
||||||
gopkg.in/yaml.v2 v2.4.0
|
gopkg.in/yaml.v2 v2.4.0
|
||||||
gopkg.in/yaml.v3 v3.0.1
|
gopkg.in/yaml.v3 v3.0.1
|
||||||
honnef.co/go/tools v0.0.1-2020.1.4
|
|
||||||
k8s.io/apimachinery v0.31.3
|
k8s.io/apimachinery v0.31.3
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -89,7 +88,6 @@ require (
|
|||||||
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.0 // indirect
|
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.0 // indirect
|
||||||
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect
|
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect
|
||||||
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect
|
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect
|
||||||
github.com/BurntSushi/toml v0.3.1 // indirect
|
|
||||||
github.com/ClickHouse/ch-go v0.61.5 // indirect
|
github.com/ClickHouse/ch-go v0.61.5 // indirect
|
||||||
github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b // indirect
|
github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b // indirect
|
||||||
github.com/andybalholm/brotli v1.1.1 // indirect
|
github.com/andybalholm/brotli v1.1.1 // indirect
|
||||||
|
2
go.sum
2
go.sum
@ -83,7 +83,6 @@ github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJ
|
|||||||
github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE=
|
github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE=
|
||||||
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU=
|
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU=
|
||||||
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI=
|
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI=
|
||||||
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
|
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||||
github.com/ClickHouse/ch-go v0.61.5 h1:zwR8QbYI0tsMiEcze/uIMK+Tz1D3XZXLdNrlaOpeEI4=
|
github.com/ClickHouse/ch-go v0.61.5 h1:zwR8QbYI0tsMiEcze/uIMK+Tz1D3XZXLdNrlaOpeEI4=
|
||||||
@ -1653,7 +1652,6 @@ honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWh
|
|||||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||||
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||||
honnef.co/go/tools v0.0.1-2020.1.4 h1:UoveltGrhghAA7ePc+e+QYDHXrBps2PqFZiHkGR/xK8=
|
|
||||||
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||||
k8s.io/api v0.31.3 h1:umzm5o8lFbdN/hIXbrK9oRpOproJO62CV1zqxXrLgk8=
|
k8s.io/api v0.31.3 h1:umzm5o8lFbdN/hIXbrK9oRpOproJO62CV1zqxXrLgk8=
|
||||||
k8s.io/api v0.31.3/go.mod h1:UJrkIp9pnMOI9K2nlL6vwpxRzzEX5sWgn8kGQe92kCE=
|
k8s.io/api v0.31.3/go.mod h1:UJrkIp9pnMOI9K2nlL6vwpxRzzEX5sWgn8kGQe92kCE=
|
||||||
|
@ -22,10 +22,8 @@ import (
|
|||||||
"github.com/SigNoz/signoz/pkg/types"
|
"github.com/SigNoz/signoz/pkg/types"
|
||||||
"github.com/SigNoz/signoz/pkg/valuer"
|
"github.com/SigNoz/signoz/pkg/valuer"
|
||||||
"github.com/uptrace/bun"
|
"github.com/uptrace/bun"
|
||||||
"honnef.co/go/tools/config"
|
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/mailru/easyjson"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/prometheus/prometheus/promql"
|
"github.com/prometheus/prometheus/promql"
|
||||||
@ -46,7 +44,6 @@ import (
|
|||||||
"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"
|
||||||
chErrors "github.com/SigNoz/signoz/pkg/query-service/errors"
|
chErrors "github.com/SigNoz/signoz/pkg/query-service/errors"
|
||||||
"github.com/SigNoz/signoz/pkg/query-service/interfaces"
|
|
||||||
"github.com/SigNoz/signoz/pkg/query-service/metrics"
|
"github.com/SigNoz/signoz/pkg/query-service/metrics"
|
||||||
"github.com/SigNoz/signoz/pkg/query-service/model"
|
"github.com/SigNoz/signoz/pkg/query-service/model"
|
||||||
v3 "github.com/SigNoz/signoz/pkg/query-service/model/v3"
|
v3 "github.com/SigNoz/signoz/pkg/query-service/model/v3"
|
||||||
@ -143,10 +140,6 @@ type ClickHouseReader struct {
|
|||||||
logsResourceTableV2 string
|
logsResourceTableV2 string
|
||||||
logsResourceLocalTableV2 string
|
logsResourceLocalTableV2 string
|
||||||
|
|
||||||
promConfigFile string
|
|
||||||
promConfig *config.Config
|
|
||||||
featureFlags interfaces.FeatureLookup
|
|
||||||
|
|
||||||
liveTailRefreshSeconds int
|
liveTailRefreshSeconds int
|
||||||
cluster string
|
cluster string
|
||||||
|
|
||||||
@ -172,7 +165,6 @@ func NewReader(
|
|||||||
sqlDB sqlstore.SQLStore,
|
sqlDB sqlstore.SQLStore,
|
||||||
telemetryStore telemetrystore.TelemetryStore,
|
telemetryStore telemetrystore.TelemetryStore,
|
||||||
prometheus prometheus.Prometheus,
|
prometheus prometheus.Prometheus,
|
||||||
featureFlag interfaces.FeatureLookup,
|
|
||||||
cluster string,
|
cluster string,
|
||||||
useLogsNewSchema bool,
|
useLogsNewSchema bool,
|
||||||
useTraceNewSchema bool,
|
useTraceNewSchema bool,
|
||||||
@ -180,7 +172,7 @@ func NewReader(
|
|||||||
cache cache.Cache,
|
cache cache.Cache,
|
||||||
) *ClickHouseReader {
|
) *ClickHouseReader {
|
||||||
options := NewOptions(primaryNamespace, archiveNamespace)
|
options := NewOptions(primaryNamespace, archiveNamespace)
|
||||||
return NewReaderFromClickhouseConnection(options, sqlDB, telemetryStore, prometheus, featureFlag, cluster, useLogsNewSchema, useTraceNewSchema, fluxIntervalForTraceDetail, cache)
|
return NewReaderFromClickhouseConnection(options, sqlDB, telemetryStore, prometheus, cluster, useLogsNewSchema, useTraceNewSchema, fluxIntervalForTraceDetail, cache)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewReaderFromClickhouseConnection(
|
func NewReaderFromClickhouseConnection(
|
||||||
@ -188,7 +180,6 @@ func NewReaderFromClickhouseConnection(
|
|||||||
sqlDB sqlstore.SQLStore,
|
sqlDB sqlstore.SQLStore,
|
||||||
telemetryStore telemetrystore.TelemetryStore,
|
telemetryStore telemetrystore.TelemetryStore,
|
||||||
prometheus prometheus.Prometheus,
|
prometheus prometheus.Prometheus,
|
||||||
featureFlag interfaces.FeatureLookup,
|
|
||||||
cluster string,
|
cluster string,
|
||||||
useLogsNewSchema bool,
|
useLogsNewSchema bool,
|
||||||
useTraceNewSchema bool,
|
useTraceNewSchema bool,
|
||||||
@ -231,7 +222,6 @@ func NewReaderFromClickhouseConnection(
|
|||||||
logsResourceKeys: options.primary.LogsResourceKeysTable,
|
logsResourceKeys: options.primary.LogsResourceKeysTable,
|
||||||
logsTagAttributeTableV2: options.primary.LogsTagAttributeTableV2,
|
logsTagAttributeTableV2: options.primary.LogsTagAttributeTableV2,
|
||||||
liveTailRefreshSeconds: options.primary.LiveTailRefreshSeconds,
|
liveTailRefreshSeconds: options.primary.LiveTailRefreshSeconds,
|
||||||
featureFlags: featureFlag,
|
|
||||||
cluster: cluster,
|
cluster: cluster,
|
||||||
queryProgressTracker: queryprogress.NewQueryProgressTracker(),
|
queryProgressTracker: queryprogress.NewQueryProgressTracker(),
|
||||||
|
|
||||||
@ -990,267 +980,6 @@ func (r *ClickHouseReader) GetUsage(ctx context.Context, queryParams *model.GetU
|
|||||||
return &usageItems, nil
|
return &usageItems, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *ClickHouseReader) SearchTracesV2(ctx context.Context, params *model.SearchTracesParams,
|
|
||||||
smartTraceAlgorithm func(payload []model.SearchSpanResponseItem, targetSpanId string,
|
|
||||||
levelUp int, levelDown int, spanLimit int) ([]model.SearchSpansResult, error)) (*[]model.SearchSpansResult, error) {
|
|
||||||
searchSpansResult := []model.SearchSpansResult{
|
|
||||||
{
|
|
||||||
Columns: []string{"__time", "SpanId", "TraceId", "ServiceName", "Name", "Kind", "DurationNano", "TagsKeys", "TagsValues", "References", "Events", "HasError", "StatusMessage", "StatusCodeString", "SpanKind"},
|
|
||||||
IsSubTree: false,
|
|
||||||
Events: make([][]interface{}, 0),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
var traceSummary model.TraceSummary
|
|
||||||
summaryQuery := fmt.Sprintf("SELECT * from %s.%s WHERE trace_id=$1", r.TraceDB, r.traceSummaryTable)
|
|
||||||
err := r.db.QueryRow(ctx, summaryQuery, params.TraceID).Scan(&traceSummary.TraceID, &traceSummary.Start, &traceSummary.End, &traceSummary.NumSpans)
|
|
||||||
if err != nil {
|
|
||||||
if err == sql.ErrNoRows {
|
|
||||||
return &searchSpansResult, nil
|
|
||||||
}
|
|
||||||
zap.L().Error("Error in processing sql query", zap.Error(err))
|
|
||||||
return nil, fmt.Errorf("error in processing sql query")
|
|
||||||
}
|
|
||||||
|
|
||||||
if traceSummary.NumSpans > uint64(params.MaxSpansInTrace) {
|
|
||||||
zap.L().Error("Max spans allowed in a trace limit reached", zap.Int("MaxSpansInTrace", params.MaxSpansInTrace),
|
|
||||||
zap.Uint64("Count", traceSummary.NumSpans))
|
|
||||||
claims, ok := authtypes.ClaimsFromContext(ctx)
|
|
||||||
if ok {
|
|
||||||
data := map[string]interface{}{
|
|
||||||
"traceSize": traceSummary.NumSpans,
|
|
||||||
"maxSpansInTraceLimit": params.MaxSpansInTrace,
|
|
||||||
}
|
|
||||||
telemetry.GetInstance().SendEvent(telemetry.TELEMETRY_EVENT_MAX_SPANS_ALLOWED_LIMIT_REACHED, data, claims.Email, true, false)
|
|
||||||
}
|
|
||||||
return nil, fmt.Errorf("max spans allowed in trace limit reached, please contact support for more details")
|
|
||||||
}
|
|
||||||
|
|
||||||
claims, ok := authtypes.ClaimsFromContext(ctx)
|
|
||||||
if ok {
|
|
||||||
data := map[string]interface{}{
|
|
||||||
"traceSize": traceSummary.NumSpans,
|
|
||||||
}
|
|
||||||
telemetry.GetInstance().SendEvent(telemetry.TELEMETRY_EVENT_TRACE_DETAIL_API, data, claims.Email, true, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
var startTime, endTime, durationNano uint64
|
|
||||||
var searchScanResponses []model.SpanItemV2
|
|
||||||
|
|
||||||
query := fmt.Sprintf("SELECT timestamp, duration_nano, span_id, trace_id, has_error, kind, resource_string_service$$name, name, references, attributes_string, attributes_number, attributes_bool, resources_string, events, status_message, status_code_string, kind_string FROM %s.%s WHERE trace_id=$1 and ts_bucket_start>=$2 and ts_bucket_start<=$3", r.TraceDB, r.traceTableName)
|
|
||||||
|
|
||||||
start := time.Now()
|
|
||||||
|
|
||||||
err = r.db.Select(ctx, &searchScanResponses, query, params.TraceID, strconv.FormatInt(traceSummary.Start.Unix()-1800, 10), strconv.FormatInt(traceSummary.End.Unix(), 10))
|
|
||||||
|
|
||||||
zap.L().Info(query)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
zap.L().Error("Error in processing sql query", zap.Error(err))
|
|
||||||
return nil, fmt.Errorf("error in processing sql query")
|
|
||||||
}
|
|
||||||
end := time.Now()
|
|
||||||
zap.L().Debug("getTraceSQLQuery took: ", zap.Duration("duration", end.Sub(start)))
|
|
||||||
|
|
||||||
searchSpansResult[0].Events = make([][]interface{}, len(searchScanResponses))
|
|
||||||
|
|
||||||
searchSpanResponses := []model.SearchSpanResponseItem{}
|
|
||||||
start = time.Now()
|
|
||||||
for _, item := range searchScanResponses {
|
|
||||||
ref := []model.OtelSpanRef{}
|
|
||||||
err := json.Unmarshal([]byte(item.References), &ref)
|
|
||||||
if err != nil {
|
|
||||||
zap.L().Error("Error unmarshalling references", zap.Error(err))
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// merge attributes_number and attributes_bool to attributes_string
|
|
||||||
for k, v := range item.Attributes_bool {
|
|
||||||
item.Attributes_string[k] = fmt.Sprintf("%v", v)
|
|
||||||
}
|
|
||||||
for k, v := range item.Attributes_number {
|
|
||||||
item.Attributes_string[k] = fmt.Sprintf("%v", v)
|
|
||||||
}
|
|
||||||
for k, v := range item.Resources_string {
|
|
||||||
item.Attributes_string[k] = v
|
|
||||||
}
|
|
||||||
|
|
||||||
jsonItem := model.SearchSpanResponseItem{
|
|
||||||
SpanID: item.SpanID,
|
|
||||||
TraceID: item.TraceID,
|
|
||||||
ServiceName: item.ServiceName,
|
|
||||||
Name: item.Name,
|
|
||||||
Kind: int32(item.Kind),
|
|
||||||
DurationNano: int64(item.DurationNano),
|
|
||||||
HasError: item.HasError,
|
|
||||||
StatusMessage: item.StatusMessage,
|
|
||||||
StatusCodeString: item.StatusCodeString,
|
|
||||||
SpanKind: item.SpanKind,
|
|
||||||
References: ref,
|
|
||||||
Events: item.Events,
|
|
||||||
TagMap: item.Attributes_string,
|
|
||||||
}
|
|
||||||
|
|
||||||
jsonItem.TimeUnixNano = uint64(item.TimeUnixNano.UnixNano() / 1000000)
|
|
||||||
|
|
||||||
searchSpanResponses = append(searchSpanResponses, jsonItem)
|
|
||||||
if startTime == 0 || jsonItem.TimeUnixNano < startTime {
|
|
||||||
startTime = jsonItem.TimeUnixNano
|
|
||||||
}
|
|
||||||
if endTime == 0 || jsonItem.TimeUnixNano > endTime {
|
|
||||||
endTime = jsonItem.TimeUnixNano
|
|
||||||
}
|
|
||||||
if durationNano == 0 || uint64(jsonItem.DurationNano) > durationNano {
|
|
||||||
durationNano = uint64(jsonItem.DurationNano)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end = time.Now()
|
|
||||||
zap.L().Debug("getTraceSQLQuery unmarshal took: ", zap.Duration("duration", end.Sub(start)))
|
|
||||||
|
|
||||||
err = r.featureFlags.CheckFeature(model.SmartTraceDetail)
|
|
||||||
smartAlgoEnabled := err == nil
|
|
||||||
if len(searchScanResponses) > params.SpansRenderLimit && smartAlgoEnabled {
|
|
||||||
start = time.Now()
|
|
||||||
searchSpansResult, err = smartTraceAlgorithm(searchSpanResponses, params.SpanID, params.LevelUp, params.LevelDown, params.SpansRenderLimit)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
end = time.Now()
|
|
||||||
zap.L().Debug("smartTraceAlgo took: ", zap.Duration("duration", end.Sub(start)))
|
|
||||||
claims, ok := authtypes.ClaimsFromContext(ctx)
|
|
||||||
if ok {
|
|
||||||
data := map[string]interface{}{
|
|
||||||
"traceSize": len(searchScanResponses),
|
|
||||||
"spansRenderLimit": params.SpansRenderLimit,
|
|
||||||
}
|
|
||||||
telemetry.GetInstance().SendEvent(telemetry.TELEMETRY_EVENT_LARGE_TRACE_OPENED, data, claims.Email, true, false)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for i, item := range searchSpanResponses {
|
|
||||||
spanEvents := item.GetValues()
|
|
||||||
searchSpansResult[0].Events[i] = spanEvents
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
searchSpansResult[0].StartTimestampMillis = startTime - (durationNano / 1000000)
|
|
||||||
searchSpansResult[0].EndTimestampMillis = endTime + (durationNano / 1000000)
|
|
||||||
|
|
||||||
return &searchSpansResult, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *ClickHouseReader) SearchTraces(ctx context.Context, params *model.SearchTracesParams,
|
|
||||||
smartTraceAlgorithm func(payload []model.SearchSpanResponseItem, targetSpanId string,
|
|
||||||
levelUp int, levelDown int, spanLimit int) ([]model.SearchSpansResult, error)) (*[]model.SearchSpansResult, error) {
|
|
||||||
|
|
||||||
if r.useTraceNewSchema {
|
|
||||||
return r.SearchTracesV2(ctx, params, smartTraceAlgorithm)
|
|
||||||
}
|
|
||||||
|
|
||||||
var countSpans uint64
|
|
||||||
countQuery := fmt.Sprintf("SELECT count() as count from %s.%s WHERE traceID=$1", r.TraceDB, r.SpansTable)
|
|
||||||
err := r.db.QueryRow(ctx, countQuery, params.TraceID).Scan(&countSpans)
|
|
||||||
if err != nil {
|
|
||||||
zap.L().Error("Error in processing sql query", zap.Error(err))
|
|
||||||
return nil, fmt.Errorf("error in processing sql query")
|
|
||||||
}
|
|
||||||
|
|
||||||
if countSpans > uint64(params.MaxSpansInTrace) {
|
|
||||||
zap.L().Error("Max spans allowed in a trace limit reached", zap.Int("MaxSpansInTrace", params.MaxSpansInTrace),
|
|
||||||
zap.Uint64("Count", countSpans))
|
|
||||||
claims, ok := authtypes.ClaimsFromContext(ctx)
|
|
||||||
if ok {
|
|
||||||
data := map[string]interface{}{
|
|
||||||
"traceSize": countSpans,
|
|
||||||
"maxSpansInTraceLimit": params.MaxSpansInTrace,
|
|
||||||
}
|
|
||||||
telemetry.GetInstance().SendEvent(telemetry.TELEMETRY_EVENT_MAX_SPANS_ALLOWED_LIMIT_REACHED, data, claims.Email, true, false)
|
|
||||||
}
|
|
||||||
return nil, fmt.Errorf("max spans allowed in trace limit reached, please contact support for more details")
|
|
||||||
}
|
|
||||||
|
|
||||||
claims, ok := authtypes.ClaimsFromContext(ctx)
|
|
||||||
if ok {
|
|
||||||
data := map[string]interface{}{
|
|
||||||
"traceSize": countSpans,
|
|
||||||
}
|
|
||||||
telemetry.GetInstance().SendEvent(telemetry.TELEMETRY_EVENT_TRACE_DETAIL_API, data, claims.Email, true, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
var startTime, endTime, durationNano uint64
|
|
||||||
var searchScanResponses []model.SearchSpanDBResponseItem
|
|
||||||
|
|
||||||
query := fmt.Sprintf("SELECT timestamp, traceID, model FROM %s.%s WHERE traceID=$1", r.TraceDB, r.SpansTable)
|
|
||||||
|
|
||||||
start := time.Now()
|
|
||||||
|
|
||||||
err = r.db.Select(ctx, &searchScanResponses, query, params.TraceID)
|
|
||||||
|
|
||||||
zap.L().Info(query)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
zap.L().Error("Error in processing sql query", zap.Error(err))
|
|
||||||
return nil, fmt.Errorf("error in processing sql query")
|
|
||||||
}
|
|
||||||
end := time.Now()
|
|
||||||
zap.L().Debug("getTraceSQLQuery took: ", zap.Duration("duration", end.Sub(start)))
|
|
||||||
searchSpansResult := []model.SearchSpansResult{{
|
|
||||||
Columns: []string{"__time", "SpanId", "TraceId", "ServiceName", "Name", "Kind", "DurationNano", "TagsKeys", "TagsValues", "References", "Events", "HasError", "StatusMessage", "StatusCodeString", "SpanKind"},
|
|
||||||
Events: make([][]interface{}, len(searchScanResponses)),
|
|
||||||
IsSubTree: false,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
searchSpanResponses := []model.SearchSpanResponseItem{}
|
|
||||||
start = time.Now()
|
|
||||||
for _, item := range searchScanResponses {
|
|
||||||
var jsonItem model.SearchSpanResponseItem
|
|
||||||
easyjson.Unmarshal([]byte(item.Model), &jsonItem)
|
|
||||||
jsonItem.TimeUnixNano = uint64(item.Timestamp.UnixNano() / 1000000)
|
|
||||||
searchSpanResponses = append(searchSpanResponses, jsonItem)
|
|
||||||
if startTime == 0 || jsonItem.TimeUnixNano < startTime {
|
|
||||||
startTime = jsonItem.TimeUnixNano
|
|
||||||
}
|
|
||||||
if endTime == 0 || jsonItem.TimeUnixNano > endTime {
|
|
||||||
endTime = jsonItem.TimeUnixNano
|
|
||||||
}
|
|
||||||
if durationNano == 0 || uint64(jsonItem.DurationNano) > durationNano {
|
|
||||||
durationNano = uint64(jsonItem.DurationNano)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end = time.Now()
|
|
||||||
zap.L().Debug("getTraceSQLQuery unmarshal took: ", zap.Duration("duration", end.Sub(start)))
|
|
||||||
|
|
||||||
err = r.featureFlags.CheckFeature(model.SmartTraceDetail)
|
|
||||||
smartAlgoEnabled := err == nil
|
|
||||||
if len(searchScanResponses) > params.SpansRenderLimit && smartAlgoEnabled {
|
|
||||||
start = time.Now()
|
|
||||||
searchSpansResult, err = smartTraceAlgorithm(searchSpanResponses, params.SpanID, params.LevelUp, params.LevelDown, params.SpansRenderLimit)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
end = time.Now()
|
|
||||||
zap.L().Debug("smartTraceAlgo took: ", zap.Duration("duration", end.Sub(start)))
|
|
||||||
claims, ok := authtypes.ClaimsFromContext(ctx)
|
|
||||||
if ok {
|
|
||||||
data := map[string]interface{}{
|
|
||||||
"traceSize": len(searchScanResponses),
|
|
||||||
"spansRenderLimit": params.SpansRenderLimit,
|
|
||||||
}
|
|
||||||
telemetry.GetInstance().SendEvent(telemetry.TELEMETRY_EVENT_LARGE_TRACE_OPENED, data, claims.Email, true, false)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for i, item := range searchSpanResponses {
|
|
||||||
spanEvents := item.GetValues()
|
|
||||||
searchSpansResult[0].Events[i] = spanEvents
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
searchSpansResult[0].StartTimestampMillis = startTime - (durationNano / 1000000)
|
|
||||||
searchSpansResult[0].EndTimestampMillis = endTime + (durationNano / 1000000)
|
|
||||||
|
|
||||||
return &searchSpansResult, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *ClickHouseReader) GetSpansForTrace(ctx context.Context, traceID string, traceDetailsQuery string) ([]model.SpanItemV2, *model.ApiError) {
|
func (r *ClickHouseReader) GetSpansForTrace(ctx context.Context, traceID string, traceDetailsQuery string) ([]model.SpanItemV2, *model.ApiError) {
|
||||||
var traceSummary model.TraceSummary
|
var traceSummary model.TraceSummary
|
||||||
summaryQuery := fmt.Sprintf("SELECT * from %s.%s WHERE trace_id=$1", r.TraceDB, r.traceSummaryTable)
|
summaryQuery := fmt.Sprintf("SELECT * from %s.%s WHERE trace_id=$1", r.TraceDB, r.traceSummaryTable)
|
||||||
|
@ -551,7 +551,6 @@ func (aH *APIHandler) RegisterRoutes(router *mux.Router, am *AuthMiddleware) {
|
|||||||
router.HandleFunc("/api/v1/services/list", am.ViewAccess(aH.getServicesList)).Methods(http.MethodGet)
|
router.HandleFunc("/api/v1/services/list", am.ViewAccess(aH.getServicesList)).Methods(http.MethodGet)
|
||||||
router.HandleFunc("/api/v1/service/top_operations", am.ViewAccess(aH.getTopOperations)).Methods(http.MethodPost)
|
router.HandleFunc("/api/v1/service/top_operations", am.ViewAccess(aH.getTopOperations)).Methods(http.MethodPost)
|
||||||
router.HandleFunc("/api/v1/service/top_level_operations", am.ViewAccess(aH.getServicesTopLevelOps)).Methods(http.MethodPost)
|
router.HandleFunc("/api/v1/service/top_level_operations", am.ViewAccess(aH.getServicesTopLevelOps)).Methods(http.MethodPost)
|
||||||
router.HandleFunc("/api/v1/traces/{traceId}", am.ViewAccess(aH.SearchTraces)).Methods(http.MethodGet)
|
|
||||||
router.HandleFunc("/api/v1/usage", am.ViewAccess(aH.getUsage)).Methods(http.MethodGet)
|
router.HandleFunc("/api/v1/usage", am.ViewAccess(aH.getUsage)).Methods(http.MethodGet)
|
||||||
router.HandleFunc("/api/v1/dependency_graph", am.ViewAccess(aH.dependencyGraph)).Methods(http.MethodPost)
|
router.HandleFunc("/api/v1/dependency_graph", am.ViewAccess(aH.dependencyGraph)).Methods(http.MethodPost)
|
||||||
router.HandleFunc("/api/v1/settings/ttl", am.AdminAccess(aH.setTTL)).Methods(http.MethodPost)
|
router.HandleFunc("/api/v1/settings/ttl", am.AdminAccess(aH.setTTL)).Methods(http.MethodPost)
|
||||||
@ -1727,23 +1726,6 @@ func (aH *APIHandler) getServicesList(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (aH *APIHandler) SearchTraces(w http.ResponseWriter, r *http.Request) {
|
|
||||||
|
|
||||||
params, err := ParseSearchTracesParams(r)
|
|
||||||
if err != nil {
|
|
||||||
RespondError(w, &model.ApiError{Typ: model.ErrorBadData, Err: err}, "Error reading params")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err := aH.reader.SearchTraces(r.Context(), params, nil)
|
|
||||||
if aH.HandleError(w, err, http.StatusBadRequest) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
aH.WriteJSON(w, r, result)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func (aH *APIHandler) GetWaterfallSpansForTraceWithMetadata(w http.ResponseWriter, r *http.Request) {
|
func (aH *APIHandler) GetWaterfallSpansForTraceWithMetadata(w http.ResponseWriter, r *http.Request) {
|
||||||
traceID := mux.Vars(r)["traceId"]
|
traceID := mux.Vars(r)["traceId"]
|
||||||
if traceID == "" {
|
if traceID == "" {
|
||||||
|
@ -1370,7 +1370,6 @@ func Test_querier_runWindowBasedListQuery(t *testing.T) {
|
|||||||
nil,
|
nil,
|
||||||
telemetryStore,
|
telemetryStore,
|
||||||
prometheustest.New(instrumentationtest.New().Logger(), prometheus.Config{}),
|
prometheustest.New(instrumentationtest.New().Logger(), prometheus.Config{}),
|
||||||
featureManager.StartManager(),
|
|
||||||
"",
|
"",
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
|
@ -1424,7 +1424,6 @@ func Test_querier_runWindowBasedListQuery(t *testing.T) {
|
|||||||
nil,
|
nil,
|
||||||
telemetryStore,
|
telemetryStore,
|
||||||
prometheustest.New(instrumentationtest.New().Logger(), prometheus.Config{}),
|
prometheustest.New(instrumentationtest.New().Logger(), prometheus.Config{}),
|
||||||
featureManager.StartManager(),
|
|
||||||
"",
|
"",
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
|
@ -120,7 +120,6 @@ func NewServer(serverOptions *ServerOptions) (*Server, error) {
|
|||||||
serverOptions.SigNoz.SQLStore,
|
serverOptions.SigNoz.SQLStore,
|
||||||
serverOptions.SigNoz.TelemetryStore,
|
serverOptions.SigNoz.TelemetryStore,
|
||||||
serverOptions.SigNoz.Prometheus,
|
serverOptions.SigNoz.Prometheus,
|
||||||
fm,
|
|
||||||
serverOptions.Cluster,
|
serverOptions.Cluster,
|
||||||
serverOptions.UseLogsNewSchema,
|
serverOptions.UseLogsNewSchema,
|
||||||
serverOptions.UseTraceNewSchema,
|
serverOptions.UseTraceNewSchema,
|
||||||
|
@ -39,7 +39,6 @@ type Reader interface {
|
|||||||
GetNextPrevErrorIDs(ctx context.Context, params *model.GetErrorParams) (*model.NextPrevErrorIDs, *model.ApiError)
|
GetNextPrevErrorIDs(ctx context.Context, params *model.GetErrorParams) (*model.NextPrevErrorIDs, *model.ApiError)
|
||||||
|
|
||||||
// Search Interfaces
|
// Search Interfaces
|
||||||
SearchTraces(ctx context.Context, params *model.SearchTracesParams, smartTraceAlgorithm func(payload []model.SearchSpanResponseItem, targetSpanId string, levelUp int, levelDown int, spanLimit int) ([]model.SearchSpansResult, error)) (*[]model.SearchSpansResult, error)
|
|
||||||
GetWaterfallSpansForTraceWithMetadata(ctx context.Context, traceID string, req *model.GetWaterfallSpansForTraceWithMetadataParams) (*model.GetWaterfallSpansForTraceWithMetadataResponse, *model.ApiError)
|
GetWaterfallSpansForTraceWithMetadata(ctx context.Context, traceID string, req *model.GetWaterfallSpansForTraceWithMetadataParams) (*model.GetWaterfallSpansForTraceWithMetadataResponse, *model.ApiError)
|
||||||
GetFlamegraphSpansForTrace(ctx context.Context, traceID string, req *model.GetFlamegraphSpansForTraceParams) (*model.GetFlamegraphSpansForTraceResponse, *model.ApiError)
|
GetFlamegraphSpansForTrace(ctx context.Context, traceID string, req *model.GetFlamegraphSpansForTraceParams) (*model.GetFlamegraphSpansForTraceResponse, *model.ApiError)
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@ type Feature struct {
|
|||||||
Route string `db:"route" json:"route"`
|
Route string `db:"route" json:"route"`
|
||||||
}
|
}
|
||||||
|
|
||||||
const SmartTraceDetail = "SMART_TRACE_DETAIL"
|
|
||||||
const CustomMetricsFunction = "CUSTOM_METRICS_FUNCTION"
|
const CustomMetricsFunction = "CUSTOM_METRICS_FUNCTION"
|
||||||
const DisableUpsell = "DISABLE_UPSELL"
|
const DisableUpsell = "DISABLE_UPSELL"
|
||||||
const OSS = "OSS"
|
const OSS = "OSS"
|
||||||
@ -41,13 +40,6 @@ var BasicPlan = FeatureSet{
|
|||||||
UsageLimit: -1,
|
UsageLimit: -1,
|
||||||
Route: "",
|
Route: "",
|
||||||
},
|
},
|
||||||
Feature{
|
|
||||||
Name: SmartTraceDetail,
|
|
||||||
Active: false,
|
|
||||||
Usage: 0,
|
|
||||||
UsageLimit: -1,
|
|
||||||
Route: "",
|
|
||||||
},
|
|
||||||
Feature{
|
Feature{
|
||||||
Name: CustomMetricsFunction,
|
Name: CustomMetricsFunction,
|
||||||
Active: false,
|
Active: false,
|
||||||
|
@ -1251,7 +1251,7 @@ 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{}), fm, "", true, true, time.Duration(time.Second), readerCache)
|
reader := clickhouseReader.NewReaderFromClickhouseConnection(options, nil, telemetryStore, prometheustest.New(instrumentationtest.New().Logger(), prometheus.Config{}), "", true, true, time.Duration(time.Second), readerCache)
|
||||||
rule, err := NewThresholdRule("69", &postableRule, fm, reader, true, true)
|
rule, err := NewThresholdRule("69", &postableRule, fm, reader, true, true)
|
||||||
rule.TemporalityMap = map[string]map[v3.Temporality]bool{
|
rule.TemporalityMap = map[string]map[v3.Temporality]bool{
|
||||||
"signoz_calls_total": {
|
"signoz_calls_total": {
|
||||||
@ -1348,7 +1348,7 @@ 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{}), fm, "", true, true, time.Duration(time.Second), readerCache)
|
reader := clickhouseReader.NewReaderFromClickhouseConnection(options, nil, telemetryStore, prometheustest.New(instrumentationtest.New().Logger(), prometheus.Config{}), "", true, true, time.Duration(time.Second), readerCache)
|
||||||
|
|
||||||
rule, err := NewThresholdRule("69", &postableRule, fm, reader, true, true)
|
rule, err := NewThresholdRule("69", &postableRule, fm, reader, true, true)
|
||||||
rule.TemporalityMap = map[string]map[v3.Temporality]bool{
|
rule.TemporalityMap = map[string]map[v3.Temporality]bool{
|
||||||
@ -1453,7 +1453,7 @@ 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{}), fm, "", true, true, time.Duration(time.Second), nil)
|
reader := clickhouseReader.NewReaderFromClickhouseConnection(options, nil, telemetryStore, prometheustest.New(instrumentationtest.New().Logger(), prometheus.Config{}), "", true, true, time.Duration(time.Second), nil)
|
||||||
|
|
||||||
rule, err := NewThresholdRule("69", &postableRule, fm, reader, true, true)
|
rule, err := NewThresholdRule("69", &postableRule, fm, reader, true, true)
|
||||||
rule.TemporalityMap = map[string]map[v3.Temporality]bool{
|
rule.TemporalityMap = map[string]map[v3.Temporality]bool{
|
||||||
@ -1575,7 +1575,7 @@ 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{}), fm, "", true, true, time.Duration(time.Second), nil)
|
reader := clickhouseReader.NewReaderFromClickhouseConnection(options, nil, telemetryStore, prometheustest.New(instrumentationtest.New().Logger(), prometheus.Config{}), "", true, true, time.Duration(time.Second), nil)
|
||||||
|
|
||||||
rule, err := NewThresholdRule("69", &postableRule, fm, reader, true, true)
|
rule, err := NewThresholdRule("69", &postableRule, fm, reader, true, true)
|
||||||
rule.TemporalityMap = map[string]map[v3.Temporality]bool{
|
rule.TemporalityMap = map[string]map[v3.Temporality]bool{
|
||||||
|
@ -293,7 +293,7 @@ func NewFilterSuggestionsTestBed(t *testing.T) *FilterSuggestionsTestBed {
|
|||||||
testDB := utils.NewQueryServiceDBForTests(t)
|
testDB := utils.NewQueryServiceDBForTests(t)
|
||||||
|
|
||||||
fm := featureManager.StartManager()
|
fm := featureManager.StartManager()
|
||||||
reader, mockClickhouse := NewMockClickhouseReader(t, testDB, fm)
|
reader, mockClickhouse := NewMockClickhouseReader(t, testDB)
|
||||||
mockClickhouse.MatchExpectationsInOrder(false)
|
mockClickhouse.MatchExpectationsInOrder(false)
|
||||||
|
|
||||||
apiHandler, err := app.NewAPIHandler(app.APIHandlerOpts{
|
apiHandler, err := app.NewAPIHandler(app.APIHandlerOpts{
|
||||||
|
@ -355,7 +355,7 @@ func NewCloudIntegrationsTestBed(t *testing.T, testDB sqlstore.SQLStore) *CloudI
|
|||||||
}
|
}
|
||||||
|
|
||||||
fm := featureManager.StartManager()
|
fm := featureManager.StartManager()
|
||||||
reader, mockClickhouse := NewMockClickhouseReader(t, testDB, fm)
|
reader, mockClickhouse := NewMockClickhouseReader(t, testDB)
|
||||||
mockClickhouse.MatchExpectationsInOrder(false)
|
mockClickhouse.MatchExpectationsInOrder(false)
|
||||||
|
|
||||||
apiHandler, err := app.NewAPIHandler(app.APIHandlerOpts{
|
apiHandler, err := app.NewAPIHandler(app.APIHandlerOpts{
|
||||||
|
@ -557,7 +557,7 @@ func NewIntegrationsTestBed(t *testing.T, testDB sqlstore.SQLStore) *Integration
|
|||||||
}
|
}
|
||||||
|
|
||||||
fm := featureManager.StartManager()
|
fm := featureManager.StartManager()
|
||||||
reader, mockClickhouse := NewMockClickhouseReader(t, testDB, fm)
|
reader, mockClickhouse := NewMockClickhouseReader(t, testDB)
|
||||||
mockClickhouse.MatchExpectationsInOrder(false)
|
mockClickhouse.MatchExpectationsInOrder(false)
|
||||||
|
|
||||||
cloudIntegrationsController, err := cloudintegrations.NewController(testDB)
|
cloudIntegrationsController, err := cloudintegrations.NewController(testDB)
|
||||||
|
@ -21,7 +21,6 @@ import (
|
|||||||
"github.com/SigNoz/signoz/pkg/query-service/auth"
|
"github.com/SigNoz/signoz/pkg/query-service/auth"
|
||||||
"github.com/SigNoz/signoz/pkg/query-service/constants"
|
"github.com/SigNoz/signoz/pkg/query-service/constants"
|
||||||
"github.com/SigNoz/signoz/pkg/query-service/dao"
|
"github.com/SigNoz/signoz/pkg/query-service/dao"
|
||||||
"github.com/SigNoz/signoz/pkg/query-service/interfaces"
|
|
||||||
"github.com/SigNoz/signoz/pkg/query-service/model"
|
"github.com/SigNoz/signoz/pkg/query-service/model"
|
||||||
"github.com/SigNoz/signoz/pkg/sqlstore"
|
"github.com/SigNoz/signoz/pkg/sqlstore"
|
||||||
"github.com/SigNoz/signoz/pkg/telemetrystore"
|
"github.com/SigNoz/signoz/pkg/telemetrystore"
|
||||||
@ -37,11 +36,7 @@ import (
|
|||||||
|
|
||||||
var jwt = authtypes.NewJWT("secret", 1*time.Hour, 2*time.Hour)
|
var jwt = authtypes.NewJWT("secret", 1*time.Hour, 2*time.Hour)
|
||||||
|
|
||||||
func NewMockClickhouseReader(
|
func NewMockClickhouseReader(t *testing.T, testDB sqlstore.SQLStore) (*clickhouseReader.ClickHouseReader, mockhouse.ClickConnMockCommon) {
|
||||||
t *testing.T, testDB sqlstore.SQLStore, featureFlags interfaces.FeatureLookup,
|
|
||||||
) (
|
|
||||||
*clickhouseReader.ClickHouseReader, mockhouse.ClickConnMockCommon,
|
|
||||||
) {
|
|
||||||
require.NotNil(t, testDB)
|
require.NotNil(t, testDB)
|
||||||
|
|
||||||
telemetryStore := telemetrystoretest.New(telemetrystore.Config{Provider: "clickhouse"}, sqlmock.QueryMatcherRegexp)
|
telemetryStore := telemetrystoretest.New(telemetrystore.Config{Provider: "clickhouse"}, sqlmock.QueryMatcherRegexp)
|
||||||
@ -50,7 +45,6 @@ func NewMockClickhouseReader(
|
|||||||
testDB,
|
testDB,
|
||||||
telemetryStore,
|
telemetryStore,
|
||||||
prometheustest.New(instrumentationtest.New().Logger(), prometheus.Config{}),
|
prometheustest.New(instrumentationtest.New().Logger(), prometheus.Config{}),
|
||||||
featureFlags,
|
|
||||||
"",
|
"",
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user