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.

returning spans which are atleast 30s stale

Ankit Nayan3b3ca642964c
diff --git a/pkg/query-service/app/parser.go b/pkg/query-service/app/parser.go
index a6be154c0a..1bc9d1f38d 100644
--- a/pkg/query-service/app/parser.go
+++ b/pkg/query-service/app/parser.go
@@ -267,7 +267,7 @@ func parseSpanSearchRequest(r *http.Request) (*model.SpanSearchParams, error) {
if err != nil {
return nil, err
}
- endTime, err := parseTime("end", r)
+ endTime, err := parseTimeMinusBuffer("end", r)
if err != nil {
return nil, err
}
@@ -409,6 +409,26 @@ func parseTime(param string, r *http.Request) (*time.Time, error) {
}
+func parseTimeMinusBuffer(param string, r *http.Request) (*time.Time, error) {
+
+ timeStr := r.URL.Query().Get(param)
+ if len(timeStr) == 0 {
+ return nil, fmt.Errorf("%s param missing in query", param)
+ }
+
+ timeUnix, err := strconv.ParseInt(timeStr, 10, 64)
+ if err != nil || len(timeStr) == 0 {
+ return nil, fmt.Errorf("%s param is not in correct timestamp format", param)
+ }
+
+ timeUnix = timeUnix - 30000000000
+
+ timeFmt := time.Unix(0, timeUnix)
+
+ return &timeFmt, nil
+
+}
+
func parseTimestamp(param string, r *http.Request) (*string, error) {
timeStr := r.URL.Query().Get(param)
if len(timeStr) == 0 {