Repository navigation
feat: fast and full autocomplete #2128
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
Changes from all commits
76a4812
5b47c0e
933d640
a0515d4
91f36fc
cface46
41fe0b8
fbeb207
910fe15
0c2f635
8e5c7fa
ed21358
05f13bc
de96fbc
1c97c05
31cb24c
da4cc4d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| "@hyperdx/common-utils": minor | ||
| "@hyperdx/api": minor | ||
| "@hyperdx/app": minor | ||
| --- | ||
|
|
||
| feat: introducing rollup and source support for full autocomplete |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,171 @@ | ||
| -- +goose Up | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The general idea:
The The same idea is applied to both log and trace tables |
||
|
|
||
| -- Map Attributes Key Value Rollup (all map columns in one table) | ||
| CREATE TABLE IF NOT EXISTS ${DATABASE}.otel_logs_kv_rollup_15m | ||
| ( | ||
| `Timestamp` DateTime, | ||
| `ColumnIdentifier` LowCardinality(String), | ||
| `Key` LowCardinality(String), | ||
| `Value` String, | ||
| `count` UInt64, | ||
| INDEX idx_count_minmax count TYPE minmax GRANULARITY 1, | ||
| INDEX idx_timestamp_minmax Timestamp TYPE minmax GRANULARITY 1 | ||
| ) | ||
| ENGINE = SummingMergeTree | ||
| PARTITION BY toDate(Timestamp) | ||
| ORDER BY (ColumnIdentifier, Key, Timestamp, Value) | ||
| TTL Timestamp + ${TABLES_TTL} | ||
| SETTINGS index_granularity = 8192, ttl_only_drop_parts = 1; | ||
|
|
||
| -- Key Only Rollup (derived from KV rollup) | ||
| CREATE TABLE IF NOT EXISTS ${DATABASE}.otel_logs_key_rollup_15m | ||
| ( | ||
| `Timestamp` DateTime, | ||
| `ColumnIdentifier` LowCardinality(String), | ||
| `Key` LowCardinality(String), | ||
| `count` UInt64, | ||
| INDEX idx_count_minmax count TYPE minmax GRANULARITY 1, | ||
| INDEX idx_timestamp_minmax Timestamp TYPE minmax GRANULARITY 1 | ||
| ) | ||
| ENGINE = SummingMergeTree | ||
| PARTITION BY toDate(Timestamp) | ||
| ORDER BY (ColumnIdentifier, Key, Timestamp) | ||
| TTL Timestamp + ${TABLES_TTL} | ||
| SETTINGS index_granularity = 8192, ttl_only_drop_parts = 1; | ||
|
|
||
| CREATE MATERIALIZED VIEW IF NOT EXISTS ${DATABASE}.otel_logs_key_rollup_15m_mv TO ${DATABASE}.otel_logs_key_rollup_15m | ||
| AS SELECT | ||
| Timestamp, | ||
| ColumnIdentifier, | ||
| Key, | ||
| sum(count) as count | ||
| FROM ${DATABASE}.otel_logs_kv_rollup_15m | ||
| GROUP BY ColumnIdentifier, Key, Timestamp; | ||
|
|
||
| -- Single MV: CTE with UNION ALL across all columns, then aggregate | ||
| CREATE MATERIALIZED VIEW IF NOT EXISTS ${DATABASE}.otel_logs_attr_kv_rollup_15m_mv TO ${DATABASE}.otel_logs_kv_rollup_15m | ||
| AS WITH elements AS ( | ||
| SELECT | ||
| 'ResourceAttributes' AS ColumnIdentifier, | ||
| toStartOfFifteenMinutes(Timestamp) AS Timestamp, | ||
| replaceRegexpAll(entry.1, '\\[\\d+\\]', '[*]') AS Key, | ||
| CAST(entry.2 AS String) AS Value | ||
| FROM ${DATABASE}.otel_logs | ||
| ARRAY JOIN ResourceAttributes AS entry | ||
| UNION ALL | ||
| SELECT | ||
| 'LogAttributes' AS ColumnIdentifier, | ||
| toStartOfFifteenMinutes(Timestamp) AS Timestamp, | ||
| replaceRegexpAll(entry.1, '\\[\\d+\\]', '[*]') AS Key, | ||
| CAST(entry.2 AS String) AS Value | ||
| FROM ${DATABASE}.otel_logs | ||
| ARRAY JOIN LogAttributes AS entry | ||
| UNION ALL | ||
| SELECT | ||
| 'ScopeAttributes' AS ColumnIdentifier, | ||
| toStartOfFifteenMinutes(Timestamp) AS Timestamp, | ||
| replaceRegexpAll(entry.1, '\\[\\d+\\]', '[*]') AS Key, | ||
| CAST(entry.2 AS String) AS Value | ||
| FROM ${DATABASE}.otel_logs | ||
| ARRAY JOIN ScopeAttributes AS entry | ||
| UNION ALL | ||
| SELECT | ||
| 'NativeColumn' AS ColumnIdentifier, | ||
| toStartOfFifteenMinutes(Timestamp) AS Timestamp, | ||
| 'SeverityText' as Key, | ||
| CAST(SeverityText AS String) as Value | ||
| FROM ${DATABASE}.otel_logs | ||
| UNION ALL | ||
| SELECT | ||
| 'NativeColumn' AS ColumnIdentifier, | ||
| toStartOfFifteenMinutes(Timestamp) AS Timestamp, | ||
| 'ServiceName' as Key, | ||
| CAST(ServiceName AS String) as Value | ||
| FROM ${DATABASE}.otel_logs | ||
| UNION ALL | ||
| SELECT | ||
| 'NativeColumn' AS ColumnIdentifier, | ||
| toStartOfFifteenMinutes(Timestamp) AS Timestamp, | ||
| 'ScopeName' as Key, | ||
| CAST(ScopeName AS String) as Value | ||
| FROM ${DATABASE}.otel_logs | ||
| UNION ALL | ||
| SELECT | ||
| 'NativeColumn' AS ColumnIdentifier, | ||
| toStartOfFifteenMinutes(Timestamp) AS Timestamp, | ||
| 'ScopeVersion' as Key, | ||
| CAST(ScopeVersion AS String) as Value | ||
| FROM ${DATABASE}.otel_logs | ||
| UNION ALL | ||
| SELECT | ||
| 'NativeColumn' AS ColumnIdentifier, | ||
| toStartOfFifteenMinutes(Timestamp) AS Timestamp, | ||
| 'ResourceSchemaUrl' as Key, | ||
| CAST(ResourceSchemaUrl AS String) as Value | ||
| FROM ${DATABASE}.otel_logs | ||
| UNION ALL | ||
| SELECT | ||
| 'NativeColumn' AS ColumnIdentifier, | ||
| toStartOfFifteenMinutes(Timestamp) AS Timestamp, | ||
| 'ScopeSchemaUrl' as Key, | ||
| CAST(ScopeSchemaUrl AS String) as Value | ||
| FROM ${DATABASE}.otel_logs | ||
| UNION ALL | ||
| SELECT | ||
| 'NativeColumn' AS ColumnIdentifier, | ||
| toStartOfFifteenMinutes(Timestamp) AS Timestamp, | ||
| '__hdx_materialized_k8s.cluster.name' as Key, | ||
| CAST(`__hdx_materialized_k8s.cluster.name` AS String) as Value | ||
| FROM ${DATABASE}.otel_logs | ||
| UNION ALL | ||
| SELECT | ||
| 'NativeColumn' AS ColumnIdentifier, | ||
| toStartOfFifteenMinutes(Timestamp) AS Timestamp, | ||
| '__hdx_materialized_k8s.container.name' as Key, | ||
| CAST(`__hdx_materialized_k8s.container.name` AS String) as Value | ||
| FROM ${DATABASE}.otel_logs | ||
| UNION ALL | ||
| SELECT | ||
| 'NativeColumn' AS ColumnIdentifier, | ||
| toStartOfFifteenMinutes(Timestamp) AS Timestamp, | ||
| '__hdx_materialized_k8s.deployment.name' as Key, | ||
| CAST(`__hdx_materialized_k8s.deployment.name` AS String) as Value | ||
| FROM ${DATABASE}.otel_logs | ||
| UNION ALL | ||
| SELECT | ||
| 'NativeColumn' AS ColumnIdentifier, | ||
| toStartOfFifteenMinutes(Timestamp) AS Timestamp, | ||
| '__hdx_materialized_k8s.namespace.name' as Key, | ||
| CAST(`__hdx_materialized_k8s.namespace.name` AS String) as Value | ||
| FROM ${DATABASE}.otel_logs | ||
| UNION ALL | ||
| SELECT | ||
| 'NativeColumn' AS ColumnIdentifier, | ||
| toStartOfFifteenMinutes(Timestamp) AS Timestamp, | ||
| '__hdx_materialized_k8s.node.name' as Key, | ||
| CAST(`__hdx_materialized_k8s.node.name` AS String) as Value | ||
| FROM ${DATABASE}.otel_logs | ||
| UNION ALL | ||
| SELECT | ||
| 'NativeColumn' AS ColumnIdentifier, | ||
| toStartOfFifteenMinutes(Timestamp) AS Timestamp, | ||
| '__hdx_materialized_k8s.pod.name' as Key, | ||
| CAST(`__hdx_materialized_k8s.pod.name` AS String) as Value | ||
| FROM ${DATABASE}.otel_logs | ||
| UNION ALL | ||
| SELECT | ||
| 'NativeColumn' AS ColumnIdentifier, | ||
| toStartOfFifteenMinutes(Timestamp) AS Timestamp, | ||
| '__hdx_materialized_k8s.pod.uid' as Key, | ||
| CAST(`__hdx_materialized_k8s.pod.uid` AS String) as Value | ||
| FROM ${DATABASE}.otel_logs | ||
| UNION ALL | ||
| SELECT | ||
| 'NativeColumn' AS ColumnIdentifier, | ||
| toStartOfFifteenMinutes(Timestamp) AS Timestamp, | ||
| '__hdx_materialized_deployment.environment.name' as Key, | ||
| CAST(`__hdx_materialized_deployment.environment.name` AS String) as Value | ||
| FROM ${DATABASE}.otel_logs | ||
| ) | ||
| SELECT Timestamp, ColumnIdentifier, Key, Value, count() AS count FROM elements | ||
| GROUP BY Timestamp, ColumnIdentifier, Key, Value; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change is to add the
metadataMaterializedViewsource by default