Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

chore: update default feature flag and error response for formula (#6184)

Srikanth Chekuribf4c792cdbdd
diff --git a/ee/query-service/app/api/queryrange.go b/ee/query-service/app/api/queryrange.go
index f5ad490ed5..6047eeeb10 100644
--- a/ee/query-service/app/api/queryrange.go
+++ b/ee/query-service/app/api/queryrange.go
@@ -53,7 +53,11 @@ func (aH *APIHandler) queryRangeV4(w http.ResponseWriter, r *http.Request) {
if anomalyQueryExists {
// ensure all queries have metric data source, and there should be only one anomaly query
for _, query := range queryRangeParams.CompositeQuery.BuilderQueries {
- if query.DataSource != v3.DataSourceMetrics {
+ // What is query.QueryName == query.Expression doing here?
+ // In the current implementation, the way to recognize if a query is a formula is by
+ // checking if the expression is the same as the query name. if the expression is different
+ // then it is a formula. otherwise, it is simple builder query.
+ if query.DataSource != v3.DataSourceMetrics && query.QueryName == query.Expression {
RespondError(w, &model.ApiError{Typ: model.ErrorBadData, Err: fmt.Errorf("all queries must have metric data source")}, nil)
return
}
@@ -100,6 +104,13 @@ func (aH *APIHandler) queryRangeV4(w http.ResponseWriter, r *http.Request) {
anomaly.WithReader[*anomaly.HourlyProvider](aH.opts.DataConnector),
anomaly.WithFeatureLookup[*anomaly.HourlyProvider](aH.opts.FeatureFlags),
)
+ default:
+ provider = anomaly.NewDailyProvider(
+ anomaly.WithCache[*anomaly.DailyProvider](aH.opts.Cache),
+ anomaly.WithKeyGenerator[*anomaly.DailyProvider](queryBuilder.NewKeyGenerator()),
+ anomaly.WithReader[*anomaly.DailyProvider](aH.opts.DataConnector),
+ anomaly.WithFeatureLookup[*anomaly.DailyProvider](aH.opts.FeatureFlags),
+ )
}
anomalies, err := provider.GetAnomalies(r.Context(), &anomaly.GetAnomaliesRequest{Params: queryRangeParams})
if err != nil {
diff --git a/ee/query-service/model/plans.go b/ee/query-service/model/plans.go
index 5b695143b7..e7f02b805e 100644
--- a/ee/query-service/model/plans.go
+++ b/ee/query-service/model/plans.go
@@ -373,7 +373,7 @@ var EnterprisePlan = basemodel.FeatureSet{
},
basemodel.Feature{
Name: basemodel.AnomalyDetection,
- Active: true,
+ Active: false,
Usage: 0,
UsageLimit: -1,
Route: "",