-
Notifications
You must be signed in to change notification settings - Fork 255
feat: add migration scripts for otel_spans_by_trace table and materialized view #3186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+51
−0
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d5c44c3
feat: add migration scripts for otel_spans_by_trace table and materia…
JivusAyrus 5531b30
refactor: remove outdated comments from otel_spans_by_trace materiali…
JivusAyrus 62cc64c
Merge branch 'main' into suvij/cosmo-75-optimize-gettrace-operation
JivusAyrus a4f9638
fix: specify schema for otel_spans_by_trace table creation
JivusAyrus b520937
Merge branch 'main' into suvij/cosmo-75-optimize-gettrace-operation
JivusAyrus 6df3ffa
Merge branch 'main' into suvij/cosmo-75-optimize-gettrace-operation
JivusAyrus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
controlplane/clickhouse/migrations/20260707090831_otel_spans_by_trace.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| -- migrate:up | ||
|
|
||
| CREATE TABLE IF NOT EXISTS cosmo.otel_spans_by_trace ( | ||
| FederatedGraphID String CODEC (ZSTD(3)), | ||
| OrganizationID LowCardinality(String) CODEC (ZSTD(3)), | ||
|
comatory marked this conversation as resolved.
|
||
| TraceId String CODEC (ZSTD(3)), | ||
| Timestamp DateTime64(9) CODEC (Delta(8), ZSTD(3)), | ||
| SpanId String CODEC (ZSTD(3)), | ||
| ParentSpanId String CODEC (ZSTD(3)), | ||
| SpanName LowCardinality(String) CODEC (ZSTD(3)), | ||
| SpanKind LowCardinality(String) CODEC (ZSTD(3)), | ||
| ServiceName LowCardinality(String) CODEC (ZSTD(3)), | ||
| Duration Int64 CODEC (ZSTD(3)), | ||
| StatusCode LowCardinality(String) CODEC (ZSTD(3)), | ||
| StatusMessage String CODEC (ZSTD(3)), | ||
| ScopeName String CODEC (ZSTD(3)), | ||
| SpanAttributes Map(LowCardinality(String), String) CODEC (ZSTD(3)) | ||
| ) ENGINE = MergeTree | ||
| PARTITION BY toDate(Timestamp) | ||
| ORDER BY (FederatedGraphID, OrganizationID, TraceId, Timestamp, SpanId) | ||
| TTL toDateTime(Timestamp) + toIntervalDay(30) SETTINGS index_granularity = 8192, ttl_only_drop_parts = 1; | ||
|
|
||
| -- migrate:down | ||
|
|
||
| DROP TABLE IF EXISTS cosmo.otel_spans_by_trace | ||
26 changes: 26 additions & 0 deletions
26
controlplane/clickhouse/migrations/20260707090832_otel_spans_by_trace_mv.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| -- migrate:up | ||
|
|
||
| CREATE MATERIALIZED VIEW IF NOT EXISTS cosmo.otel_spans_by_trace_mv TO cosmo.otel_spans_by_trace AS | ||
|
comatory marked this conversation as resolved.
|
||
| SELECT | ||
| SpanAttributes ['wg.federated_graph.id'] as FederatedGraphID, | ||
| toLowCardinality(SpanAttributes ['wg.organization.id']) as OrganizationID, | ||
| TraceId, | ||
| Timestamp, | ||
| SpanId, | ||
| ParentSpanId, | ||
| SpanName, | ||
| SpanKind, | ||
| ServiceName, | ||
| Duration, | ||
| StatusCode, | ||
| StatusMessage, | ||
| ScopeName, | ||
| SpanAttributes | ||
| FROM | ||
| cosmo.otel_traces | ||
| WHERE | ||
| SpanAttributes ['wg.federated_graph.id'] != ''; | ||
|
|
||
| -- migrate:down | ||
|
|
||
| DROP VIEW IF EXISTS cosmo.otel_spans_by_trace_mv | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.