2021-01-03 18:15:44 +05:30
package constants
import (
2024-11-19 14:38:12 +05:30
"maps"
2021-01-03 18:15:44 +05:30
"os"
2022-01-26 21:40:44 +05:30
"strconv"
2023-08-22 18:38:26 +05:30
"testing"
2023-04-25 12:59:49 +02:00
"time"
2022-07-12 16:38:26 +05:30
2022-10-06 20:13:30 +05:30
"go.signoz.io/signoz/pkg/query-service/model"
2023-04-06 13:32:24 +05:30
v3 "go.signoz.io/signoz/pkg/query-service/model/v3"
2021-01-03 18:15:44 +05:30
)
2022-05-03 15:26:32 +05:30
const (
2022-06-08 12:22:25 +05:30
HTTPHostPort = "0.0.0.0:8080" // Address to serve http (query service)
PrivateHostPort = "0.0.0.0:8085" // Address to server internal services like alert manager
DebugHttpPort = "0.0.0.0:6060" // Address to serve http (pprof)
2023-03-15 15:09:15 +05:30
OpAmpWsEndpoint = "0.0.0.0:4320" // address for opamp websocket
2022-05-03 15:26:32 +05:30
)
2021-01-03 18:15:44 +05:30
2023-10-17 17:50:54 +00:00
type ContextKey string
const ContextUserKey ContextKey = "user"
2022-11-14 14:29:13 +05:30
var ConfigSignozIo = "https://config.signoz.io/api/v1"
2022-01-26 21:40:44 +05:30
var DEFAULT_TELEMETRY_ANONYMOUS = false
2024-09-10 13:54:30 +05:30
func IsOSSTelemetryEnabled ( ) bool {
ossSegmentKey := GetOrDefaultEnv ( "OSS_TELEMETRY_ENABLED" , "true" )
return ossSegmentKey == "true"
}
2024-05-01 17:03:46 +05:30
const MaxAllowedPointsInTimeSeries = 300
2022-01-26 21:40:44 +05:30
func IsTelemetryEnabled ( ) bool {
2023-08-22 18:38:26 +05:30
if testing . Testing ( ) {
return false
}
2022-01-26 21:40:44 +05:30
isTelemetryEnabledStr := os . Getenv ( "TELEMETRY_ENABLED" )
isTelemetryEnabledBool , err := strconv . ParseBool ( isTelemetryEnabledStr )
if err != nil {
return true
}
return isTelemetryEnabledBool
}
2021-10-20 13:18:19 +05:30
const TraceTTL = "traces"
const MetricsTTL = "metrics"
2022-08-04 14:28:10 +05:30
const LogsTTL = "logs"
2021-11-22 16:15:58 +05:30
2022-11-09 08:30:00 +05:30
const DurationSort = "DurationSort"
const TimestampSort = "TimestampSort"
2023-08-18 07:32:05 +05:30
const PreferRPM = "PreferRPM"
2022-11-09 08:30:00 +05:30
2025-01-20 18:04:19 +05:30
const SpanSearchScopeRoot = "isroot"
const SpanSearchScopeEntryPoint = "isentrypoint"
2024-07-17 17:05:15 +05:30
var TELEMETRY_HEART_BEAT_DURATION_MINUTES = GetOrDefaultEnvInt ( "TELEMETRY_HEART_BEAT_DURATION_MINUTES" , 720 )
var TELEMETRY_ACTIVE_USER_DURATION_MINUTES = GetOrDefaultEnvInt ( "TELEMETRY_ACTIVE_USER_DURATION_MINUTES" , 360 )
2023-12-21 18:27:30 +05:30
var InviteEmailTemplate = GetOrDefaultEnv ( "INVITE_EMAIL_TEMPLATE" , "/root/templates/invitation_email_template.html" )
2024-03-27 00:07:29 +05:30
var OTLPTarget = GetOrDefaultEnv ( "OTEL_EXPORTER_OTLP_ENDPOINT" , "" )
var LogExportBatchSize = GetOrDefaultEnv ( "OTEL_BLRP_MAX_EXPORT_BATCH_SIZE" , "512" )
2023-06-21 11:47:30 +05:30
2025-01-22 12:49:38 +05:30
// [Deprecated] SIGNOZ_LOCAL_DB_PATH is deprecated and scheduled for removal. Please use SIGNOZ_SQLSTORE_SQLITE_PATH instead.
2022-03-28 21:01:57 +05:30
var RELATIONAL_DATASOURCE_PATH = GetOrDefaultEnv ( "SIGNOZ_LOCAL_DB_PATH" , "/var/lib/signoz/signoz.db" )
2022-01-28 22:56:54 +05:30
2022-11-09 08:30:00 +05:30
var DurationSortFeature = GetOrDefaultEnv ( "DURATION_SORT_FEATURE" , "true" )
var TimestampSortFeature = GetOrDefaultEnv ( "TIMESTAMP_SORT_FEATURE" , "true" )
2023-08-18 07:32:05 +05:30
var PreferRPMFeature = GetOrDefaultEnv ( "PREFER_RPM_FEATURE" , "false" )
2025-02-20 13:49:44 +05:30
var MetricsExplorerClickhouseThreads = GetOrDefaultEnvInt ( "METRICS_EXPLORER_CLICKHOUSE_THREADS" , 8 )
2024-10-21 14:22:32 +05:30
// TODO(srikanthccv): remove after backfilling is done
func UseMetricsPreAggregation ( ) bool {
return GetOrDefaultEnv ( "USE_METRICS_PRE_AGGREGATION" , "true" ) == "true"
}
2024-11-02 01:23:43 +05:30
func EnableHostsInfraMonitoring ( ) bool {
return GetOrDefaultEnv ( "ENABLE_INFRA_METRICS" , "true" ) == "true"
}
2024-12-18 19:06:22 +05:30
var KafkaSpanEval = GetOrDefaultEnv ( "KAFKA_SPAN_EVAL" , "false" )
2024-10-18 01:15:54 +05:30
2022-11-09 08:30:00 +05:30
func IsDurationSortFeatureEnabled ( ) bool {
isDurationSortFeatureEnabledStr := DurationSortFeature
isDurationSortFeatureEnabledBool , err := strconv . ParseBool ( isDurationSortFeatureEnabledStr )
if err != nil {
return false
}
return isDurationSortFeatureEnabledBool
}
func IsTimestampSortFeatureEnabled ( ) bool {
isTimestampSortFeatureEnabledStr := TimestampSortFeature
isTimestampSortFeatureEnabledBool , err := strconv . ParseBool ( isTimestampSortFeatureEnabledStr )
if err != nil {
return false
}
return isTimestampSortFeatureEnabledBool
}
2023-08-18 07:32:05 +05:30
func IsPreferRPMFeatureEnabled ( ) bool {
preferRPMFeatureEnabledStr := PreferRPMFeature
preferRPMFeatureEnabledBool , err := strconv . ParseBool ( preferRPMFeatureEnabledStr )
if err != nil {
return false
}
return preferRPMFeatureEnabledBool
}
2022-11-09 08:30:00 +05:30
var DEFAULT_FEATURE_SET = model . FeatureSet {
2023-05-17 16:10:43 +05:30
model . Feature {
Name : DurationSort ,
Active : IsDurationSortFeatureEnabled ( ) ,
Usage : 0 ,
UsageLimit : - 1 ,
Route : "" ,
} , model . Feature {
Name : TimestampSort ,
Active : IsTimestampSortFeatureEnabled ( ) ,
Usage : 0 ,
UsageLimit : - 1 ,
Route : "" ,
} ,
2023-07-14 11:31:44 +05:30
model . Feature {
Name : model . UseSpanMetrics ,
Active : false ,
Usage : 0 ,
UsageLimit : - 1 ,
Route : "" ,
} ,
2023-08-18 07:32:05 +05:30
model . Feature {
Name : PreferRPM ,
Active : IsPreferRPMFeatureEnabled ( ) ,
Usage : 0 ,
UsageLimit : - 1 ,
Route : "" ,
} ,
2022-11-09 08:30:00 +05:30
}
2024-08-08 17:34:25 +05:30
func GetEvalDelay ( ) time . Duration {
evalDelayStr := GetOrDefaultEnv ( "RULES_EVAL_DELAY" , "2m" )
evalDelayDuration , err := time . ParseDuration ( evalDelayStr )
if err != nil {
return 0
}
return evalDelayDuration
}
2022-01-28 22:56:54 +05:30
const (
2022-09-12 19:35:31 +05:30
TraceID = "traceID"
2022-07-12 16:38:26 +05:30
ServiceName = "serviceName"
HttpRoute = "httpRoute"
HttpHost = "httpHost"
HttpUrl = "httpUrl"
HttpMethod = "httpMethod"
OperationDB = "name"
OperationRequest = "operation"
Status = "status"
Duration = "duration"
DBName = "dbName"
DBOperation = "dbOperation"
DBSystem = "dbSystem"
MsgSystem = "msgSystem"
MsgOperation = "msgOperation"
Timestamp = "timestamp"
2022-07-18 16:49:04 +05:30
RPCMethod = "rpcMethod"
ResponseStatusCode = "responseStatusCode"
2022-07-12 16:38:26 +05:30
Descending = "descending"
Ascending = "ascending"
StatusPending = "pending"
StatusFailed = "failed"
StatusSuccess = "success"
2022-07-18 16:49:04 +05:30
ExceptionType = "exceptionType"
ExceptionCount = "exceptionCount"
LastSeen = "lastSeen"
FirstSeen = "firstSeen"
2022-07-12 16:38:26 +05:30
Attributes = "attributes"
Resources = "resources"
Static = "static"
DefaultLogSkipIndexType = "bloom_filter(0.01)"
DefaultLogSkipIndexGranularity = 64
2022-01-28 22:56:54 +05:30
)
2023-01-25 12:35:44 +05:30
var GroupByColMap = map [ string ] struct { } {
ServiceName : { } ,
HttpHost : { } ,
HttpRoute : { } ,
HttpUrl : { } ,
HttpMethod : { } ,
OperationDB : { } ,
DBName : { } ,
DBOperation : { } ,
DBSystem : { } ,
MsgOperation : { } ,
MsgSystem : { } ,
RPCMethod : { } ,
ResponseStatusCode : { } ,
}
2022-06-24 14:52:11 +05:30
const (
2024-10-21 14:22:32 +05:30
SIGNOZ_METRIC_DBNAME = "signoz_metrics"
SIGNOZ_SAMPLES_V4_TABLENAME = "distributed_samples_v4"
SIGNOZ_SAMPLES_V4_AGG_5M_TABLENAME = "distributed_samples_v4_agg_5m"
SIGNOZ_SAMPLES_V4_AGG_30M_TABLENAME = "distributed_samples_v4_agg_30m"
SIGNOZ_EXP_HISTOGRAM_TABLENAME = "distributed_exp_hist"
SIGNOZ_TRACE_DBNAME = "signoz_traces"
SIGNOZ_SPAN_INDEX_TABLENAME = "distributed_signoz_index_v2"
2024-11-13 20:30:01 +05:30
SIGNOZ_SPAN_INDEX_V3 = "distributed_signoz_index_v3"
2024-11-19 14:38:12 +05:30
SIGNOZ_SPAN_INDEX_LOCAL_TABLENAME = "signoz_index_v2"
2024-11-13 20:30:01 +05:30
SIGNOZ_SPAN_INDEX_V3_LOCAL_TABLENAME = "signoz_index_v3"
2024-10-21 14:22:32 +05:30
SIGNOZ_TIMESERIES_v4_LOCAL_TABLENAME = "time_series_v4"
2024-11-25 23:23:42 +05:30
SIGNOZ_TIMESERIES_V4_TABLENAME = "distributed_time_series_v4"
2024-10-21 14:22:32 +05:30
SIGNOZ_TIMESERIES_v4_6HRS_LOCAL_TABLENAME = "time_series_v4_6hrs"
SIGNOZ_TIMESERIES_v4_1DAY_LOCAL_TABLENAME = "time_series_v4_1day"
SIGNOZ_TIMESERIES_v4_1WEEK_LOCAL_TABLENAME = "time_series_v4_1week"
SIGNOZ_TIMESERIES_v4_1DAY_TABLENAME = "distributed_time_series_v4_1day"
2025-01-20 18:04:19 +05:30
SIGNOZ_TOP_LEVEL_OPERATIONS_TABLENAME = "distributed_top_level_operations"
2025-02-20 13:49:44 +05:30
SIGNOZ_TIMESERIES_v4_TABLENAME = "distributed_time_series_v4"
SIGNOZ_TIMESERIES_v4_1WEEK_TABLENAME = "distributed_time_series_v4_1week"
SIGNOZ_TIMESERIES_v4_6HRS_TABLENAME = "distributed_time_series_v4_6hrs"
2025-03-13 14:57:27 +05:30
SIGNOZ_ATTRIBUTES_METADATA_TABLENAME = "distributed_attributes_metadata"
SIGNOZ_ATTRIBUTES_METADATA_LOCAL_TABLENAME = "attributes_metadata"
2022-06-24 14:52:11 +05:30
)
2022-03-28 21:01:57 +05:30
2022-07-14 11:59:06 +05:30
// alert related constants
const (
// AlertHelpPage is used in case default alert repo url is not set
2024-03-13 17:37:32 +05:30
AlertHelpPage = "https://signoz.io/docs/userguide/alerts-management/#generator-url"
AlertTimeFormat = "2006-01-02 15:04:05"
2022-07-14 11:59:06 +05:30
)
2022-03-28 21:01:57 +05:30
func GetOrDefaultEnv ( key string , fallback string ) string {
v := os . Getenv ( key )
if len ( v ) == 0 {
return fallback
}
return v
2022-03-28 21:44:40 +05:30
}
2022-07-12 16:38:26 +05:30
2024-07-17 17:05:15 +05:30
func GetOrDefaultEnvInt ( key string , fallback int ) int {
v := os . Getenv ( key )
if len ( v ) == 0 {
return fallback
}
intVal , err := strconv . Atoi ( v )
if err != nil {
return fallback
}
return intVal
}
2022-07-22 17:19:55 +05:30
const (
STRING = "String"
UINT32 = "UInt32"
LOWCARDINALITY_STRING = "LowCardinality(String)"
INT32 = "Int32"
2022-08-03 12:23:00 +05:30
UINT8 = "Uint8"
2022-07-22 17:19:55 +05:30
)
2024-12-19 11:52:20 +07:00
var StaticSelectedLogFields = [ ] model . Field {
2022-07-12 16:38:26 +05:30
{
2023-08-23 15:03:24 +05:30
Name : "timestamp" ,
DataType : UINT32 ,
2022-07-12 16:38:26 +05:30
Type : Static ,
} ,
{
2023-08-23 15:03:24 +05:30
Name : "id" ,
2022-07-22 17:19:55 +05:30
DataType : STRING ,
2022-07-12 16:38:26 +05:30
Type : Static ,
} ,
{
Name : "severity_text" ,
2022-07-22 17:19:55 +05:30
DataType : LOWCARDINALITY_STRING ,
2022-07-12 16:38:26 +05:30
Type : Static ,
} ,
{
Name : "severity_number" ,
2022-08-03 12:23:00 +05:30
DataType : UINT8 ,
2022-07-12 16:38:26 +05:30
Type : Static ,
} ,
{
2023-08-23 15:03:24 +05:30
Name : "trace_flags" ,
2022-07-22 17:19:55 +05:30
DataType : UINT32 ,
2022-07-12 16:38:26 +05:30
Type : Static ,
} ,
{
2023-08-23 15:03:24 +05:30
Name : "trace_id" ,
DataType : STRING ,
Type : Static ,
} ,
{
Name : "span_id" ,
2022-07-22 17:19:55 +05:30
DataType : STRING ,
2022-07-12 16:38:26 +05:30
Type : Static ,
} ,
}
2022-07-22 16:07:19 +05:30
const (
LogsSQLSelect = "SELECT " +
2024-11-06 20:47:04 +05:30
"timestamp, id, trace_id, span_id, trace_flags, severity_text, severity_number, scope_name, scope_version, body," +
2022-07-22 16:07:19 +05:30
"CAST((attributes_string_key, attributes_string_value), 'Map(String, String)') as attributes_string," +
"CAST((attributes_int64_key, attributes_int64_value), 'Map(String, Int64)') as attributes_int64," +
"CAST((attributes_float64_key, attributes_float64_value), 'Map(String, Float64)') as attributes_float64," +
2023-10-31 15:06:07 +05:30
"CAST((attributes_bool_key, attributes_bool_value), 'Map(String, Bool)') as attributes_bool," +
2024-11-06 20:47:04 +05:30
"CAST((resources_string_key, resources_string_value), 'Map(String, String)') as resources_string," +
"CAST((scope_string_key, scope_string_value), 'Map(String, String)') as scope "
2024-09-12 09:48:09 +05:30
LogsSQLSelectV2 = "SELECT " +
2024-11-06 20:47:04 +05:30
"timestamp, id, trace_id, span_id, trace_flags, severity_text, severity_number, scope_name, scope_version, body, " +
2024-09-12 09:48:09 +05:30
"attributes_string, " +
"attributes_number, " +
"attributes_bool, " +
2024-11-06 20:47:04 +05:30
"resources_string, " +
"scope_string "
2024-10-10 18:16:11 +05:30
TracesExplorerViewSQLSelectWithSubQuery = "(SELECT traceID, durationNano, " +
2025-02-04 18:36:07 +05:30
"serviceName, name FROM %s.%s WHERE parentSpanID = '' AND %s ORDER BY durationNano DESC LIMIT 1 BY traceID"
2024-10-10 18:16:11 +05:30
TracesExplorerViewSQLSelectBeforeSubQuery = "SELECT subQuery.serviceName, subQuery.name, count() AS " +
"span_count, subQuery.durationNano, subQuery.traceID AS traceID FROM %s.%s INNER JOIN ( SELECT * FROM "
2025-01-27 14:07:47 +05:30
TracesExplorerViewSQLSelectAfterSubQuery = "AS inner_subquery ) AS subQuery ON %s.%s.traceID = subQuery.traceID WHERE %s %s " +
2025-02-04 18:36:07 +05:30
"GROUP BY subQuery.traceID, subQuery.durationNano, subQuery.name, subQuery.serviceName ORDER BY subQuery.durationNano desc LIMIT 1 BY subQuery.traceID "
2023-07-05 06:57:39 +05:30
TracesExplorerViewSQLSelectQuery = "SELECT subQuery.serviceName, subQuery.name, count() AS " +
2023-07-18 12:17:00 +05:30
"span_count, subQuery.durationNano, traceID FROM %s.%s GLOBAL INNER JOIN subQuery ON %s.traceID = subQuery.traceID GROUP " +
2023-07-05 06:57:39 +05:30
"BY traceID, subQuery.durationNano, subQuery.name, subQuery.serviceName ORDER BY subQuery.durationNano desc;"
2022-07-22 16:07:19 +05:30
)
2022-11-27 00:59:09 -08:00
// ReservedColumnTargetAliases identifies result value from a user
// written clickhouse query. The column alias indcate which value is
// to be considered as final result (or target)
2023-03-23 19:45:15 +05:30
var ReservedColumnTargetAliases = map [ string ] struct { } {
2024-06-05 19:33:45 +05:30
"__result" : { } ,
"__value" : { } ,
"result" : { } ,
"res" : { } ,
"value" : { } ,
2023-03-23 19:45:15 +05:30
}
2023-01-25 12:35:44 +05:30
2023-03-15 17:42:24 +05:30
// logsPPLPfx is a short constant for logsPipelinePrefix
2024-10-14 11:11:51 +05:30
// TODO(Raj): Remove old prefix after new processor based pipelines have been rolled out
const LogsPPLPfx = "signozlogspipeline/pipeline_"
const OldLogsPPLPfx = "logstransform/pipeline_"
2023-04-06 13:32:24 +05:30
2024-03-11 14:15:11 +05:30
const IntegrationPipelineIdPrefix = "integration"
2023-04-06 13:32:24 +05:30
// The datatype present here doesn't represent the actual datatype of column in the logs table.
2023-05-25 09:58:32 +05:30
var StaticFieldsLogsV3 = map [ string ] v3 . AttributeKey {
"timestamp" : { } ,
"id" : { } ,
"trace_id" : {
2023-04-06 13:32:24 +05:30
Key : "trace_id" ,
DataType : v3 . AttributeKeyDataTypeString ,
2023-05-25 09:58:32 +05:30
Type : v3 . AttributeKeyTypeUnspecified ,
IsColumn : true ,
2023-04-06 13:32:24 +05:30
} ,
2023-05-25 09:58:32 +05:30
"span_id" : {
2023-04-06 13:32:24 +05:30
Key : "span_id" ,
DataType : v3 . AttributeKeyDataTypeString ,
2023-05-25 09:58:32 +05:30
Type : v3 . AttributeKeyTypeUnspecified ,
IsColumn : true ,
2023-04-06 13:32:24 +05:30
} ,
2023-05-25 09:58:32 +05:30
"trace_flags" : {
2023-04-06 13:32:24 +05:30
Key : "trace_flags" ,
DataType : v3 . AttributeKeyDataTypeInt64 ,
2023-05-25 09:58:32 +05:30
Type : v3 . AttributeKeyTypeUnspecified ,
IsColumn : true ,
2023-04-06 13:32:24 +05:30
} ,
2023-05-25 09:58:32 +05:30
"severity_text" : {
2023-04-06 13:32:24 +05:30
Key : "severity_text" ,
DataType : v3 . AttributeKeyDataTypeString ,
2023-05-25 09:58:32 +05:30
Type : v3 . AttributeKeyTypeUnspecified ,
IsColumn : true ,
2023-04-06 13:32:24 +05:30
} ,
2023-05-25 09:58:32 +05:30
"severity_number" : {
2023-04-06 13:32:24 +05:30
Key : "severity_number" ,
DataType : v3 . AttributeKeyDataTypeInt64 ,
2023-05-25 09:58:32 +05:30
Type : v3 . AttributeKeyTypeUnspecified ,
IsColumn : true ,
2023-04-06 13:32:24 +05:30
} ,
2023-05-25 09:58:32 +05:30
"body" : {
2023-04-06 13:32:24 +05:30
Key : "body" ,
DataType : v3 . AttributeKeyDataTypeString ,
2023-05-25 09:58:32 +05:30
Type : v3 . AttributeKeyTypeUnspecified ,
IsColumn : true ,
2023-04-06 13:32:24 +05:30
} ,
2024-09-12 09:48:09 +05:30
"__attrs" : {
Key : "__attrs" ,
DataType : v3 . AttributeKeyDataTypeString ,
Type : v3 . AttributeKeyTypeUnspecified ,
IsColumn : true ,
} ,
2024-11-06 20:47:04 +05:30
"scope_name" : {
Key : "scope_name" ,
DataType : v3 . AttributeKeyDataTypeString ,
Type : v3 . AttributeKeyTypeUnspecified ,
IsColumn : true ,
} ,
"scope_version" : {
Key : "scope_version" ,
DataType : v3 . AttributeKeyDataTypeString ,
Type : v3 . AttributeKeyTypeUnspecified ,
IsColumn : true ,
} ,
2023-04-06 13:32:24 +05:30
}
2023-04-10 19:36:13 +05:30
const SigNozOrderByValue = "#SIGNOZ_VALUE"
2023-06-09 17:07:45 +05:30
const TIMESTAMP = "timestamp"
2023-07-16 23:07:45 +05:30
const FirstQueryGraphLimit = "first_query_graph_limit"
const SecondQueryGraphLimit = "second_query_graph_limit"
2024-02-02 21:16:14 +05:30
2024-09-09 10:12:36 +05:30
const DefaultFilterSuggestionsAttributesLimit = 50
const MaxFilterSuggestionsAttributesLimit = 100
const DefaultFilterSuggestionsExamplesLimit = 2
const MaxFilterSuggestionsExamplesLimit = 10
2024-09-09 23:13:14 +05:30
var SpanRenderLimitStr = GetOrDefaultEnv ( "SPAN_RENDER_LIMIT" , "2500" )
var MaxSpansInTraceStr = GetOrDefaultEnv ( "MAX_SPANS_IN_TRACE" , "250000" )
2024-11-13 20:30:01 +05:30
2024-11-19 14:38:12 +05:30
var NewStaticFieldsTraces = map [ string ] v3 . AttributeKey {
2024-11-13 20:30:01 +05:30
"timestamp" : { } ,
2024-11-19 14:38:12 +05:30
"trace_id" : {
Key : "trace_id" ,
2024-11-13 20:30:01 +05:30
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
"span_id" : {
Key : "span_id" ,
2024-11-13 20:30:01 +05:30
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
"trace_state" : {
Key : "trace_state" ,
2024-11-13 20:30:01 +05:30
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
"parent_span_id" : {
Key : "parent_span_id" ,
2024-11-13 20:30:01 +05:30
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
"flags" : {
Key : "flags" ,
DataType : v3 . AttributeKeyDataTypeInt64 ,
IsColumn : true ,
} ,
"name" : {
Key : "name" ,
2024-11-13 20:30:01 +05:30
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
"kind" : {
Key : "kind" ,
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
"kind_string" : {
Key : "kind_string" ,
2024-11-13 20:30:01 +05:30
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
"duration_nano" : {
Key : "duration_nano" ,
2024-11-13 20:30:01 +05:30
DataType : v3 . AttributeKeyDataTypeFloat64 ,
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
"status_code" : {
Key : "status_code" ,
2024-11-13 20:30:01 +05:30
DataType : v3 . AttributeKeyDataTypeFloat64 ,
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
"status_message" : {
Key : "status_message" ,
DataType : v3 . AttributeKeyDataTypeString ,
2024-11-13 20:30:01 +05:30
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
"status_code_string" : {
Key : "status_code_string" ,
2024-11-13 20:30:01 +05:30
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
// new support for composite attributes
"response_status_code" : {
Key : "response_status_code" ,
2024-11-13 20:30:01 +05:30
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
"external_http_url" : {
Key : "external_http_url" ,
2024-11-13 20:30:01 +05:30
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
"http_url" : {
Key : "http_url" ,
2024-11-13 20:30:01 +05:30
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
"external_http_method" : {
Key : "external_http_method" ,
2024-11-13 20:30:01 +05:30
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
"http_method" : {
Key : "http_method" ,
2024-11-13 20:30:01 +05:30
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
"http_host" : {
Key : "http_host" ,
2024-11-13 20:30:01 +05:30
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
"db_name" : {
Key : "db_name" ,
2024-11-13 20:30:01 +05:30
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
"db_operation" : {
Key : "db_operation" ,
2024-11-13 20:30:01 +05:30
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
"has_error" : {
Key : "has_error" ,
DataType : v3 . AttributeKeyDataTypeBool ,
2024-11-13 20:30:01 +05:30
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
"is_remote" : {
Key : "is_remote" ,
2024-11-13 20:30:01 +05:30
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
// the simple attributes are not present here as
// they are taken care by new format <attribute_type>_<attribute_datatype>_'<attribute_key>'
}
var DeprecatedStaticFieldsTraces = map [ string ] v3 . AttributeKey {
"traceID" : {
Key : "traceID" ,
2024-11-13 20:30:01 +05:30
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
"spanID" : {
Key : "spanID" ,
2024-11-13 20:30:01 +05:30
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
"parentSpanID" : {
Key : "parentSpanID" ,
2024-11-13 20:30:01 +05:30
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
2024-11-25 17:05:43 +05:30
"flags" : {
Key : "flags" ,
DataType : v3 . AttributeKeyDataTypeInt64 ,
IsColumn : true ,
} ,
"name" : {
Key : "name" ,
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
"kind" : {
Key : "kind" ,
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
"spanKind" : {
Key : "spanKind" ,
2024-11-13 20:30:01 +05:30
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
"durationNano" : {
Key : "durationNano" ,
DataType : v3 . AttributeKeyDataTypeFloat64 ,
IsColumn : true ,
} ,
"statusCode" : {
Key : "statusCode" ,
DataType : v3 . AttributeKeyDataTypeFloat64 ,
IsColumn : true ,
} ,
"statusMessage" : {
Key : "statusMessage" ,
2024-11-13 20:30:01 +05:30
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
"statusCodeString" : {
Key : "statusCodeString" ,
2024-11-13 20:30:01 +05:30
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
// old support for composite attributes
2024-11-13 20:30:01 +05:30
"responseStatusCode" : {
Key : "responseStatusCode" ,
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
"externalHttpUrl" : {
Key : "externalHttpUrl" ,
2024-11-16 15:19:25 +05:30
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
"httpUrl" : {
Key : "httpUrl" ,
2024-11-16 15:19:25 +05:30
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
"externalHttpMethod" : {
Key : "externalHttpMethod" ,
2024-11-16 15:19:25 +05:30
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
"httpMethod" : {
Key : "httpMethod" ,
2024-11-16 15:19:25 +05:30
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
"httpHost" : {
Key : "httpHost" ,
2024-11-16 15:19:25 +05:30
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
"dbName" : {
Key : "dbName" ,
2024-11-16 15:19:25 +05:30
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
"dbOperation" : {
Key : "dbOperation" ,
2024-11-16 15:19:25 +05:30
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
"hasError" : {
Key : "hasError" ,
DataType : v3 . AttributeKeyDataTypeBool ,
IsColumn : true ,
} ,
"isRemote" : {
Key : "isRemote" ,
2024-11-16 15:19:25 +05:30
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
// old support for resource attributes
"serviceName" : {
Key : "serviceName" ,
DataType : v3 . AttributeKeyDataTypeString ,
2024-11-16 15:19:25 +05:30
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
// old support for simple attributes
"httpRoute" : {
Key : "httpRoute" ,
2024-11-16 15:19:25 +05:30
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
2024-11-19 14:38:12 +05:30
"msgSystem" : {
Key : "msgSystem" ,
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
"msgOperation" : {
Key : "msgOperation" ,
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
"dbSystem" : {
Key : "dbSystem" ,
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
"rpcSystem" : {
Key : "rpcSystem" ,
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
"rpcService" : {
Key : "rpcService" ,
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
"rpcMethod" : {
Key : "rpcMethod" ,
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
"peerService" : {
Key : "peerService" ,
DataType : v3 . AttributeKeyDataTypeString ,
IsColumn : true ,
} ,
}
var StaticFieldsTraces = map [ string ] v3 . AttributeKey { }
func init ( ) {
StaticFieldsTraces = maps . Clone ( NewStaticFieldsTraces )
maps . Copy ( StaticFieldsTraces , DeprecatedStaticFieldsTraces )
2024-11-13 20:30:01 +05:30
}
2024-11-15 22:13:28 +05:30
const TRACE_V4_MAX_PAGINATION_LIMIT = 10000
2025-01-21 09:39:40 +05:30
const MaxResultRowsForCHQuery = 1_000_000
2025-02-20 20:09:58 +05:30
var ChDataTypeMap = map [ string ] string {
"string" : "String" ,
"bool" : "Bool" ,
"int64" : "Float64" ,
"float64" : "Float64" ,
}
var MaterializedDataTypeMap = map [ string ] string {
"string" : "string" ,
"bool" : "bool" ,
"int64" : "number" ,
"float64" : "number" ,
}