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
tail function updated to use values instead of pointers
nityanandagohain420d46ab01b0
diff --git a/pkg/query-service/app/clickhouseReader/reader.go b/pkg/query-service/app/clickhouseReader/reader.goindex 4bb74c0ccb..ff20d22cfd 100644--- a/pkg/query-service/app/clickhouseReader/reader.go+++ b/pkg/query-service/app/clickhouseReader/reader.go@@ -2908,15 +2908,14 @@ func (r *ClickHouseReader) TailLogs(ctx context.Context, client *model.LogsTailC"CAST((resources_string_key, resources_string_value), 'Map(String, String)') as resources_string "+"from %s.%s", r.logsDB, r.logsTable)- currentTime := uint64(time.Now().UnixNano() / int64(time.Millisecond))- tsStart := ¤tTime+ tsStart := uint64(time.Now().UnixNano() / int64(time.Millisecond))if client.Filter.TimestampStart != nil {- tsStart = client.Filter.TimestampStart+ tsStart = *client.Filter.TimestampStart}- var idStart *string+ var idStart stringif client.Filter.IdStart != nil {- idStart = client.Filter.IdStart+ idStart = *client.Filter.IdStart}for {@@ -2927,23 +2926,23 @@ func (r *ClickHouseReader) TailLogs(ctx context.Context, client *model.LogsTailCzap.S().Debug("closing go routine : " + client.Name)returndefault:- tmpQuery := fmt.Sprintf("%s where timestamp >='%d'", query, *tsStart)+ tmpQuery := fmt.Sprintf("%s where timestamp >='%d'", query, tsStart)if filterSql != "" {tmpQuery += fmt.Sprintf(" and %s", filterSql)}- if idStart != nil {- tmpQuery += fmt.Sprintf(" and id > '%s'", *idStart)+ if idStart != "" {+ tmpQuery += fmt.Sprintf(" and id > '%s'", idStart)}tmpQuery = fmt.Sprintf("%s order by timestamp asc, id asc limit 1000", tmpQuery)zap.S().Debug(tmpQuery)- response := &[]model.GetLogsResponse{}- err := r.db.Select(ctx, response, tmpQuery)+ response := []model.GetLogsResponse{}+ err := r.db.Select(ctx, &response, tmpQuery)if err != nil {zap.S().Debug(err)client.Error <- errreturn}- len := len(*response)+ len := len(response)for i := 0; i < len; i++ {select {case <-ctx.Done():@@ -2952,16 +2951,15 @@ func (r *ClickHouseReader) TailLogs(ctx context.Context, client *model.LogsTailCzap.S().Debug("closing go routine while sending logs : " + client.Name)returndefault:- client.Logs <- &(*response)[i]+ client.Logs <- &response[i]if i == len-1 {- tsStart = &(*response)[i].Timestamp- idStart = &(*response)[i].ID+ tsStart = response[i].Timestamp+ idStart = response[i].ID}}}if len == 0 {- currentTime := uint64(time.Now().UnixNano() / int64(time.Millisecond))- tsStart = ¤tTime+ tsStart = uint64(time.Now().UnixNano() / int64(time.Millisecond))}time.Sleep(2 * time.Second)}