mirror of
https://github.com/hanzoai/otel-collector.git
synced 2026-11-03 02:20:04 +00:00
Rename ONLY the physical ClickHouse DATABASE/TABLE identifiers the schema-migrator CREATEs and the exporters WRITE, matching the o11y read plane + the data-preserving RENAME migration (hanzoai/o11y#28): databases: signoz_{traces,metrics,logs,metadata,analytics,meter} -> o11y_{traces,metrics,logs,metadata,analytics,meter} tables: (distributed_)signoz_{index_v3,index_v2,error_index_v2,spans} -> (distributed_)o11y_{index_v3,index_v2,error_index_v2,spans} Word-boundary anchored (\bsignoz_<db>\b) so wire contracts are untouched: spanmetrics/usage METRIC names (signoz_calls_total, signoz_latency, signoz_*_count/_bytes, signoz_metadata_exporter_json_logs_processed, signoz_normalize_operator_logs_processed), signoz.* resource ATTRIBUTES (signoz.gen_ai.*), OTel component TYPE strings (signozclickhousemetrics, signozclickhousemeter, signozlogspipeline, signozllmpricing), and all github.com/SigNoz/* deps + LICENSE/NOTICE attribution all preserved. Coordinated cutover: deploy this collector, run o11y#28 RENAME migration, then deploy o11y + cloud readers — together, or telemetry blackholes. go build ./... = 0. schema-migrator tests green. Two pre-existing test failures (flaky TestExporterPushTracesData usage-collector timing; o11ydatastoremeter go.signoz.io scope-name debrand) reproduce identically on unmodified v0.144.7.
67 lines
2.7 KiB
Go
67 lines
2.7 KiB
Go
package schemamigrator
|
|
|
|
var AnalyticsMigrations = []SchemaMigrationRecord{
|
|
{
|
|
MigrationID: 1,
|
|
UpItems: []Operation{
|
|
CreateTableOperation{
|
|
Database: "o11y_analytics",
|
|
Table: "rule_state_history_v0",
|
|
Columns: []Column{
|
|
{Name: "_retention_days", Type: ColumnTypeUInt32, Default: "180"},
|
|
{Name: "rule_id", Type: LowCardinalityColumnType{ElementType: ColumnTypeString}},
|
|
{Name: "rule_name", Type: LowCardinalityColumnType{ElementType: ColumnTypeString}},
|
|
{Name: "overall_state", Type: LowCardinalityColumnType{ElementType: ColumnTypeString}},
|
|
{Name: "overall_state_changed", Type: ColumnTypeBool},
|
|
{Name: "state", Type: LowCardinalityColumnType{ElementType: ColumnTypeString}},
|
|
{Name: "state_changed", Type: ColumnTypeBool},
|
|
{Name: "unix_milli", Type: ColumnTypeInt64, Codec: "Delta(8), ZSTD(1)"},
|
|
{Name: "fingerprint", Type: ColumnTypeUInt64, Codec: "ZSTD(1)"},
|
|
{Name: "value", Type: ColumnTypeFloat64, Codec: "Gorilla, ZSTD(1)"},
|
|
{Name: "labels", Type: ColumnTypeString, Codec: "ZSTD(5)"},
|
|
},
|
|
Engine: MergeTree{
|
|
PartitionBy: "toDate(unix_milli / 1000)",
|
|
OrderBy: "(rule_id, unix_milli)",
|
|
TTL: "toDateTime(unix_milli / 1000) + toIntervalDay(_retention_days)",
|
|
Settings: TableSettings{
|
|
{Name: "ttl_only_drop_parts", Value: "1"},
|
|
{Name: "index_granularity", Value: "8192"},
|
|
},
|
|
},
|
|
},
|
|
CreateTableOperation{
|
|
Database: "o11y_analytics",
|
|
Table: "distributed_rule_state_history_v0",
|
|
Columns: []Column{
|
|
{Name: "rule_id", Type: LowCardinalityColumnType{ElementType: ColumnTypeString}},
|
|
{Name: "rule_name", Type: LowCardinalityColumnType{ElementType: ColumnTypeString}},
|
|
{Name: "overall_state", Type: LowCardinalityColumnType{ElementType: ColumnTypeString}},
|
|
{Name: "overall_state_changed", Type: ColumnTypeBool},
|
|
{Name: "state", Type: LowCardinalityColumnType{ElementType: ColumnTypeString}},
|
|
{Name: "state_changed", Type: ColumnTypeBool},
|
|
{Name: "unix_milli", Type: ColumnTypeInt64, Codec: "Delta(8), ZSTD(1)"},
|
|
{Name: "fingerprint", Type: ColumnTypeUInt64, Codec: "ZSTD(1)"},
|
|
{Name: "value", Type: ColumnTypeFloat64, Codec: "Gorilla, ZSTD(1)"},
|
|
{Name: "labels", Type: ColumnTypeString, Codec: "ZSTD(5)"},
|
|
},
|
|
Engine: Distributed{
|
|
Database: "o11y_analytics",
|
|
Table: "rule_state_history_v0",
|
|
ShardingKey: "cityHash64(rule_id, rule_name, fingerprint)",
|
|
},
|
|
},
|
|
},
|
|
DownItems: []Operation{
|
|
DropTableOperation{
|
|
Database: "o11y_analytics",
|
|
Table: "distributed_rule_state_history_v0",
|
|
},
|
|
DropTableOperation{
|
|
Database: "o11y_analytics",
|
|
Table: "rule_state_history_v0",
|
|
},
|
|
},
|
|
},
|
|
}
|