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.

Fix case mismatch in static fields. (#1537)

Nityananda Gohainea8bd7047f09
diff --git a/frontend/src/components/Logs/LogItem/index.tsx b/frontend/src/components/Logs/LogItem/index.tsx
index a9badd8fc9..fb00fb1e88 100644
--- a/frontend/src/components/Logs/LogItem/index.tsx
+++ b/frontend/src/components/Logs/LogItem/index.tsx
@@ -15,6 +15,7 @@ import { ILogsReducer } from 'types/reducer/logs';
import AddToQueryHOC from '../AddToQueryHOC';
import CopyClipboardHOC from '../CopyClipboardHOC';
import { Container } from './styles';
+import { isValidLogField } from './util';
interface LogFieldProps {
fieldKey: string;
@@ -118,7 +119,7 @@ function LogItem({ logData }: LogItemProps): JSX.Element {
</div>
<div>
{map(selected, (field) => {
- return flattenLogData[field.name] ? (
+ return isValidLogField(flattenLogData[field.name] as never) ? (
<LogSelectedField
key={field.name}
fieldKey={field.name}
diff --git a/frontend/src/components/Logs/LogItem/util.ts b/frontend/src/components/Logs/LogItem/util.ts
new file mode 100644
index 0000000000..c88fbc2db3
--- /dev/null
+++ b/frontend/src/components/Logs/LogItem/util.ts
@@ -0,0 +1 @@
+export const isValidLogField = (value: never): boolean => value !== undefined;
diff --git a/pkg/query-service/app/logs/parser.go b/pkg/query-service/app/logs/parser.go
index 53b168b17f..bf2ccd6418 100644
--- a/pkg/query-service/app/logs/parser.go
+++ b/pkg/query-service/app/logs/parser.go
@@ -7,6 +7,7 @@ import (
"strconv"
"strings"
+ "go.signoz.io/query-service/constants"
"go.signoz.io/query-service/model"
)
@@ -239,8 +240,10 @@ func replaceInterestingFields(allFields *model.GetFieldsResponse, queryTokens []
sqlColName := *col
if _, ok := selectedFieldsLookup[*col]; !ok && *col != "body" {
if field, ok := interestingFieldLookup[*col]; ok {
- sqlColName = fmt.Sprintf("%s_%s_value[indexOf(%s_%s_key, '%s')]", field.Type, strings.ToLower(field.DataType), field.Type, strings.ToLower(field.DataType), *col)
- } else if strings.Compare(strings.ToLower(*col), "fulltext") != 0 {
+ if field.Type != constants.Static {
+ sqlColName = fmt.Sprintf("%s_%s_value[indexOf(%s_%s_key, '%s')]", field.Type, strings.ToLower(field.DataType), field.Type, strings.ToLower(field.DataType), *col)
+ }
+ } else if strings.Compare(strings.ToLower(*col), "fulltext") != 0 && field.Type != constants.Static {
return nil, fmt.Errorf("field not found for filtering")
}
}
diff --git a/pkg/query-service/model/response.go b/pkg/query-service/model/response.go
index 54cdaf12c6..bc07bea356 100644
--- a/pkg/query-service/model/response.go
+++ b/pkg/query-service/model/response.go
@@ -430,16 +430,16 @@ type GetFieldsResponse struct {
type GetLogsResponse struct {
Timestamp uint64 `json:"timestamp" ch:"timestamp"`
ID string `json:"id" ch:"id"`
- TraceID string `json:"traceId" ch:"trace_id"`
- SpanID string `json:"spanId" ch:"span_id"`
- TraceFlags uint32 `json:"traceFlags" ch:"trace_flags"`
- SeverityText string `json:"severityText" ch:"severity_text"`
- SeverityNumber uint8 `json:"severityNumber" ch:"severity_number"`
+ TraceID string `json:"trace_id" ch:"trace_id"`
+ SpanID string `json:"span_id" ch:"span_id"`
+ TraceFlags uint32 `json:"trace_flags" ch:"trace_flags"`
+ SeverityText string `json:"severity_text" ch:"severity_text"`
+ SeverityNumber uint8 `json:"severity_number" ch:"severity_number"`
Body string `json:"body" ch:"body"`
- Resources_string map[string]string `json:"resourcesString" ch:"resources_string"`
- Attributes_string map[string]string `json:"attributesString" ch:"attributes_string"`
- Attributes_int64 map[string]int64 `json:"attributesInt" ch:"attributes_int64"`
- Attributes_float64 map[string]float64 `json:"attributesFloat" ch:"attributes_float64"`
+ Resources_string map[string]string `json:"resources_string" ch:"resources_string"`
+ Attributes_string map[string]string `json:"attributes_string" ch:"attributes_string"`
+ Attributes_int64 map[string]int64 `json:"attributes_int" ch:"attributes_int64"`
+ Attributes_float64 map[string]float64 `json:"attributes_float" ch:"attributes_float64"`
}
type LogsTailClient struct {