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.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
chore: changed ttl get response to number of hours in int (#351)
Ankit Nayanf3fb325a1350
diff --git a/pkg/query-service/app/clickhouseReader/reader.go b/pkg/query-service/app/clickhouseReader/reader.goindex 255294d7a6..cd1ddf8c74 100644--- a/pkg/query-service/app/clickhouseReader/reader.go+++ b/pkg/query-service/app/clickhouseReader/reader.go@@ -856,7 +856,7 @@ func (r *ClickHouseReader) SetTTL(ctx context.Context, ttlParams *model.TTLParamfunc (r *ClickHouseReader) GetTTL(ctx context.Context, ttlParams *model.GetTTLParams) (*model.GetTTLResponseItem, *model.ApiError) {- parseTTL := func(queryResp string) string {+ parseTTL := func(queryResp string) int {values := strings.Split(queryResp, " ")N := len(values)ttlIdx := -1@@ -868,12 +868,17 @@ func (r *ClickHouseReader) GetTTL(ctx context.Context, ttlParams *model.GetTTLPa}}if ttlIdx == -1 {- return ""+ return ttlIdx}output := strings.SplitN(values[ttlIdx], "(", 2)timePart := strings.Trim(output[1], ")")- return timePart+ seconds_int, err := strconv.Atoi(timePart)+ if err != nil {+ return -1+ }+ ttl_hrs := seconds_int / 3600+ return ttl_hrs}getMetricsTTL := func() (*model.DBResponseTTL, *model.ApiError) {diff --git a/pkg/query-service/go.sum b/pkg/query-service/go.sumindex b9c1276882..48d976f3c5 100644--- a/pkg/query-service/go.sum+++ b/pkg/query-service/go.sum@@ -53,6 +53,8 @@ github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSEgithub.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=github.com/SigNoz/prometheus v1.9.4 h1:HqMPTM/QXgsjzuG5whSS+9l0mVePuya/uZmrAt2H9HQ=github.com/SigNoz/prometheus v1.9.4/go.mod h1:39/E+7N2hh5Q6NunhoRz9EHCRAyRGj63YK1hE4SiHdk=+github.com/SigNoz/prometheus v1.9.5 h1:ITuK/71BFY3Hxv50/Upsvo6KJUdOxT7o6lCXmVxyLF0=+github.com/SigNoz/prometheus v1.9.5/go.mod h1:BHEawFYBYkVr9BjPXsz9Ye6QVVQ+2a99m6r/S8hO/lA=github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=diff --git a/pkg/query-service/model/response.go b/pkg/query-service/model/response.goindex f35cfb306c..113e5ec5ea 100644--- a/pkg/query-service/model/response.go+++ b/pkg/query-service/model/response.go@@ -205,6 +205,6 @@ type DBResponseTTL struct {}type GetTTLResponseItem struct {- MetricsTime string `json:"metrics_ttl_duration"`- TracesTime string `json:"traces_ttl_duration"`+ MetricsTime int `json:"metrics_ttl_duration_hrs"`+ TracesTime int `json:"traces_ttl_duration_hrs"`}