mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-11 18:09:00 +08:00
Fix case mismatch in static fields. (#1537)
* case mismatch fix * fix: undefined handled in flattened data
This commit is contained in:
parent
7081e4ffce
commit
ea8bd7047f
@ -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}
|
||||
|
1
frontend/src/components/Logs/LogItem/util.ts
Normal file
1
frontend/src/components/Logs/LogItem/util.ts
Normal file
@ -0,0 +1 @@
|
||||
export const isValidLogField = (value: never): boolean => value !== undefined;
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user