mirror of
https://github.com/hanzoai/o11y.git
synced 2026-10-15 12:58:33 +00:00
Re-sync the entire SigNoz-derived Go tree to a clean fork of latest SigNoz main (upstream 3e6339019), eliminating the version-skew that broke `go build ./...` (mixed-era packages, ~14 imported-but-absent packages, partial signoz->o11y / clickhouse->datastore rebrands, self-import cycle, duplicate package decls). - pkg/ + cmd/ wholesale replaced with latest SigNoz; imports rewritten github.com/SigNoz/signoz/ -> github.com/hanzoai/o11y/. - Adopt SigNoz's CURRENT structure (resourcefilter->telemetryresourcefilter, integrationtypes->cloudintegrationtypes, roletypes/grammar/times folded in upstream); old paths dropped. - Fork deps repathed to hanzoai + bumped: signoz-otel-collector v0.144.6, clickhouse-go-mock v0.14.1, govaluate v0.1.0; expr-lang/expr => hanzoai/expr v1.17.8 (replace). go.mod reconciled from latest SigNoz; go.sum re-tidied. - ee/ + cmd/enterprise stripped — o11y stays MIT-only; community edition imports no ee packages. - Preserved o11y additions: module path github.com/hanzoai/o11y, mount.go (cloud.Register/zip mount adapter, HIP-0106), NOTICE + LICENSE (SigNoz §4c attribution retained; upstream pkg files are headerless per SigNoz convention). - Reverted o11y cosmetic renames (o11y*/datastore*) and experimental originals (authz/iamauthz, billing, zapreceiver, zapmetricreceiver) to SigNoz canonical to kill the skew; snapshots retained in git history for re-layering. go build ./... = exit 0. go vet clean except benign "unreachable code" in generated ANTLR parser files (inherited from upstream).
150 lines
4.1 KiB
Go
150 lines
4.1 KiB
Go
package telemetrytraces
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/hanzoai/o11y/pkg/types/telemetrytypes"
|
|
)
|
|
|
|
func buildCompleteFieldKeyMap(releaseTime time.Time) map[string][]*telemetrytypes.TelemetryFieldKey {
|
|
keysMap := map[string][]*telemetrytypes.TelemetryFieldKey{
|
|
"service.name": {
|
|
{
|
|
Name: "service.name",
|
|
FieldContext: telemetrytypes.FieldContextResource,
|
|
FieldDataType: telemetrytypes.FieldDataTypeString,
|
|
},
|
|
},
|
|
"http.request.method": {
|
|
{
|
|
Name: "http.request.method",
|
|
FieldContext: telemetrytypes.FieldContextAttribute,
|
|
FieldDataType: telemetrytypes.FieldDataTypeString,
|
|
},
|
|
},
|
|
"http.response.status_code": {
|
|
{
|
|
Name: "http.status_code",
|
|
FieldContext: telemetrytypes.FieldContextAttribute,
|
|
FieldDataType: telemetrytypes.FieldDataTypeInt64,
|
|
},
|
|
},
|
|
"kind_string": {
|
|
{
|
|
Name: "kind_string",
|
|
FieldContext: telemetrytypes.FieldContextSpan,
|
|
FieldDataType: telemetrytypes.FieldDataTypeString,
|
|
},
|
|
},
|
|
"metric.max_count": {
|
|
{
|
|
Name: "metric.max_count",
|
|
FieldContext: telemetrytypes.FieldContextAttribute,
|
|
FieldDataType: telemetrytypes.FieldDataTypeFloat64,
|
|
},
|
|
},
|
|
"cart.items_count": {
|
|
{
|
|
Name: "cart.items_count",
|
|
FieldContext: telemetrytypes.FieldContextAttribute,
|
|
FieldDataType: telemetrytypes.FieldDataTypeFloat64,
|
|
Materialized: true,
|
|
},
|
|
},
|
|
"user.id": {
|
|
{
|
|
Name: "user.id",
|
|
FieldContext: telemetrytypes.FieldContextAttribute,
|
|
FieldDataType: telemetrytypes.FieldDataTypeString,
|
|
},
|
|
},
|
|
"duration_nano": {
|
|
{
|
|
Name: "duration_nano",
|
|
FieldContext: telemetrytypes.FieldContextSpan,
|
|
FieldDataType: telemetrytypes.FieldDataTypeInt64,
|
|
},
|
|
{
|
|
Name: "duration_nano",
|
|
FieldContext: telemetrytypes.FieldContextAttribute,
|
|
FieldDataType: telemetrytypes.FieldDataTypeInt64,
|
|
},
|
|
},
|
|
"http.method": {
|
|
{
|
|
Name: "http.method",
|
|
FieldContext: telemetrytypes.FieldContextAttribute,
|
|
FieldDataType: telemetrytypes.FieldDataTypeString,
|
|
},
|
|
},
|
|
"response_status_code": {
|
|
{
|
|
Name: "response_status_code",
|
|
FieldContext: telemetrytypes.FieldContextSpan,
|
|
FieldDataType: telemetrytypes.FieldDataTypeInt64,
|
|
},
|
|
},
|
|
"materialized.key.name": {
|
|
{
|
|
Name: "materialized.key.name",
|
|
FieldContext: telemetrytypes.FieldContextAttribute,
|
|
FieldDataType: telemetrytypes.FieldDataTypeString,
|
|
Materialized: true,
|
|
},
|
|
},
|
|
"mixed.materialization.key": {
|
|
{
|
|
Name: "mixed.materialization.key",
|
|
FieldContext: telemetrytypes.FieldContextAttribute,
|
|
FieldDataType: telemetrytypes.FieldDataTypeString,
|
|
Materialized: true,
|
|
},
|
|
{
|
|
Name: "mixed.materialization.key",
|
|
FieldContext: telemetrytypes.FieldContextResource,
|
|
FieldDataType: telemetrytypes.FieldDataTypeString,
|
|
Materialized: false,
|
|
},
|
|
},
|
|
"isentrypoint": {
|
|
{
|
|
Name: "isentrypoint",
|
|
FieldContext: telemetrytypes.FieldContextSpan,
|
|
FieldDataType: telemetrytypes.FieldDataTypeBool,
|
|
},
|
|
},
|
|
}
|
|
for _, keys := range keysMap {
|
|
for _, key := range keys {
|
|
key.Signal = telemetrytypes.SignalTraces
|
|
if key.FieldContext == telemetrytypes.FieldContextResource {
|
|
key.Evolutions = mockEvolutionData(releaseTime)
|
|
}
|
|
}
|
|
}
|
|
return keysMap
|
|
}
|
|
|
|
// mockEvolutionData returns the canonical resource-column evolution timeline used in tests:
|
|
// the legacy resources_string map at epoch 0 and the JSON resource column released at releaseTime.
|
|
func mockEvolutionData(releaseTime time.Time) []*telemetrytypes.EvolutionEntry {
|
|
return []*telemetrytypes.EvolutionEntry{
|
|
{
|
|
Signal: telemetrytypes.SignalTraces,
|
|
ColumnName: "resources_string",
|
|
FieldContext: telemetrytypes.FieldContextResource,
|
|
ColumnType: "Map(LowCardinality(String), String)",
|
|
FieldName: "__all__",
|
|
ReleaseTime: time.Unix(0, 0),
|
|
},
|
|
{
|
|
Signal: telemetrytypes.SignalTraces,
|
|
ColumnName: "resource",
|
|
ColumnType: "JSON()",
|
|
FieldContext: telemetrytypes.FieldContextResource,
|
|
FieldName: "__all__",
|
|
ReleaseTime: releaseTime,
|
|
},
|
|
}
|
|
}
|