From d3ea25f1ed9a80477975787b6f8f7c44dc0852c8 Mon Sep 17 00:00:00 2001 From: ElderMael Date: Mon, 21 Oct 2024 12:24:37 -0600 Subject: [PATCH 1/6] docs(clickhouseexporter): add examples of missing DDL tables --- .../default_ddl/exponential_histogram.sql | 44 +++++++++++++++++++ .../example/default_ddl/metrics_gauge.sql | 34 ++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 exporter/clickhouseexporter/example/default_ddl/exponential_histogram.sql create mode 100644 exporter/clickhouseexporter/example/default_ddl/metrics_gauge.sql diff --git a/exporter/clickhouseexporter/example/default_ddl/exponential_histogram.sql b/exporter/clickhouseexporter/example/default_ddl/exponential_histogram.sql new file mode 100644 index 0000000000000..a857cb29ff66e --- /dev/null +++ b/exporter/clickhouseexporter/example/default_ddl/exponential_histogram.sql @@ -0,0 +1,44 @@ +CREATE TABLE IF NOT EXISTS otel_metrics_exponential_histogram +( + ResourceAttributes Map(LowCardinality(String), String) CODEC (ZSTD(1)), + ResourceSchemaUrl String CODEC (ZSTD(1)), + ScopeName String CODEC (ZSTD(1)), + ScopeVersion String CODEC (ZSTD(1)), + ScopeAttributes Map(LowCardinality(String), String) CODEC (ZSTD(1)), + ScopeDroppedAttrCount UInt32 CODEC (ZSTD(1)), + ScopeSchemaUrl String CODEC (ZSTD(1)), + ServiceName LowCardinality(String) CODEC (ZSTD(1)), + MetricName String CODEC (ZSTD(1)), + MetricDescription String CODEC (ZSTD(1)), + MetricUnit String CODEC (ZSTD(1)), + Attributes Map(LowCardinality(String), String) CODEC (ZSTD(1)), + StartTimeUnix DateTime64(9) CODEC (Delta, ZSTD(1)), + TimeUnix DateTime64(9) CODEC (Delta, ZSTD(1)), + Count UInt64 CODEC (Delta, ZSTD(1)), + Sum Float64 CODEC (ZSTD(1)), + Scale Int32 CODEC (ZSTD(1)), + ZeroCount UInt64 CODEC (ZSTD(1)), + PositiveOffset Int32 CODEC (ZSTD(1)), + PositiveBucketCounts Array(UInt64) CODEC (ZSTD(1)), + NegativeOffset Int32 CODEC (ZSTD(1)), + NegativeBucketCounts Array(UInt64) CODEC (ZSTD(1)), + Exemplars Nested(FilteredAttributes Map(LowCardinality(String), String), + TimeUnix DateTime64(9), + Value Float64, + SpanId String, + TraceId String) CODEC (ZSTD(1)), + Flags UInt32 CODEC (ZSTD(1)), + Min Float64 CODEC (ZSTD(1)), + Max Float64 CODEC (ZSTD(1)), + AggregationTemporality Int32 CODEC (ZSTD(1)), + INDEX idx_res_attr_key mapKeys(ResourceAttributes) TYPE bloom_filter(0.01) GRANULARITY 1, + INDEX idx_res_attr_value mapValues(ResourceAttributes) TYPE bloom_filter(0.01) GRANULARITY 1, + INDEX idx_scope_attr_key mapKeys(ScopeAttributes) TYPE bloom_filter(0.01) GRANULARITY 1, + INDEX idx_scope_attr_value mapValues(ScopeAttributes) TYPE bloom_filter(0.01) GRANULARITY 1, + INDEX idx_attr_key mapKeys(Attributes) TYPE bloom_filter(0.01) GRANULARITY 1, + INDEX idx_attr_value mapValues(Attributes) TYPE bloom_filter(0.01) GRANULARITY 1 +) ENGINE = MergeTree + TTL toDateTime(TimeUnix) + toIntervalDay(7) + PARTITION BY toDate(TimeUnix) + ORDER BY (ServiceName, MetricName, Attributes, toUnixTimestamp64Nano(TimeUnix)) + SETTINGS index_granularity = 8192, ttl_only_drop_parts = 1; \ No newline at end of file diff --git a/exporter/clickhouseexporter/example/default_ddl/metrics_gauge.sql b/exporter/clickhouseexporter/example/default_ddl/metrics_gauge.sql new file mode 100644 index 0000000000000..ce3498bb622c3 --- /dev/null +++ b/exporter/clickhouseexporter/example/default_ddl/metrics_gauge.sql @@ -0,0 +1,34 @@ +CREATE TABLE IF NOT EXISTS otel_metrics_gauge +( + ResourceAttributes Map(LowCardinality(String), String) CODEC (ZSTD(1)), + ResourceSchemaUrl String CODEC (ZSTD(1)), + ScopeName String CODEC (ZSTD(1)), + ScopeVersion String CODEC (ZSTD(1)), + ScopeAttributes Map(LowCardinality(String), String) CODEC (ZSTD(1)), + ScopeDroppedAttrCount UInt32 CODEC (ZSTD(1)), + ScopeSchemaUrl String CODEC (ZSTD(1)), + ServiceName LowCardinality(String) CODEC (ZSTD(1)), + MetricName String CODEC (ZSTD(1)), + MetricDescription String CODEC (ZSTD(1)), + MetricUnit String CODEC (ZSTD(1)), + Attributes Map(LowCardinality(String), String) CODEC (ZSTD(1)), + StartTimeUnix DateTime64(9) CODEC (Delta, ZSTD(1)), + TimeUnix DateTime64(9) CODEC (Delta, ZSTD(1)), + Value Float64 CODEC (ZSTD(1)), + Flags UInt32 CODEC (ZSTD(1)), + Exemplars Nested(FilteredAttributes Map(LowCardinality(String), String), + TimeUnix DateTime64(9), + Value Float64, + SpanId String, + TraceId String) CODEC (ZSTD(1)), + INDEX idx_res_attr_key mapKeys(ResourceAttributes) TYPE bloom_filter(0.01) GRANULARITY 1, + INDEX idx_res_attr_value mapValues(ResourceAttributes) TYPE bloom_filter(0.01) GRANULARITY 1, + INDEX idx_scope_attr_key mapKeys(ScopeAttributes) TYPE bloom_filter(0.01) GRANULARITY 1, + INDEX idx_scope_attr_value mapValues(ScopeAttributes) TYPE bloom_filter(0.01) GRANULARITY 1, + INDEX idx_attr_key mapKeys(Attributes) TYPE bloom_filter(0.01) GRANULARITY 1, + INDEX idx_attr_value mapValues(Attributes) TYPE bloom_filter(0.01) GRANULARITY 1 +) ENGINE = MergeTree + PARTITION BY toDate(TimeUnix) + ORDER BY (ServiceName, MetricName, Attributes, toUnixTimestamp64Nano(TimeUnix)) + TTL toDateTime(TimeUnix) + toIntervalDay(7) + SETTINGS index_granularity = 8192, ttl_only_drop_parts = 1; From 8d7bce2d0f84324637d51d4e56467df88e4715f9 Mon Sep 17 00:00:00 2001 From: ElderMael Date: Mon, 21 Oct 2024 12:38:08 -0600 Subject: [PATCH 2/6] docs(clickhouseexpoter): set TTL to 180 days to match other examples --- .../example/default_ddl/exponential_histogram.sql | 2 +- .../clickhouseexporter/example/default_ddl/metrics_gauge.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/exporter/clickhouseexporter/example/default_ddl/exponential_histogram.sql b/exporter/clickhouseexporter/example/default_ddl/exponential_histogram.sql index a857cb29ff66e..233b9c05b3b47 100644 --- a/exporter/clickhouseexporter/example/default_ddl/exponential_histogram.sql +++ b/exporter/clickhouseexporter/example/default_ddl/exponential_histogram.sql @@ -38,7 +38,7 @@ CREATE TABLE IF NOT EXISTS otel_metrics_exponential_histogram INDEX idx_attr_key mapKeys(Attributes) TYPE bloom_filter(0.01) GRANULARITY 1, INDEX idx_attr_value mapValues(Attributes) TYPE bloom_filter(0.01) GRANULARITY 1 ) ENGINE = MergeTree - TTL toDateTime(TimeUnix) + toIntervalDay(7) + TTL toDateTime(TimeUnix) + toIntervalDay(180) PARTITION BY toDate(TimeUnix) ORDER BY (ServiceName, MetricName, Attributes, toUnixTimestamp64Nano(TimeUnix)) SETTINGS index_granularity = 8192, ttl_only_drop_parts = 1; \ No newline at end of file diff --git a/exporter/clickhouseexporter/example/default_ddl/metrics_gauge.sql b/exporter/clickhouseexporter/example/default_ddl/metrics_gauge.sql index ce3498bb622c3..01f6ef632205c 100644 --- a/exporter/clickhouseexporter/example/default_ddl/metrics_gauge.sql +++ b/exporter/clickhouseexporter/example/default_ddl/metrics_gauge.sql @@ -30,5 +30,5 @@ CREATE TABLE IF NOT EXISTS otel_metrics_gauge ) ENGINE = MergeTree PARTITION BY toDate(TimeUnix) ORDER BY (ServiceName, MetricName, Attributes, toUnixTimestamp64Nano(TimeUnix)) - TTL toDateTime(TimeUnix) + toIntervalDay(7) + TTL toDateTime(TimeUnix) + toIntervalDay(180) SETTINGS index_granularity = 8192, ttl_only_drop_parts = 1; From 3f293bec3212b1765442d82cffbdb3d77a949bbd Mon Sep 17 00:00:00 2001 From: ElderMael Date: Tue, 22 Oct 2024 11:34:58 -0600 Subject: [PATCH 3/6] chore[docs]: Add changelog file --- .chloggen/clickhouse_examples.yaml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .chloggen/clickhouse_examples.yaml diff --git a/.chloggen/clickhouse_examples.yaml b/.chloggen/clickhouse_examples.yaml new file mode 100644 index 0000000000000..620d677db4344 --- /dev/null +++ b/.chloggen/clickhouse_examples.yaml @@ -0,0 +1,27 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: docs + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: clickhouseexporter + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Adding missing examples of DDL created by the clickhouse exporter + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [] From d8c01dfa9bce6f4de6766b16c2a1f861ae5b20dc Mon Sep 17 00:00:00 2001 From: ElderMael Date: Tue, 22 Oct 2024 11:46:33 -0600 Subject: [PATCH 4/6] chore: rename changelog component --- .chloggen/clickhouse_examples.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.chloggen/clickhouse_examples.yaml b/.chloggen/clickhouse_examples.yaml index 620d677db4344..9ab891d9084d7 100644 --- a/.chloggen/clickhouse_examples.yaml +++ b/.chloggen/clickhouse_examples.yaml @@ -4,7 +4,7 @@ change_type: docs # The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) -component: clickhouseexporter +component: exporter/clickhouse # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). note: Adding missing examples of DDL created by the clickhouse exporter From 6af113a6a1f0b30d50e27a0e1553fd0f49770311 Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Thu, 23 Jan 2025 15:42:18 -0800 Subject: [PATCH 5/6] Update .chloggen/clickhouse_examples.yaml --- .chloggen/clickhouse_examples.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.chloggen/clickhouse_examples.yaml b/.chloggen/clickhouse_examples.yaml index 9ab891d9084d7..ef7abc7d8d07b 100644 --- a/.chloggen/clickhouse_examples.yaml +++ b/.chloggen/clickhouse_examples.yaml @@ -1,7 +1,7 @@ # Use this changelog template to create an entry for release notes. # One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' -change_type: docs +change_type: enhancement # The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) component: exporter/clickhouse From 7c5a692be47dc16f02088c09fd4f9275af5ceb73 Mon Sep 17 00:00:00 2001 From: Yang Song Date: Fri, 24 Jan 2025 13:15:21 -0500 Subject: [PATCH 6/6] Add PR number --- .chloggen/clickhouse_examples.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.chloggen/clickhouse_examples.yaml b/.chloggen/clickhouse_examples.yaml index ef7abc7d8d07b..71c9ab542e0ff 100644 --- a/.chloggen/clickhouse_examples.yaml +++ b/.chloggen/clickhouse_examples.yaml @@ -10,7 +10,7 @@ component: exporter/clickhouse note: Adding missing examples of DDL created by the clickhouse exporter # Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. -issues: [] +issues: [35903] # (Optional) One or more lines of additional information to render under the primary note. # These lines will be padded with 2 spaces and then inserted directly into the document.