From b1125a53e567f4569b172c1f3945f2ef6de674cf Mon Sep 17 00:00:00 2001 From: shuiyisong Date: Wed, 25 Nov 2026 17:10:36 +0800 Subject: [PATCH 1/4] docs: link trace pipeline references to data model versioning Signed-off-by: shuiyisong --- docs/reference/sql/information-schema/table-semantics.md | 2 +- docs/user-guide/ingest-data/for-observability/fluent-bit.md | 2 +- .../ingest-data/for-observability/opentelemetry.md | 2 +- .../ingest-data/for-observability/otel-collector.md | 6 +++--- docs/user-guide/protocols/postgresql-copy-in.md | 2 +- docs/user-guide/semantic-layer/declaring-entities.md | 3 ++- docs/user-guide/semantic-layer/table-semantics.md | 4 ++-- docs/user-guide/traces/read-write.md | 1 + .../reference/sql/information-schema/table-semantics.md | 2 +- .../user-guide/ingest-data/for-observability/fluent-bit.md | 2 +- .../ingest-data/for-observability/opentelemetry.md | 4 ++-- .../ingest-data/for-observability/otel-collector.md | 6 +++--- .../current/user-guide/protocols/postgresql-copy-in.md | 2 +- .../current/user-guide/semantic-layer/declaring-entities.md | 2 +- .../current/user-guide/semantic-layer/table-semantics.md | 4 ++-- .../current/user-guide/traces/read-write.md | 3 ++- .../reference/sql/information-schema/table-semantics.md | 2 +- .../user-guide/ingest-data/for-observability/fluent-bit.md | 2 +- .../ingest-data/for-observability/opentelemetry.md | 4 ++-- .../ingest-data/for-observability/otel-collector.md | 6 +++--- .../user-guide/semantic-layer/declaring-entities.md | 2 +- .../user-guide/semantic-layer/table-semantics.md | 4 ++-- .../version-1.3/user-guide/traces/read-write.md | 3 ++- .../reference/sql/information-schema/table-semantics.md | 2 +- .../user-guide/ingest-data/for-observability/fluent-bit.md | 2 +- .../ingest-data/for-observability/opentelemetry.md | 2 +- .../ingest-data/for-observability/otel-collector.md | 6 +++--- .../user-guide/semantic-layer/declaring-entities.md | 3 ++- .../user-guide/semantic-layer/table-semantics.md | 4 ++-- versioned_docs/version-1.3/user-guide/traces/read-write.md | 1 + 30 files changed, 48 insertions(+), 42 deletions(-) diff --git a/docs/reference/sql/information-schema/table-semantics.md b/docs/reference/sql/information-schema/table-semantics.md index 985b77cdf..83a871965 100644 --- a/docs/reference/sql/information-schema/table-semantics.md +++ b/docs/reference/sql/information-schema/table-semantics.md @@ -67,7 +67,7 @@ The output is as follows: - `unknown` — could not be determined when the option was stamped. - `source`: The ingestion ecosystem that wrote the data. One of `opentelemetry`, `prometheus`, `influxdb`, `opentsdb`, `elasticsearch`, `loki`, `custom`, `mixed`, or `unknown`. `mixed` means one table received data from more than one source; `unknown` means it could not be determined. - `source_version`: The version of the source protocol. The Prometheus remote write path stamps `1.0` or `2.0`; other paths leave it empty. -- `pipeline`: A free-form identifier of the internal ingestion data model. Today the OTLP trace path stamps `greptime_trace_v1` or `greptime_trace_v2`, depending on the selected pipeline; other values can be set manually. It is the signal-agnostic successor to the `table_data_model` option. +- `pipeline`: A free-form identifier of the internal ingestion data model. Today the OTLP trace path stamps `greptime_trace_v1` or `greptime_trace_v2`, depending on the [selected trace pipeline](/user-guide/traces/data-model.md#data-model-versioning); other values can be set manually. It is the signal-agnostic successor to the `table_data_model` option. - `metadata_quality`: How the metric type metadata was obtained — that is, how much you can trust the `metric.type` value. One of: - `declared` — the ingestion protocol stated the instrument type explicitly (for example OTLP metrics carry the type). Trustworthy. - `inferred` — the type was guessed from the metric name (for example a Prometheus `_total` suffix is read as a counter). May be wrong for non-conventional names. diff --git a/docs/user-guide/ingest-data/for-observability/fluent-bit.md b/docs/user-guide/ingest-data/for-observability/fluent-bit.md index d9c05c153..d225a47d5 100644 --- a/docs/user-guide/ingest-data/for-observability/fluent-bit.md +++ b/docs/user-guide/ingest-data/for-observability/fluent-bit.md @@ -103,7 +103,7 @@ Use a separate output for each signal because GreptimeDB uses signal-specific he - `Match`: The signal-specific tag configured on the corresponding Fluent Bit input. - `http_user` and `http_passwd`: The [authentication credentials](/user-guide/deployments-administration/authentication/static.md) for GreptimeDB. Add them to each output when authentication is enabled. -In this example, the OpenTelemetry OTLP/HTTP API is used. For signal-specific headers and options, see the OpenTelemetry API sections for [metrics](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api), [logs](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api-1), and [traces](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api-2). +In this example, the OpenTelemetry OTLP/HTTP API is used. For signal-specific headers and options, see the OpenTelemetry API sections for [metrics](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api), [logs](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api-1), and [traces](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api-2). The trace output above uses `greptime_trace_v1`; see [trace data model versions](/user-guide/traces/data-model.md#data-model-versioning) to compare it with `greptime_trace_v2`. ## Prometheus Remote Write diff --git a/docs/user-guide/ingest-data/for-observability/opentelemetry.md b/docs/user-guide/ingest-data/for-observability/opentelemetry.md index 15363fb44..c73f0f19a 100644 --- a/docs/user-guide/ingest-data/for-observability/opentelemetry.md +++ b/docs/user-guide/ingest-data/for-observability/opentelemetry.md @@ -398,7 +398,7 @@ To send OpenTelemetry traces data to GreptimeDB through OpenTelemetry SDK librar - `Authorization`: `Basic` authentication. - `X-Greptime-DB-Name`: `` - `X-Greptime-Trace-Table-Name`: `` (optional) - The table name to store the traces. If not provided, the default table name is `opentelemetry_traces`. - - `X-Greptime-Pipeline-Name`: `greptime_trace_v1` or `greptime_trace_v2` (required) - The pipeline name to process the traces. + - `X-Greptime-Pipeline-Name`: `greptime_trace_v1` or `greptime_trace_v2` (required) - The pipeline name to process the traces; see [trace data model versions](/user-guide/traces/data-model.md#data-model-versioning). GreptimeDB accepts **protobuf encoded traces data** via **HTTP protocol**. diff --git a/docs/user-guide/ingest-data/for-observability/otel-collector.md b/docs/user-guide/ingest-data/for-observability/otel-collector.md index 40ace58ef..41d0a3f4f 100644 --- a/docs/user-guide/ingest-data/for-observability/otel-collector.md +++ b/docs/user-guide/ingest-data/for-observability/otel-collector.md @@ -71,9 +71,9 @@ service: In the above configuration, we define a receiver `otlp` that can receive data from OpenTelemetry. We also define three exporters: `otlp_http/traces`, `otlp_http/logs`, and `otlp_http/metrics`, which send data to the OTLP endpoint of GreptimeDB. Based on the OTLP/HTTP protocol, we have added some headers to specify certain parameters, such as `x-greptime-pipeline-name` and `x-greptime-log-table-name`: -* The `x-greptime-pipeline-name` header is used to specify the pipeline name to use, and, -* the `x-greptime-pipeline-params` header is used to pass parameters to the pipeline, and, -* the `x-greptime-log-table-name` header is used to specify the table name in GreptimeDB where the data will be written. +* The `x-greptime-pipeline-name` header selects the pipeline. For traces, see [trace data model versions](/user-guide/traces/data-model.md#data-model-versioning). +* The `x-greptime-pipeline-params` header passes parameters to the pipeline. +* The `x-greptime-log-table-name` header specifies the table name in GreptimeDB where the data will be written. If you have enabled [authentication](/user-guide/deployments-administration/authentication/overview.md) in GreptimeDB, you need to use the `basicauth/client` extension to handle basic authentication. diff --git a/docs/user-guide/protocols/postgresql-copy-in.md b/docs/user-guide/protocols/postgresql-copy-in.md index 548920e3e..1699ded0c 100644 --- a/docs/user-guide/protocols/postgresql-copy-in.md +++ b/docs/user-guide/protocols/postgresql-copy-in.md @@ -132,7 +132,7 @@ with cur.copy("COPY app_logs FROM STDIN WITH (FORMAT otlp, signal 'logs')") as c | `promote_scope_attrs` | Metrics | Boolean, default `false`. Promote scope attributes. | | `translation_strategy` | Metrics | String, default `'UnderscoreEscapingWithSuffixes'`. See [accepted metric and label name translation strategies](/user-guide/ingest-data/for-observability/opentelemetry.md#prometheus-compatibility). | | `table_name` | Logs, traces | String. Overrides the destination, like `x-greptime-log-table-name` or `x-greptime-trace-table-name`. See the routing rules below. | -| `pipeline_name` | Logs, traces | String. Selects a pipeline, like `x-greptime-pipeline-name`. Required for traces; omit for direct log ingestion. | +| `pipeline_name` | Logs, traces | String. Selects a pipeline, like `x-greptime-pipeline-name`. Required for traces; omit for direct log ingestion. See [trace data model versions](/user-guide/traces/data-model.md#data-model-versioning). | | `pipeline_version` | Logs, traces | String. Selects a pipeline version, like `x-greptime-pipeline-version`. | | `pipeline_params` | Logs, traces | String, e.g. `'key1=value1&key2=value2'`. Passes parameters like `x-greptime-pipeline-params`. | | `extract_keys` | Logs | Comma-separated string, e.g. `'host,env'`. Like `x-greptime-log-extract-keys`, extracts attributes during direct log ingestion. New columns are tags; existing columns keep their role (for example, a `host` field remains a field). | diff --git a/docs/user-guide/semantic-layer/declaring-entities.md b/docs/user-guide/semantic-layer/declaring-entities.md index 4e5269ac1..ff88a4a12 100644 --- a/docs/user-guide/semantic-layer/declaring-entities.md +++ b/docs/user-guide/semantic-layer/declaring-entities.md @@ -17,7 +17,8 @@ Conventions ship with the binary and are not configurable. An explicit declarati ### OTLP trace tables -Tables with `table_data_model` set to `greptime_trace_v1` or `greptime_trace_v2` +Tables with `table_data_model` set to the `greptime_trace_v1` or `greptime_trace_v2` +[trace data model](/user-guide/traces/data-model.md#data-model-versioning) receive the following entity declarations without additional entity options. V1 reads flattened attribute columns; v2 reads JSON2 attributes using the same declaration names: diff --git a/docs/user-guide/semantic-layer/table-semantics.md b/docs/user-guide/semantic-layer/table-semantics.md index abdacf5a2..b3c736129 100644 --- a/docs/user-guide/semantic-layer/table-semantics.md +++ b/docs/user-guide/semantic-layer/table-semantics.md @@ -24,7 +24,7 @@ The whitelist is closed: an unrecognized key under the prefix (such as `greptime | `greptime.semantic.signal_type` | The telemetry signal the table represents. | `metric` / `trace` / `log` / `event` / `unknown` | | `greptime.semantic.source` | The ingestion ecosystem that wrote the data. | `opentelemetry` / `prometheus` / `influxdb` / `opentsdb` / `loki` / `elasticsearch` / `custom` / `mixed` / `unknown` | | `greptime.semantic.source_version` | The source protocol version. Stamped by the Prometheus remote write path. | `1.0` / `2.0` | -| `greptime.semantic.pipeline` | The internal ingestion data model. The signal-agnostic successor to `table_data_model`. | `greptime_trace_v1` / `greptime_trace_v2` | +| `greptime.semantic.pipeline` | The internal ingestion data model. The signal-agnostic successor to `table_data_model`; for traces, see [trace data model versions](/user-guide/traces/data-model.md#data-model-versioning). | `greptime_trace_v1` / `greptime_trace_v2` | ### Trace keys @@ -53,7 +53,7 @@ Supported auto-create paths stamp identity (`signal_type` + `source`). OTLP metr | Ingestion path | `signal_type` | `source` | Additional keys | | --- | --- | --- | --- | | OTLP metrics | `metric` | `opentelemetry` | `metric.type`, `metric.unit`, `metric.temporality`, `metric.metadata_quality` = `declared`, `metric.original_name` | -| OTLP traces | `trace` | `opentelemetry` | `pipeline` = `greptime_trace_v1` or `greptime_trace_v2`, `trace.conventions` | +| OTLP traces | `trace` | `opentelemetry` | `pipeline` = `greptime_trace_v1` or `greptime_trace_v2` (see [trace data model versions](/user-guide/traces/data-model.md#data-model-versioning)), `trace.conventions` | | OTLP logs | `log` | `opentelemetry` | — | | Prometheus remote write | `metric` | `prometheus` | `source_version`, `metric.metadata_quality` = `inferred` | | InfluxDB line protocol | `metric` | `influxdb` | identity only | diff --git a/docs/user-guide/traces/read-write.md b/docs/user-guide/traces/read-write.md index 90ea693f8..37a466a2c 100644 --- a/docs/user-guide/traces/read-write.md +++ b/docs/user-guide/traces/read-write.md @@ -97,6 +97,7 @@ exporters: Use a new table to avoid sending v2 data to an existing v1 table. Sending traces as described below automatically creates `opentelemetry_traces_v2` with JSON2 attributes. Use the same headers when writing directly from an SDK. +See [how the trace data models differ](./data-model.md#data-model-versioning). #### Write Trace Data to OpenTelemetry Collector diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/information-schema/table-semantics.md b/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/information-schema/table-semantics.md index 0f4960122..82b6a5dd6 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/information-schema/table-semantics.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/information-schema/table-semantics.md @@ -67,7 +67,7 @@ DESC TABLE information_schema.table_semantics; - `unknown` —— 设置时无法确定。 - `source`:写入数据的来源生态,取值为 `opentelemetry`、`prometheus`、`influxdb`、`opentsdb`、`elasticsearch`、`loki`、`custom`、`mixed`、`unknown` 之一。`mixed` 表示同一张表接收了多个来源的数据,`unknown` 表示无法确定。 - `source_version`:来源协议的版本。Prometheus remote write 路径会写入 `1.0` 或 `2.0`,其他路径为空。 -- `pipeline`:内部摄入数据模型的标识,自由格式字符串。当前仅 OTLP trace 路径会自动设置,根据所选 pipeline 取值为 `greptime_trace_v1` 或 `greptime_trace_v2`;其他取值需手动设置。它是 `table_data_model` 的后继选项,不依赖具体信号类型。 +- `pipeline`:内部摄入数据模型的标识,自由格式字符串。当前仅 OTLP trace 路径会自动设置,根据[所选 Trace Pipeline](/user-guide/traces/data-model.md#数据模型版本机制) 取值为 `greptime_trace_v1` 或 `greptime_trace_v2`;其他取值需手动设置。它是 `table_data_model` 的后继选项,不依赖具体信号类型。 - `metadata_quality`:`metric.type` 标注的来源,即其可信程度,取值为以下之一: - `declared` —— 摄入协议显式提供了 instrument 类型(如 OTLP 指标自带类型),可信。 - `inferred` —— 类型由指标名推断得到(如 Prometheus 的 `_total` 后缀被识别为 counter),对命名不规范的指标可能不准确。 diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/fluent-bit.md b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/fluent-bit.md index 42c2c9b5f..3d1aa159d 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/fluent-bit.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/fluent-bit.md @@ -102,7 +102,7 @@ GreptimeDB 也可以配置为 OpenTelemetry 收集器。使用 Fluent Bit 的 [O - `Match`:在对应 Fluent Bit input 中配置的 signal tag。 - `http_user` 和 `http_passwd`:GreptimeDB 的[认证凭据](/user-guide/deployments-administration/authentication/static.md)。启用鉴权时,请将它们添加到每个 output 中。 -本示例使用的是 OpenTelemetry OTLP/HTTP API。不同 signal 支持的 header 和选项不同,具体请分别参考 OpenTelemetry API 的 [metrics](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api)、[logs](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api-1) 和 [traces](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api-2) 部分。 +本示例使用的是 OpenTelemetry OTLP/HTTP API。不同 signal 支持的 header 和选项不同,具体请分别参考 OpenTelemetry API 的 [metrics](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api)、[logs](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api-1) 和 [traces](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api-2) 部分。上方 traces 示例使用了 `greptime_trace_v1`,它与 `greptime_trace_v2` 的区别请参阅 [Trace 数据模型的版本差异](/user-guide/traces/data-model.md#数据模型版本机制)。 ## Prometheus Remote Write diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/opentelemetry.md b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/opentelemetry.md index 7414906f0..9fb0d3c7e 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/opentelemetry.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/opentelemetry.md @@ -381,7 +381,7 @@ GreptimeDB 支持直接写入 OpenTelemetry 协议的 traces 数据,并内置 - `Authorization`: `Basic` 认证。 - `X-Greptime-DB-Name`: `` - `X-Greptime-Trace-Table-Name`: ``(可选)- 存储 traces 的表名。如果未提供,默认表名为 `opentelemetry_traces`。 - - `X-Greptime-Pipeline-Name`: `greptime_trace_v1` 或 `greptime_trace_v2`(必选)- 处理 traces 的 pipeline 名称。 + - `X-Greptime-Pipeline-Name`: `greptime_trace_v1` 或 `greptime_trace_v2`(必选)- 处理 traces 的 pipeline 名称,详见 [Trace 数据模型的版本差异](/user-guide/traces/data-model.md#数据模型版本机制)。 GreptimeDB 会通过 **HTTP 协议** 接受 **protobuf 编码的 traces 数据**。 @@ -391,7 +391,7 @@ GreptimeDB 会通过 **HTTP 协议** 接受 **protobuf 编码的 traces 数据** ### 数据模型 -Trace 数据模型的表结构、属性存储方式和表选项统一介绍于[Trace 数据模型](/user-guide/traces/data-model.md)。该页分别说明 `greptime_trace_v1` 和 `greptime_trace_v2`。 +Trace 数据模型的表结构、属性存储方式和表选项统一介绍于 [Trace 数据模型](/user-guide/traces/data-model.md)。该页分别说明 `greptime_trace_v1` 和 `greptime_trace_v2`。 ### Schema 演进与 Partial Success diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/otel-collector.md b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/otel-collector.md index a946bee38..5a57b7416 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/otel-collector.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/otel-collector.md @@ -70,9 +70,9 @@ service: 在上面的配置中,我们定义了一个接收器 `otlp`,它可以接收来自 OpenTelemetry 的数据。我们还定义了三个导出器 `otlp_http/traces`、`otlp_http/logs` 和 `otlp_http/metrics`,它们将数据发送到 GreptimeDB 的 OTLP 路径。 -基于 OTLP/HTTP 协议,我们增加了一些 header 用来指定参数,比如 `x-greptime-pipeline-name` 和 `x-greptime-log-table-name`: -* `x-greptime-pipeline-name` 用来指定要使用的 pipeline 名称 -* `x-greptime-pipeline-params` 用来向 pipeline 传入参数 +基于 OTLP/HTTP 协议,我们增加了一些 header 用来指定参数,比如 `x-greptime-pipeline-name` 和 `x-greptime-log-table-name`: +* `x-greptime-pipeline-name` 用来指定要使用的 pipeline 名称。写入 traces 数据时,可参考 [Trace 数据模型的版本差异](/user-guide/traces/data-model.md#数据模型版本机制)。 +* `x-greptime-pipeline-params` 用来向 pipeline 传入参数。 * `x-greptime-log-table-name` 用来指定数据将要写入 GreptimeDB 的表名。 如果你在 GreptimeDB 设置了[鉴权](/user-guide/deployments-administration/authentication/overview.md)。则需要使用 `basicauth/client` 扩展来处理基本的身份验证。 diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/protocols/postgresql-copy-in.md b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/protocols/postgresql-copy-in.md index b94fc03e9..cd2344dbd 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/protocols/postgresql-copy-in.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/protocols/postgresql-copy-in.md @@ -132,7 +132,7 @@ with cur.copy("COPY app_logs FROM STDIN WITH (FORMAT otlp, signal 'logs')") as c | `promote_scope_attrs` | 指标 | 布尔值,默认 `false`。指定是否保留 scope 属性。 | | `translation_strategy` | 指标 | 字符串,默认 `'UnderscoreEscapingWithSuffixes'`。可选值见[指标和标签名称的转换策略](/user-guide/ingest-data/for-observability/opentelemetry.md#兼容-prometheus)。 | | `table_name` | 日志、链路 | 字符串。覆盖目标表名,对应 `x-greptime-log-table-name` 或 `x-greptime-trace-table-name`。目标表的选择规则见下文。 | -| `pipeline_name` | 日志、链路 | 字符串。选择 Pipeline,对应 `x-greptime-pipeline-name`。写入链路时必须指定;直接写入日志时可省略。 | +| `pipeline_name` | 日志、链路 | 字符串。选择 Pipeline,对应 `x-greptime-pipeline-name`。写入链路时必须指定;直接写入日志时可省略。链路 Pipeline 的选择请参阅 [Trace 数据模型的版本差异](/user-guide/traces/data-model.md#数据模型版本机制)。 | | `pipeline_version` | 日志、链路 | 字符串。选择 Pipeline 版本,对应 `x-greptime-pipeline-version`。 | | `pipeline_params` | 日志、链路 | 字符串,例如 `'key1=value1&key2=value2'`。传递 Pipeline 参数,对应 `x-greptime-pipeline-params`。 | | `extract_keys` | 日志 | 用逗号分隔的字符串,例如 `'host,env'`。对应 `x-greptime-log-extract-keys`,在直接写入日志时提取指定属性。新建的列为标签列;已有列保留原有角色,例如已有的 `host` 字段列不会变成标签列。 | diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/semantic-layer/declaring-entities.md b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/semantic-layer/declaring-entities.md index 4a7e76a46..5b262c605 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/semantic-layer/declaring-entities.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/semantic-layer/declaring-entities.md @@ -17,7 +17,7 @@ description: 哪些数据无需配置即可进入语义图、如何在自己的 ### OTLP trace 表 -`table_data_model` 为 `greptime_trace_v1` 或 `greptime_trace_v2` 的表都会自动获得以下实体声明,无需额外的实体选项。v1 从打平的属性列读取值;v2 从 JSON2 属性中读取值,使用相同的声明名称: +`table_data_model` 为 `greptime_trace_v1` 或 `greptime_trace_v2`(见 [Trace 数据模型的版本差异](/user-guide/traces/data-model.md#数据模型版本机制))的表都会自动获得以下实体声明,无需额外的实体选项。v1 从打平的属性列读取值;v2 从 JSON2 属性中读取值,使用相同的声明名称: | 实体 | 标识列 | 描述列 | | --- | --- | --- | diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/semantic-layer/table-semantics.md b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/semantic-layer/table-semantics.md index 277c39348..dc238651d 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/semantic-layer/table-semantics.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/semantic-layer/table-semantics.md @@ -24,7 +24,7 @@ description: greptime.semantic.* 表选项、接入时如何自动写入、如 | `greptime.semantic.signal_type` | 表所代表的遥测信号类型。 | `metric` / `trace` / `log` / `event` / `unknown` | | `greptime.semantic.source` | 写入数据的接入生态。 | `opentelemetry` / `prometheus` / `influxdb` / `opentsdb` / `loki` / `elasticsearch` / `custom` / `mixed` / `unknown` | | `greptime.semantic.source_version` | 来源协议的版本,由 Prometheus remote write 路径写入。 | `1.0` / `2.0` | -| `greptime.semantic.pipeline` | 内部接入数据模型。它是 `table_data_model` 的后继选项,不依赖具体信号类型。 | `greptime_trace_v1` / `greptime_trace_v2` | +| `greptime.semantic.pipeline` | 内部接入数据模型。它是 `table_data_model` 的后继选项,不依赖具体信号类型;Trace 取值见 [Trace 数据模型的版本差异](/user-guide/traces/data-model.md#数据模型版本机制)。 | `greptime_trace_v1` / `greptime_trace_v2` | ### Trace key @@ -53,7 +53,7 @@ description: greptime.semantic.* 表选项、接入时如何自动写入、如 | 接入路径 | `signal_type` | `source` | 额外 key | | --- | --- | --- | --- | | OTLP metrics | `metric` | `opentelemetry` | `metric.type`、`metric.unit`、`metric.temporality`、`metric.metadata_quality` = `declared`、`metric.original_name` | -| OTLP traces | `trace` | `opentelemetry` | `pipeline` = `greptime_trace_v1` 或 `greptime_trace_v2`、`trace.conventions` | +| OTLP traces | `trace` | `opentelemetry` | `pipeline` = `greptime_trace_v1` 或 `greptime_trace_v2`(见 [Trace 数据模型的版本差异](/user-guide/traces/data-model.md#数据模型版本机制))、`trace.conventions` | | OTLP logs | `log` | `opentelemetry` | — | | Prometheus remote write | `metric` | `prometheus` | `source_version`、`metric.metadata_quality` = `inferred` | | InfluxDB line protocol | `metric` | `influxdb` | 仅身份 | diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/traces/read-write.md b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/traces/read-write.md index c28d58ac8..e14eb82d5 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/traces/read-write.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/traces/read-write.md @@ -92,6 +92,7 @@ exporters: 请使用新表,避免向已有 v1 表写入 v2 数据。按下文发送 Trace 后,GreptimeDB 会自动 创建 `opentelemetry_traces_v2`,并将属性存储为 JSON2。SDK 直接写入时也使用相同的请求头。 +两个模型的差异请参阅[数据模型版本机制](./data-model.md#数据模型版本机制)。 #### 将 Trace 数据写入到 OpenTelemetry Collector @@ -133,7 +134,7 @@ GreptimeDB 的 OTEL 端点支持 Basic 认证。详情请参考 [鉴权](/user-g 在 OTLP 接口中,我们要求 HTTP 头 `x-greptime-pipeline-name` 作为必选参数。在这里 我们复用了日志接口中 Pipeline 的概念作为数据转化的机制。Trace 数据应使用内置的 `greptime_trace_v1`(打平属性列)或 `greptime_trace_v2`(JSON2 属性)。 -有关模型差异和表选项,请参阅[Trace 数据模型](./data-model.md)。切换模型时请使用独立的表。 +有关模型差异和表选项,请参阅 [Trace 数据模型](./data-model.md)。切换模型时请使用独立的表。 自定义的 Pipeline 暂不支持。 ### Append-only 模式 diff --git a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/reference/sql/information-schema/table-semantics.md b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/reference/sql/information-schema/table-semantics.md index 0f4960122..82b6a5dd6 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/reference/sql/information-schema/table-semantics.md +++ b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/reference/sql/information-schema/table-semantics.md @@ -67,7 +67,7 @@ DESC TABLE information_schema.table_semantics; - `unknown` —— 设置时无法确定。 - `source`:写入数据的来源生态,取值为 `opentelemetry`、`prometheus`、`influxdb`、`opentsdb`、`elasticsearch`、`loki`、`custom`、`mixed`、`unknown` 之一。`mixed` 表示同一张表接收了多个来源的数据,`unknown` 表示无法确定。 - `source_version`:来源协议的版本。Prometheus remote write 路径会写入 `1.0` 或 `2.0`,其他路径为空。 -- `pipeline`:内部摄入数据模型的标识,自由格式字符串。当前仅 OTLP trace 路径会自动设置,根据所选 pipeline 取值为 `greptime_trace_v1` 或 `greptime_trace_v2`;其他取值需手动设置。它是 `table_data_model` 的后继选项,不依赖具体信号类型。 +- `pipeline`:内部摄入数据模型的标识,自由格式字符串。当前仅 OTLP trace 路径会自动设置,根据[所选 Trace Pipeline](/user-guide/traces/data-model.md#数据模型版本机制) 取值为 `greptime_trace_v1` 或 `greptime_trace_v2`;其他取值需手动设置。它是 `table_data_model` 的后继选项,不依赖具体信号类型。 - `metadata_quality`:`metric.type` 标注的来源,即其可信程度,取值为以下之一: - `declared` —— 摄入协议显式提供了 instrument 类型(如 OTLP 指标自带类型),可信。 - `inferred` —— 类型由指标名推断得到(如 Prometheus 的 `_total` 后缀被识别为 counter),对命名不规范的指标可能不准确。 diff --git a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/ingest-data/for-observability/fluent-bit.md b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/ingest-data/for-observability/fluent-bit.md index 42c2c9b5f..3d1aa159d 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/ingest-data/for-observability/fluent-bit.md +++ b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/ingest-data/for-observability/fluent-bit.md @@ -102,7 +102,7 @@ GreptimeDB 也可以配置为 OpenTelemetry 收集器。使用 Fluent Bit 的 [O - `Match`:在对应 Fluent Bit input 中配置的 signal tag。 - `http_user` 和 `http_passwd`:GreptimeDB 的[认证凭据](/user-guide/deployments-administration/authentication/static.md)。启用鉴权时,请将它们添加到每个 output 中。 -本示例使用的是 OpenTelemetry OTLP/HTTP API。不同 signal 支持的 header 和选项不同,具体请分别参考 OpenTelemetry API 的 [metrics](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api)、[logs](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api-1) 和 [traces](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api-2) 部分。 +本示例使用的是 OpenTelemetry OTLP/HTTP API。不同 signal 支持的 header 和选项不同,具体请分别参考 OpenTelemetry API 的 [metrics](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api)、[logs](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api-1) 和 [traces](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api-2) 部分。上方 traces 示例使用了 `greptime_trace_v1`,它与 `greptime_trace_v2` 的区别请参阅 [Trace 数据模型的版本差异](/user-guide/traces/data-model.md#数据模型版本机制)。 ## Prometheus Remote Write diff --git a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/ingest-data/for-observability/opentelemetry.md b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/ingest-data/for-observability/opentelemetry.md index 4f50f0448..bae979191 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/ingest-data/for-observability/opentelemetry.md +++ b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/ingest-data/for-observability/opentelemetry.md @@ -336,7 +336,7 @@ GreptimeDB 支持直接写入 OpenTelemetry 协议的 traces 数据,并内置 - `Authorization`: `Basic` 认证。 - `X-Greptime-DB-Name`: `` - `X-Greptime-Trace-Table-Name`: ``(可选)- 存储 traces 的表名。如果未提供,默认表名为 `opentelemetry_traces`。 - - `X-Greptime-Pipeline-Name`: `greptime_trace_v1` 或 `greptime_trace_v2`(必选)- 处理 traces 的 pipeline 名称。 + - `X-Greptime-Pipeline-Name`: `greptime_trace_v1` 或 `greptime_trace_v2`(必选)- 处理 traces 的 pipeline 名称,详见 [Trace 数据模型的版本差异](/user-guide/traces/data-model.md#数据模型版本机制)。 GreptimeDB 会通过 **HTTP 协议** 接受 **protobuf 编码的 traces 数据**。 @@ -346,7 +346,7 @@ GreptimeDB 会通过 **HTTP 协议** 接受 **protobuf 编码的 traces 数据** ### 数据模型 -Trace 数据模型的表结构、属性存储方式和表选项统一介绍于[Trace 数据模型](/user-guide/traces/data-model.md)。该页分别说明 `greptime_trace_v1` 和 `greptime_trace_v2`。 +Trace 数据模型的表结构、属性存储方式和表选项统一介绍于 [Trace 数据模型](/user-guide/traces/data-model.md)。该页分别说明 `greptime_trace_v1` 和 `greptime_trace_v2`。 ### Schema 演进与 Partial Success diff --git a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/ingest-data/for-observability/otel-collector.md b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/ingest-data/for-observability/otel-collector.md index a946bee38..5a57b7416 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/ingest-data/for-observability/otel-collector.md +++ b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/ingest-data/for-observability/otel-collector.md @@ -70,9 +70,9 @@ service: 在上面的配置中,我们定义了一个接收器 `otlp`,它可以接收来自 OpenTelemetry 的数据。我们还定义了三个导出器 `otlp_http/traces`、`otlp_http/logs` 和 `otlp_http/metrics`,它们将数据发送到 GreptimeDB 的 OTLP 路径。 -基于 OTLP/HTTP 协议,我们增加了一些 header 用来指定参数,比如 `x-greptime-pipeline-name` 和 `x-greptime-log-table-name`: -* `x-greptime-pipeline-name` 用来指定要使用的 pipeline 名称 -* `x-greptime-pipeline-params` 用来向 pipeline 传入参数 +基于 OTLP/HTTP 协议,我们增加了一些 header 用来指定参数,比如 `x-greptime-pipeline-name` 和 `x-greptime-log-table-name`: +* `x-greptime-pipeline-name` 用来指定要使用的 pipeline 名称。写入 traces 数据时,可参考 [Trace 数据模型的版本差异](/user-guide/traces/data-model.md#数据模型版本机制)。 +* `x-greptime-pipeline-params` 用来向 pipeline 传入参数。 * `x-greptime-log-table-name` 用来指定数据将要写入 GreptimeDB 的表名。 如果你在 GreptimeDB 设置了[鉴权](/user-guide/deployments-administration/authentication/overview.md)。则需要使用 `basicauth/client` 扩展来处理基本的身份验证。 diff --git a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/semantic-layer/declaring-entities.md b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/semantic-layer/declaring-entities.md index 4a7e76a46..5b262c605 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/semantic-layer/declaring-entities.md +++ b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/semantic-layer/declaring-entities.md @@ -17,7 +17,7 @@ description: 哪些数据无需配置即可进入语义图、如何在自己的 ### OTLP trace 表 -`table_data_model` 为 `greptime_trace_v1` 或 `greptime_trace_v2` 的表都会自动获得以下实体声明,无需额外的实体选项。v1 从打平的属性列读取值;v2 从 JSON2 属性中读取值,使用相同的声明名称: +`table_data_model` 为 `greptime_trace_v1` 或 `greptime_trace_v2`(见 [Trace 数据模型的版本差异](/user-guide/traces/data-model.md#数据模型版本机制))的表都会自动获得以下实体声明,无需额外的实体选项。v1 从打平的属性列读取值;v2 从 JSON2 属性中读取值,使用相同的声明名称: | 实体 | 标识列 | 描述列 | | --- | --- | --- | diff --git a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/semantic-layer/table-semantics.md b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/semantic-layer/table-semantics.md index 277c39348..dc238651d 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/semantic-layer/table-semantics.md +++ b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/semantic-layer/table-semantics.md @@ -24,7 +24,7 @@ description: greptime.semantic.* 表选项、接入时如何自动写入、如 | `greptime.semantic.signal_type` | 表所代表的遥测信号类型。 | `metric` / `trace` / `log` / `event` / `unknown` | | `greptime.semantic.source` | 写入数据的接入生态。 | `opentelemetry` / `prometheus` / `influxdb` / `opentsdb` / `loki` / `elasticsearch` / `custom` / `mixed` / `unknown` | | `greptime.semantic.source_version` | 来源协议的版本,由 Prometheus remote write 路径写入。 | `1.0` / `2.0` | -| `greptime.semantic.pipeline` | 内部接入数据模型。它是 `table_data_model` 的后继选项,不依赖具体信号类型。 | `greptime_trace_v1` / `greptime_trace_v2` | +| `greptime.semantic.pipeline` | 内部接入数据模型。它是 `table_data_model` 的后继选项,不依赖具体信号类型;Trace 取值见 [Trace 数据模型的版本差异](/user-guide/traces/data-model.md#数据模型版本机制)。 | `greptime_trace_v1` / `greptime_trace_v2` | ### Trace key @@ -53,7 +53,7 @@ description: greptime.semantic.* 表选项、接入时如何自动写入、如 | 接入路径 | `signal_type` | `source` | 额外 key | | --- | --- | --- | --- | | OTLP metrics | `metric` | `opentelemetry` | `metric.type`、`metric.unit`、`metric.temporality`、`metric.metadata_quality` = `declared`、`metric.original_name` | -| OTLP traces | `trace` | `opentelemetry` | `pipeline` = `greptime_trace_v1` 或 `greptime_trace_v2`、`trace.conventions` | +| OTLP traces | `trace` | `opentelemetry` | `pipeline` = `greptime_trace_v1` 或 `greptime_trace_v2`(见 [Trace 数据模型的版本差异](/user-guide/traces/data-model.md#数据模型版本机制))、`trace.conventions` | | OTLP logs | `log` | `opentelemetry` | — | | Prometheus remote write | `metric` | `prometheus` | `source_version`、`metric.metadata_quality` = `inferred` | | InfluxDB line protocol | `metric` | `influxdb` | 仅身份 | diff --git a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/traces/read-write.md b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/traces/read-write.md index c28d58ac8..e14eb82d5 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/traces/read-write.md +++ b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/traces/read-write.md @@ -92,6 +92,7 @@ exporters: 请使用新表,避免向已有 v1 表写入 v2 数据。按下文发送 Trace 后,GreptimeDB 会自动 创建 `opentelemetry_traces_v2`,并将属性存储为 JSON2。SDK 直接写入时也使用相同的请求头。 +两个模型的差异请参阅[数据模型版本机制](./data-model.md#数据模型版本机制)。 #### 将 Trace 数据写入到 OpenTelemetry Collector @@ -133,7 +134,7 @@ GreptimeDB 的 OTEL 端点支持 Basic 认证。详情请参考 [鉴权](/user-g 在 OTLP 接口中,我们要求 HTTP 头 `x-greptime-pipeline-name` 作为必选参数。在这里 我们复用了日志接口中 Pipeline 的概念作为数据转化的机制。Trace 数据应使用内置的 `greptime_trace_v1`(打平属性列)或 `greptime_trace_v2`(JSON2 属性)。 -有关模型差异和表选项,请参阅[Trace 数据模型](./data-model.md)。切换模型时请使用独立的表。 +有关模型差异和表选项,请参阅 [Trace 数据模型](./data-model.md)。切换模型时请使用独立的表。 自定义的 Pipeline 暂不支持。 ### Append-only 模式 diff --git a/versioned_docs/version-1.3/reference/sql/information-schema/table-semantics.md b/versioned_docs/version-1.3/reference/sql/information-schema/table-semantics.md index 985b77cdf..83a871965 100644 --- a/versioned_docs/version-1.3/reference/sql/information-schema/table-semantics.md +++ b/versioned_docs/version-1.3/reference/sql/information-schema/table-semantics.md @@ -67,7 +67,7 @@ The output is as follows: - `unknown` — could not be determined when the option was stamped. - `source`: The ingestion ecosystem that wrote the data. One of `opentelemetry`, `prometheus`, `influxdb`, `opentsdb`, `elasticsearch`, `loki`, `custom`, `mixed`, or `unknown`. `mixed` means one table received data from more than one source; `unknown` means it could not be determined. - `source_version`: The version of the source protocol. The Prometheus remote write path stamps `1.0` or `2.0`; other paths leave it empty. -- `pipeline`: A free-form identifier of the internal ingestion data model. Today the OTLP trace path stamps `greptime_trace_v1` or `greptime_trace_v2`, depending on the selected pipeline; other values can be set manually. It is the signal-agnostic successor to the `table_data_model` option. +- `pipeline`: A free-form identifier of the internal ingestion data model. Today the OTLP trace path stamps `greptime_trace_v1` or `greptime_trace_v2`, depending on the [selected trace pipeline](/user-guide/traces/data-model.md#data-model-versioning); other values can be set manually. It is the signal-agnostic successor to the `table_data_model` option. - `metadata_quality`: How the metric type metadata was obtained — that is, how much you can trust the `metric.type` value. One of: - `declared` — the ingestion protocol stated the instrument type explicitly (for example OTLP metrics carry the type). Trustworthy. - `inferred` — the type was guessed from the metric name (for example a Prometheus `_total` suffix is read as a counter). May be wrong for non-conventional names. diff --git a/versioned_docs/version-1.3/user-guide/ingest-data/for-observability/fluent-bit.md b/versioned_docs/version-1.3/user-guide/ingest-data/for-observability/fluent-bit.md index d9c05c153..d225a47d5 100644 --- a/versioned_docs/version-1.3/user-guide/ingest-data/for-observability/fluent-bit.md +++ b/versioned_docs/version-1.3/user-guide/ingest-data/for-observability/fluent-bit.md @@ -103,7 +103,7 @@ Use a separate output for each signal because GreptimeDB uses signal-specific he - `Match`: The signal-specific tag configured on the corresponding Fluent Bit input. - `http_user` and `http_passwd`: The [authentication credentials](/user-guide/deployments-administration/authentication/static.md) for GreptimeDB. Add them to each output when authentication is enabled. -In this example, the OpenTelemetry OTLP/HTTP API is used. For signal-specific headers and options, see the OpenTelemetry API sections for [metrics](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api), [logs](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api-1), and [traces](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api-2). +In this example, the OpenTelemetry OTLP/HTTP API is used. For signal-specific headers and options, see the OpenTelemetry API sections for [metrics](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api), [logs](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api-1), and [traces](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api-2). The trace output above uses `greptime_trace_v1`; see [trace data model versions](/user-guide/traces/data-model.md#data-model-versioning) to compare it with `greptime_trace_v2`. ## Prometheus Remote Write diff --git a/versioned_docs/version-1.3/user-guide/ingest-data/for-observability/opentelemetry.md b/versioned_docs/version-1.3/user-guide/ingest-data/for-observability/opentelemetry.md index e55f86c12..fd180a0a9 100644 --- a/versioned_docs/version-1.3/user-guide/ingest-data/for-observability/opentelemetry.md +++ b/versioned_docs/version-1.3/user-guide/ingest-data/for-observability/opentelemetry.md @@ -346,7 +346,7 @@ To send OpenTelemetry traces data to GreptimeDB through OpenTelemetry SDK librar - `Authorization`: `Basic` authentication. - `X-Greptime-DB-Name`: `` - `X-Greptime-Trace-Table-Name`: `` (optional) - The table name to store the traces. If not provided, the default table name is `opentelemetry_traces`. - - `X-Greptime-Pipeline-Name`: `greptime_trace_v1` or `greptime_trace_v2` (required) - The pipeline name to process the traces. + - `X-Greptime-Pipeline-Name`: `greptime_trace_v1` or `greptime_trace_v2` (required) - The pipeline name to process the traces; see [trace data model versions](/user-guide/traces/data-model.md#data-model-versioning). GreptimeDB accepts **protobuf encoded traces data** via **HTTP protocol**. diff --git a/versioned_docs/version-1.3/user-guide/ingest-data/for-observability/otel-collector.md b/versioned_docs/version-1.3/user-guide/ingest-data/for-observability/otel-collector.md index 40ace58ef..41d0a3f4f 100644 --- a/versioned_docs/version-1.3/user-guide/ingest-data/for-observability/otel-collector.md +++ b/versioned_docs/version-1.3/user-guide/ingest-data/for-observability/otel-collector.md @@ -71,9 +71,9 @@ service: In the above configuration, we define a receiver `otlp` that can receive data from OpenTelemetry. We also define three exporters: `otlp_http/traces`, `otlp_http/logs`, and `otlp_http/metrics`, which send data to the OTLP endpoint of GreptimeDB. Based on the OTLP/HTTP protocol, we have added some headers to specify certain parameters, such as `x-greptime-pipeline-name` and `x-greptime-log-table-name`: -* The `x-greptime-pipeline-name` header is used to specify the pipeline name to use, and, -* the `x-greptime-pipeline-params` header is used to pass parameters to the pipeline, and, -* the `x-greptime-log-table-name` header is used to specify the table name in GreptimeDB where the data will be written. +* The `x-greptime-pipeline-name` header selects the pipeline. For traces, see [trace data model versions](/user-guide/traces/data-model.md#data-model-versioning). +* The `x-greptime-pipeline-params` header passes parameters to the pipeline. +* The `x-greptime-log-table-name` header specifies the table name in GreptimeDB where the data will be written. If you have enabled [authentication](/user-guide/deployments-administration/authentication/overview.md) in GreptimeDB, you need to use the `basicauth/client` extension to handle basic authentication. diff --git a/versioned_docs/version-1.3/user-guide/semantic-layer/declaring-entities.md b/versioned_docs/version-1.3/user-guide/semantic-layer/declaring-entities.md index 4e5269ac1..ff88a4a12 100644 --- a/versioned_docs/version-1.3/user-guide/semantic-layer/declaring-entities.md +++ b/versioned_docs/version-1.3/user-guide/semantic-layer/declaring-entities.md @@ -17,7 +17,8 @@ Conventions ship with the binary and are not configurable. An explicit declarati ### OTLP trace tables -Tables with `table_data_model` set to `greptime_trace_v1` or `greptime_trace_v2` +Tables with `table_data_model` set to the `greptime_trace_v1` or `greptime_trace_v2` +[trace data model](/user-guide/traces/data-model.md#data-model-versioning) receive the following entity declarations without additional entity options. V1 reads flattened attribute columns; v2 reads JSON2 attributes using the same declaration names: diff --git a/versioned_docs/version-1.3/user-guide/semantic-layer/table-semantics.md b/versioned_docs/version-1.3/user-guide/semantic-layer/table-semantics.md index abdacf5a2..b3c736129 100644 --- a/versioned_docs/version-1.3/user-guide/semantic-layer/table-semantics.md +++ b/versioned_docs/version-1.3/user-guide/semantic-layer/table-semantics.md @@ -24,7 +24,7 @@ The whitelist is closed: an unrecognized key under the prefix (such as `greptime | `greptime.semantic.signal_type` | The telemetry signal the table represents. | `metric` / `trace` / `log` / `event` / `unknown` | | `greptime.semantic.source` | The ingestion ecosystem that wrote the data. | `opentelemetry` / `prometheus` / `influxdb` / `opentsdb` / `loki` / `elasticsearch` / `custom` / `mixed` / `unknown` | | `greptime.semantic.source_version` | The source protocol version. Stamped by the Prometheus remote write path. | `1.0` / `2.0` | -| `greptime.semantic.pipeline` | The internal ingestion data model. The signal-agnostic successor to `table_data_model`. | `greptime_trace_v1` / `greptime_trace_v2` | +| `greptime.semantic.pipeline` | The internal ingestion data model. The signal-agnostic successor to `table_data_model`; for traces, see [trace data model versions](/user-guide/traces/data-model.md#data-model-versioning). | `greptime_trace_v1` / `greptime_trace_v2` | ### Trace keys @@ -53,7 +53,7 @@ Supported auto-create paths stamp identity (`signal_type` + `source`). OTLP metr | Ingestion path | `signal_type` | `source` | Additional keys | | --- | --- | --- | --- | | OTLP metrics | `metric` | `opentelemetry` | `metric.type`, `metric.unit`, `metric.temporality`, `metric.metadata_quality` = `declared`, `metric.original_name` | -| OTLP traces | `trace` | `opentelemetry` | `pipeline` = `greptime_trace_v1` or `greptime_trace_v2`, `trace.conventions` | +| OTLP traces | `trace` | `opentelemetry` | `pipeline` = `greptime_trace_v1` or `greptime_trace_v2` (see [trace data model versions](/user-guide/traces/data-model.md#data-model-versioning)), `trace.conventions` | | OTLP logs | `log` | `opentelemetry` | — | | Prometheus remote write | `metric` | `prometheus` | `source_version`, `metric.metadata_quality` = `inferred` | | InfluxDB line protocol | `metric` | `influxdb` | identity only | diff --git a/versioned_docs/version-1.3/user-guide/traces/read-write.md b/versioned_docs/version-1.3/user-guide/traces/read-write.md index 90ea693f8..37a466a2c 100644 --- a/versioned_docs/version-1.3/user-guide/traces/read-write.md +++ b/versioned_docs/version-1.3/user-guide/traces/read-write.md @@ -97,6 +97,7 @@ exporters: Use a new table to avoid sending v2 data to an existing v1 table. Sending traces as described below automatically creates `opentelemetry_traces_v2` with JSON2 attributes. Use the same headers when writing directly from an SDK. +See [how the trace data models differ](./data-model.md#data-model-versioning). #### Write Trace Data to OpenTelemetry Collector From d4a496e290197eeda1161bee84b030cebc02ec52 Mon Sep 17 00:00:00 2001 From: shuiyisong Date: Wed, 25 Nov 2026 18:52:33 +0800 Subject: [PATCH 2/4] docs: default trace examples to v2 Signed-off-by: shuiyisong --- docs/greptimecloud/integrations/otlp.md | 2 +- .../sql/information-schema/table-semantics.md | 2 +- .../for-observability/fluent-bit.md | 4 +- .../for-observability/opentelemetry.md | 6 +- .../for-observability/otel-collector.md | 2 +- docs/user-guide/integrations/grafana.md | 27 ++--- .../semantic-layer/declaring-entities.md | 6 +- .../semantic-layer/table-semantics.md | 4 +- docs/user-guide/traces/data-model.md | 22 ++-- docs/user-guide/traces/read-write.md | 101 ++++++++++-------- .../greptimecloud/integrations/otlp.md | 2 +- .../sql/information-schema/table-semantics.md | 2 +- .../for-observability/fluent-bit.md | 4 +- .../for-observability/opentelemetry.md | 6 +- .../for-observability/otel-collector.md | 2 +- .../user-guide/integrations/grafana.md | 21 ++-- .../semantic-layer/declaring-entities.md | 2 +- .../semantic-layer/table-semantics.md | 4 +- .../current/user-guide/traces/data-model.md | 15 +-- .../current/user-guide/traces/read-write.md | 88 ++++++++------- .../greptimecloud/integrations/otlp.md | 2 +- .../sql/information-schema/table-semantics.md | 2 +- .../for-observability/fluent-bit.md | 4 +- .../for-observability/opentelemetry.md | 6 +- .../for-observability/otel-collector.md | 2 +- .../user-guide/integrations/grafana.md | 21 ++-- .../semantic-layer/declaring-entities.md | 2 +- .../semantic-layer/table-semantics.md | 4 +- .../user-guide/traces/data-model.md | 13 +-- .../user-guide/traces/read-write.md | 88 ++++++++------- .../greptimecloud/integrations/otlp.md | 2 +- .../sql/information-schema/table-semantics.md | 2 +- .../for-observability/fluent-bit.md | 4 +- .../for-observability/opentelemetry.md | 6 +- .../for-observability/otel-collector.md | 2 +- .../user-guide/integrations/grafana.md | 27 ++--- .../semantic-layer/declaring-entities.md | 6 +- .../semantic-layer/table-semantics.md | 4 +- .../user-guide/traces/data-model.md | 20 ++-- .../user-guide/traces/read-write.md | 101 ++++++++++-------- 40 files changed, 346 insertions(+), 294 deletions(-) diff --git a/docs/greptimecloud/integrations/otlp.md b/docs/greptimecloud/integrations/otlp.md index 5c3de2d26..92289fdb7 100644 --- a/docs/greptimecloud/integrations/otlp.md +++ b/docs/greptimecloud/integrations/otlp.md @@ -44,7 +44,7 @@ exporters: authenticator: basicauth/client headers: x-greptime-db-name: '' - x-greptime-pipeline-name: 'greptime_trace_v1' + x-greptime-pipeline-name: 'greptime_trace_v2' otlphttp/logs: endpoint: 'https:///v1/otlp' auth: diff --git a/docs/reference/sql/information-schema/table-semantics.md b/docs/reference/sql/information-schema/table-semantics.md index 83a871965..209771761 100644 --- a/docs/reference/sql/information-schema/table-semantics.md +++ b/docs/reference/sql/information-schema/table-semantics.md @@ -67,7 +67,7 @@ The output is as follows: - `unknown` — could not be determined when the option was stamped. - `source`: The ingestion ecosystem that wrote the data. One of `opentelemetry`, `prometheus`, `influxdb`, `opentsdb`, `elasticsearch`, `loki`, `custom`, `mixed`, or `unknown`. `mixed` means one table received data from more than one source; `unknown` means it could not be determined. - `source_version`: The version of the source protocol. The Prometheus remote write path stamps `1.0` or `2.0`; other paths leave it empty. -- `pipeline`: A free-form identifier of the internal ingestion data model. Today the OTLP trace path stamps `greptime_trace_v1` or `greptime_trace_v2`, depending on the [selected trace pipeline](/user-guide/traces/data-model.md#data-model-versioning); other values can be set manually. It is the signal-agnostic successor to the `table_data_model` option. +- `pipeline`: A free-form identifier of the internal ingestion data model. Today the OTLP trace path stamps `greptime_trace_v2` or `greptime_trace_v1`, depending on the [selected trace pipeline](/user-guide/traces/data-model.md#data-model-versioning); other values can be set manually. It is the signal-agnostic successor to the `table_data_model` option. - `metadata_quality`: How the metric type metadata was obtained — that is, how much you can trust the `metric.type` value. One of: - `declared` — the ingestion protocol stated the instrument type explicitly (for example OTLP metrics carry the type). Trustworthy. - `inferred` — the type was guessed from the metric name (for example a Prometheus `_total` suffix is read as a counter). May be wrong for non-conventional names. diff --git a/docs/user-guide/ingest-data/for-observability/fluent-bit.md b/docs/user-guide/ingest-data/for-observability/fluent-bit.md index d225a47d5..3e8b9e6ff 100644 --- a/docs/user-guide/ingest-data/for-observability/fluent-bit.md +++ b/docs/user-guide/ingest-data/for-observability/fluent-bit.md @@ -95,7 +95,7 @@ Use a separate output for each signal because GreptimeDB uses signal-specific he Log_response_payload True Tls Off Tls.verify Off - Header X-Greptime-Pipeline-Name greptime_trace_v1 + Header X-Greptime-Pipeline-Name greptime_trace_v2 Header X-Greptime-DB-Name ``` @@ -103,7 +103,7 @@ Use a separate output for each signal because GreptimeDB uses signal-specific he - `Match`: The signal-specific tag configured on the corresponding Fluent Bit input. - `http_user` and `http_passwd`: The [authentication credentials](/user-guide/deployments-administration/authentication/static.md) for GreptimeDB. Add them to each output when authentication is enabled. -In this example, the OpenTelemetry OTLP/HTTP API is used. For signal-specific headers and options, see the OpenTelemetry API sections for [metrics](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api), [logs](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api-1), and [traces](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api-2). The trace output above uses `greptime_trace_v1`; see [trace data model versions](/user-guide/traces/data-model.md#data-model-versioning) to compare it with `greptime_trace_v2`. +In this example, the OpenTelemetry OTLP/HTTP API is used. For signal-specific headers and options, see the OpenTelemetry API sections for [metrics](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api), [logs](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api-1), and [traces](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api-2). The trace output above uses `greptime_trace_v2`; see [trace data model versions](/user-guide/traces/data-model.md#data-model-versioning) to compare it with `greptime_trace_v1`. ## Prometheus Remote Write diff --git a/docs/user-guide/ingest-data/for-observability/opentelemetry.md b/docs/user-guide/ingest-data/for-observability/opentelemetry.md index c73f0f19a..202823ec7 100644 --- a/docs/user-guide/ingest-data/for-observability/opentelemetry.md +++ b/docs/user-guide/ingest-data/for-observability/opentelemetry.md @@ -398,7 +398,7 @@ To send OpenTelemetry traces data to GreptimeDB through OpenTelemetry SDK librar - `Authorization`: `Basic` authentication. - `X-Greptime-DB-Name`: `` - `X-Greptime-Trace-Table-Name`: `` (optional) - The table name to store the traces. If not provided, the default table name is `opentelemetry_traces`. - - `X-Greptime-Pipeline-Name`: `greptime_trace_v1` or `greptime_trace_v2` (required) - The pipeline name to process the traces; see [trace data model versions](/user-guide/traces/data-model.md#data-model-versioning). + - `X-Greptime-Pipeline-Name`: `greptime_trace_v2` or `greptime_trace_v1` (required) - The pipeline name to process the traces; see [trace data model versions](/user-guide/traces/data-model.md#data-model-versioning). GreptimeDB accepts **protobuf encoded traces data** via **HTTP protocol**. @@ -409,11 +409,11 @@ You can directly send OpenTelemetry traces data to GreptimeDB, or use OpenTeleme ### Data Model See [Trace Data Modeling](/user-guide/traces/data-model.md) for table schemas, -attribute storage, and table options for `greptime_trace_v1` and `greptime_trace_v2`. +attribute storage, and table options for `greptime_trace_v2` and `greptime_trace_v1`. ### Schema Evolution and Partial Success -The `greptime_trace_v1` model automatically adds new flattened attribute columns. When a trace table already exists, GreptimeDB reconciles incoming attribute value types with the existing table schema. Compatible scalar values can be coerced to the existing column type, and existing `Int64` attribute columns may be widened to `Float64` when incoming values contain both integers and floats. +The `greptime_trace_v2` model stores attributes in `JSON2` columns without adding table columns for new attribute keys. If you use `greptime_trace_v1`, GreptimeDB automatically adds new flattened attribute columns and reconciles incoming attribute value types with the existing table schema: compatible scalar values can be coerced to the existing column type, and existing `Int64` attribute columns may be widened to `Float64` when incoming values contain both integers and floats. If some spans in a trace request cannot be written because of incompatible schema or values, GreptimeDB may still accept the other spans and return an OTLP `partial_success` response with `rejected_spans` and `error_message`. If all spans are rejected, the endpoint returns a `400 Bad Request` response. diff --git a/docs/user-guide/ingest-data/for-observability/otel-collector.md b/docs/user-guide/ingest-data/for-observability/otel-collector.md index 41d0a3f4f..62bacb949 100644 --- a/docs/user-guide/ingest-data/for-observability/otel-collector.md +++ b/docs/user-guide/ingest-data/for-observability/otel-collector.md @@ -30,7 +30,7 @@ exporters: # authenticator: basicauth/client headers: # x-greptime-db-name: '' - x-greptime-pipeline-name: 'greptime_trace_v1' + x-greptime-pipeline-name: 'greptime_trace_v2' tls: insecure: true otlp_http/logs: diff --git a/docs/user-guide/integrations/grafana.md b/docs/user-guide/integrations/grafana.md index 963338ba3..720e4b272 100644 --- a/docs/user-guide/integrations/grafana.md +++ b/docs/user-guide/integrations/grafana.md @@ -6,7 +6,9 @@ description: Steps to configure GreptimeDB as a data source in Grafana using dif # Grafana GreptimeDB can be configured as a [Grafana data source](https://grafana.com/docs/grafana/latest/datasources/add-a-data-source/). -You have the option to connect GreptimeDB with Grafana using one of three data sources: [GreptimeDB](#greptimedb-data-source-plugin), [Prometheus](#prometheus-data-source), or [MySQL](#mysql-data-source). +Connect using the [GreptimeDB plugin](#greptimedb-data-source-plugin), [Prometheus](#prometheus-data-source), +or [MySQL](#mysql-data-source). To search for and view traces, use Grafana's +[Jaeger data source](/user-guide/query-data/jaeger.md#configure-the-grafana-jaeger-plugin). ## GreptimeDB data source plugin @@ -101,11 +103,11 @@ series data: it calculates time intervals and returns the start of the interval nearest to each timestamp, so rows are grouped into time-based bins (windows). Apply an aggregate or selector function to each window. -Example (or raw SQL): +This raw SQL query sums input tokens per time bucket from a `greptime_trace_v2` table. ```sql SELECT date_bin('$__interval', timestamp) AS time, - SUM(`span_attributes.gen_ai.usage.input_tokens`) AS input_tokens + SUM(span_attributes."gen_ai.usage.input_tokens"::BIGINT) AS input_tokens FROM opentelemetry_traces WHERE $__timeFilter(timestamp) GROUP BY time @@ -167,7 +169,9 @@ Performs an approximate time range query based on the value of context columns i ### Traces Query -Select the `Traces` query type for distributed tracing data. +Select the `Traces` query type to view traces with the GreptimeDB plugin. +For `greptime_trace_v2` tables, use Grafana's +[Jaeger data source](/user-guide/query-data/jaeger.md#configure-the-grafana-jaeger-plugin) to view spans and their attributes. | Main Setting | Description | | :-------------------- | :------------------------------------------------------------------------------------------------------ | @@ -180,17 +184,16 @@ Select the `Traces` query type for distributed tracing data. | **Start Time Column** | Default value: `timestamp` | | **Duration Time Column** | Default value: `duration_nano` | | **Duration Unit** | Default value: `nanoseconds` | -| **Tags Column** | Multiple selections allowed. Corresponds to columns starting with `span_attributes` (e.g., `span_attributes.http.method`). | -| **Service Tags Column** | Multiple selections allowed. Corresponds to columns starting with `resource_attributes` (e.g., `resource_attributes.host.name`). | +| **Tags Column** | For `greptime_trace_v1`, select one or more flattened span attribute columns, such as `span_attributes.http.request.method`. | +| **Service Tags Column** | For `greptime_trace_v1`, select one or more flattened resource attribute columns, such as `resource_attributes.host.name`. | ![Traces](/grafana/traceconfig.png) #### Attribute Auto-Discovery -When the Trace ID query uses `SELECT *`, the plugin automatically discovers -all columns starting with `span_attributes.` and `resource_attributes.` and -includes them as expandable tags in the waterfall view. No need to manually -enumerate every attribute column. +For `greptime_trace_v1` tables, when the Trace ID query uses `SELECT *`, the plugin +shows columns with the `span_attributes.` and `resource_attributes.` prefixes as +expandable tags in the waterfall. ### SQL Macros @@ -277,8 +280,8 @@ Enable **Auto-Select Columns** to automatically include them in log queries. | Duration Time Column | Duration value | `duration_nano` | | Duration Unit | Unit of duration column | `nanoseconds` | | Start Time Column | Span start time | `timestamp` | -| Tags Column | Span attributes prefix | `span_attributes` | -| Service Tags Column | Resource attributes prefix | `resource_attributes` | +| Tags Column | Prefix for flattened span attributes in `greptime_trace_v1` | `span_attributes` | +| Service Tags Column | Prefix for flattened resource attributes in `greptime_trace_v1` | `resource_attributes` | #### OTel Preset diff --git a/docs/user-guide/semantic-layer/declaring-entities.md b/docs/user-guide/semantic-layer/declaring-entities.md index ff88a4a12..73cec7978 100644 --- a/docs/user-guide/semantic-layer/declaring-entities.md +++ b/docs/user-guide/semantic-layer/declaring-entities.md @@ -17,10 +17,10 @@ Conventions ship with the binary and are not configurable. An explicit declarati ### OTLP trace tables -Tables with `table_data_model` set to the `greptime_trace_v1` or `greptime_trace_v2` +Tables with `table_data_model` set to the `greptime_trace_v2` or `greptime_trace_v1` [trace data model](/user-guide/traces/data-model.md#data-model-versioning) -receive the following entity declarations without additional entity options. V1 -reads flattened attribute columns; v2 reads JSON2 attributes using the same +receive the following entity declarations without additional entity options. V2 +reads JSON2 attributes and v1 reads flattened attribute columns, using the same declaration names: | Entity | Identifying columns | Descriptive columns | diff --git a/docs/user-guide/semantic-layer/table-semantics.md b/docs/user-guide/semantic-layer/table-semantics.md index b3c736129..4587e4af3 100644 --- a/docs/user-guide/semantic-layer/table-semantics.md +++ b/docs/user-guide/semantic-layer/table-semantics.md @@ -24,7 +24,7 @@ The whitelist is closed: an unrecognized key under the prefix (such as `greptime | `greptime.semantic.signal_type` | The telemetry signal the table represents. | `metric` / `trace` / `log` / `event` / `unknown` | | `greptime.semantic.source` | The ingestion ecosystem that wrote the data. | `opentelemetry` / `prometheus` / `influxdb` / `opentsdb` / `loki` / `elasticsearch` / `custom` / `mixed` / `unknown` | | `greptime.semantic.source_version` | The source protocol version. Stamped by the Prometheus remote write path. | `1.0` / `2.0` | -| `greptime.semantic.pipeline` | The internal ingestion data model. The signal-agnostic successor to `table_data_model`; for traces, see [trace data model versions](/user-guide/traces/data-model.md#data-model-versioning). | `greptime_trace_v1` / `greptime_trace_v2` | +| `greptime.semantic.pipeline` | The internal ingestion data model. The signal-agnostic successor to `table_data_model`; for traces, see [trace data model versions](/user-guide/traces/data-model.md#data-model-versioning). | `greptime_trace_v2` / `greptime_trace_v1` | ### Trace keys @@ -53,7 +53,7 @@ Supported auto-create paths stamp identity (`signal_type` + `source`). OTLP metr | Ingestion path | `signal_type` | `source` | Additional keys | | --- | --- | --- | --- | | OTLP metrics | `metric` | `opentelemetry` | `metric.type`, `metric.unit`, `metric.temporality`, `metric.metadata_quality` = `declared`, `metric.original_name` | -| OTLP traces | `trace` | `opentelemetry` | `pipeline` = `greptime_trace_v1` or `greptime_trace_v2` (see [trace data model versions](/user-guide/traces/data-model.md#data-model-versioning)), `trace.conventions` | +| OTLP traces | `trace` | `opentelemetry` | `pipeline` = `greptime_trace_v2` or `greptime_trace_v1` (see [trace data model versions](/user-guide/traces/data-model.md#data-model-versioning)), `trace.conventions` | | OTLP logs | `log` | `opentelemetry` | — | | Prometheus remote write | `metric` | `prometheus` | `source_version`, `metric.metadata_quality` = `inferred` | | InfluxDB line protocol | `metric` | `influxdb` | identity only | diff --git a/docs/user-guide/traces/data-model.md b/docs/user-guide/traces/data-model.md index 95efc21df..1f9c10914 100644 --- a/docs/user-guide/traces/data-model.md +++ b/docs/user-guide/traces/data-model.md @@ -21,14 +21,15 @@ the moment, only built-in pipelines are supported. First, the data types and features in GreptimeDB are evolving. For forward-compatibility, we use the pipeline name for data model -versioning. Currently we have the following built-in pipeline for trace: +versioning. Currently we have the following built-in pipelines for traces: -- `greptime_trace_v1`: Flattens attributes into individual table columns. - `greptime_trace_v2`: Stores attributes in three fixed `JSON2` columns. +- `greptime_trace_v1`: Flattens attributes into individual table columns. Specify the data model in OpenTelemetry OTLP/HTTP requests with the -`x-greptime-pipeline-name` header. Choose v1 for flattened attribute columns, -or v2 for JSON2 attributes without adding a table column for every attribute key. +`x-greptime-pipeline-name` header. Choose `greptime_trace_v2` for JSON2 attributes +without adding a table column for every attribute key, or `greptime_trace_v1` for +flattened attribute columns. We may introduce new data models by adding new available pipeline names. Note that a new pipeline may not be compatible with previous ones, so you are @@ -58,10 +59,11 @@ Unlike v1, v2 keeps `service.name` in `resource_attributes` as well as extractin it into `service_name`. If the resource does not provide a usable service name, the tag is `NULL`. -The table is created automatically on the first write. The default table name -is still `opentelemetry_traces`. V2 uses the same trace-ID partitioning, skipping -indexes on `service_name`, `trace_id`, and `parent_span_id`, append-only mode, -and auxiliary service/operation tables described below. +The table is created automatically on the first write. By default, trace data is +stored in `opentelemetry_traces`; set the `x-greptime-trace-table-name` header in +OTLP/HTTP requests to customize the table name. V2 uses the trace-ID partitioning, +skipping indexes on `service_name`, `trace_id`, and `parent_span_id`, append-only +mode, and auxiliary service/operation tables described below. Use a new table when switching from v1 to v2. Changing the pipeline header does not migrate existing data: writes using v2 are rejected for a table marked as @@ -224,11 +226,11 @@ Create Table | CREATE TABLE IF NOT EXISTS "opentelemetry_traces" ( ## Shared Table Behavior -The following behavior applies to both v1 and v2. +The following behavior applies to both v2 and v1. ### Column storage options -New v1 and v2 trace tables created automatically through OTLP use these column options: +New v2 and v1 trace tables created automatically through OTLP use these column options: - `span_id` and `parent_span_id`: `encoding='plain'` and `page_size='64KiB'`. - `timestamp_end`: `encoding='delta_binary_packed'`. diff --git a/docs/user-guide/traces/read-write.md b/docs/user-guide/traces/read-write.md index 37a466a2c..ad88edf3b 100644 --- a/docs/user-guide/traces/read-write.md +++ b/docs/user-guide/traces/read-write.md @@ -38,6 +38,8 @@ follow the guide for endpoint and parameters. vendor-neutral service for collecting and processing OpenTelemetry data. You can also configure it to send trace data to GreptimeDB using OTLP/HTTP. + + #### Start OpenTelemetry Collector You can use the following command to quickly start an OpenTelemetry Collector @@ -65,7 +67,7 @@ exporters: otlp_http: endpoint: "http://greptimedb:4000/v1/otlp" # Replace greptimedb with your setup headers: - x-greptime-pipeline-name: "greptime_trace_v1" + x-greptime-pipeline-name: "greptime_trace_v2" #authorization: "Basic " tls: insecure: true @@ -77,26 +79,31 @@ service: exporters: [otlp_http] ``` -#### Ingest with greptime_trace_v2 +Sending traces as described below automatically creates `opentelemetry_traces` +with `JSON2` attributes. If `opentelemetry_traces` already exists as a v1 table, +also set `x-greptime-trace-table-name` (for example `"opentelemetry_traces_v2"`) +so v2 writes go to a new table. Use the same headers when writing directly from +an SDK. + +#### Ingest with greptime_trace_v1 -The complete configuration above uses v1. To use v2, replace its `exporters` -section with the following; keep the receivers and service configuration: +The complete configuration above uses `greptime_trace_v2`. If you need flattened +attribute columns instead, replace its `exporters` section with the following; +keep the receivers and service configuration: ```yaml exporters: otlp_http: endpoint: "http://greptimedb:4000/v1/otlp" headers: - x-greptime-pipeline-name: "greptime_trace_v2" - x-greptime-trace-table-name: "opentelemetry_traces_v2" + x-greptime-pipeline-name: "greptime_trace_v1" + x-greptime-trace-table-name: "opentelemetry_traces_v1" #authorization: "Basic " tls: insecure: true ``` -Use a new table to avoid sending v2 data to an existing v1 table. Sending traces -as described below automatically creates `opentelemetry_traces_v2` with JSON2 -attributes. Use the same headers when writing directly from an SDK. +Use a separate table to avoid mixing v1 and v2 data in the same table. See [how the trace data models differ](./data-model.md#data-model-versioning). #### Write Trace Data to OpenTelemetry Collector @@ -140,8 +147,8 @@ The GreptimeDB OTEL endpoint supports Basic authentication. For details, please The HTTP header `x-greptime-pipeline-name` is required for ingesting trace data. Here we reuse the Pipeline concept of GreptimeDB for data -transformation. Use the built-in `greptime_trace_v1` pipeline for flattened -attribute columns, or `greptime_trace_v2` for JSON2 attributes. See +transformation. Use the built-in `greptime_trace_v2` pipeline for JSON2 +attributes, or `greptime_trace_v1` for flattened attribute columns. See [Trace Data Modeling](./data-model.md) for model differences and table options. Use a separate table when switching models. No custom pipeline is allowed for the moment. @@ -167,20 +174,48 @@ docs](/user-guide/query-data/jaeger.md). ### SQL -#### greptime_trace_v1 +All data in GreptimeDB can be queried with SQL over HTTP, MySQL, or PostgreSQL. +By default, trace data is written into `opentelemetry_traces`, customizable via +the `x-greptime-trace-table-name` header. + +#### greptime_trace_v2 + +OpenTelemetry attribute keys often contain dots. Quote the entire key to read +it as a literal JSON key rather than a nested path: + +```sql +SELECT * FROM public.opentelemetry_traces LIMIT 10; + +SELECT + timestamp, + trace_id, + service_name, + span_attributes."http.request.method"::STRING AS method, + span_attributes."http.response.status_code"::BIGINT AS status, + resource_attributes."service.name"::STRING AS resource_service +FROM public.opentelemetry_traces +WHERE span_attributes."http.response.status_code"::BIGINT >= 500 +ORDER BY timestamp DESC +LIMIT 20; +``` + +For example, `span_attributes."http.request.method"` reads the key +`http.request.method`, while `span_attributes.http.request.method` reads nested +objects. The v1 form `"span_attributes.http.request.method"` names a flattened +table column and does not apply to v2. See [JSON2 query syntax](/user-guide/logs/json2.md#dot-syntax) +for more examples. Events and links continue to use the +[JSON functions](/reference/sql/functions/json.md). -All data in GreptimeDB is available for query using SQL, via MySQL and other -transport protocol. +#### greptime_trace_v1 -By default, trace data is written into the table called -`opentelemetry_traces`. The table name is customizable via header -`x-greptime-trace-table-name`. You can run SQL queries against the table: +For the `greptime_trace_v1` configuration above, attributes are flattened into +individual columns: ```sql -SELECT * FROM public.opentelemetry_traces \G +SELECT * FROM public.opentelemetry_traces_v1 \G ``` -For the v1 configuration above, an example output is like +Example output: ``` *************************** 1. row *************************** @@ -205,33 +240,5 @@ span_attributes.http.request.method: POST ... ``` -#### greptime_trace_v2 - -OpenTelemetry attribute keys often contain dots. Quote the entire key to read -it as a literal JSON key rather than a nested path: - -```sql -SELECT * FROM public.opentelemetry_traces_v2 LIMIT 10; - -SELECT - timestamp, - trace_id, - service_name, - span_attributes."http.request.method"::STRING AS method, - span_attributes."http.response.status_code"::BIGINT AS status, - resource_attributes."service.name"::STRING AS resource_service -FROM public.opentelemetry_traces_v2 -WHERE span_attributes."http.response.status_code"::BIGINT >= 500 -ORDER BY timestamp DESC -LIMIT 20; -``` - -For example, `span_attributes."http.request.method"` reads the key -`http.request.method`, while `span_attributes.http.request.method` reads nested -objects. The v1 form `"span_attributes.http.request.method"` names a flattened -table column and does not apply to v2. See [JSON2 query syntax](/user-guide/logs/json2.md#dot-syntax) -for more examples. Events and links continue to use the -[JSON functions](/reference/sql/functions/json.md). - We will cover more information about the table structure in [Data Model](./data-model.md) section. diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/greptimecloud/integrations/otlp.md b/i18n/zh/docusaurus-plugin-content-docs/current/greptimecloud/integrations/otlp.md index 5a7df79be..85f40056e 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/greptimecloud/integrations/otlp.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/greptimecloud/integrations/otlp.md @@ -42,7 +42,7 @@ exporters: authenticator: basicauth/client headers: x-greptime-db-name: '' - x-greptime-pipeline-name: 'greptime_trace_v1' + x-greptime-pipeline-name: 'greptime_trace_v2' otlphttp/logs: endpoint: 'https:///v1/otlp' auth: diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/information-schema/table-semantics.md b/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/information-schema/table-semantics.md index 82b6a5dd6..d864f5bf5 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/information-schema/table-semantics.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/information-schema/table-semantics.md @@ -67,7 +67,7 @@ DESC TABLE information_schema.table_semantics; - `unknown` —— 设置时无法确定。 - `source`:写入数据的来源生态,取值为 `opentelemetry`、`prometheus`、`influxdb`、`opentsdb`、`elasticsearch`、`loki`、`custom`、`mixed`、`unknown` 之一。`mixed` 表示同一张表接收了多个来源的数据,`unknown` 表示无法确定。 - `source_version`:来源协议的版本。Prometheus remote write 路径会写入 `1.0` 或 `2.0`,其他路径为空。 -- `pipeline`:内部摄入数据模型的标识,自由格式字符串。当前仅 OTLP trace 路径会自动设置,根据[所选 Trace Pipeline](/user-guide/traces/data-model.md#数据模型版本机制) 取值为 `greptime_trace_v1` 或 `greptime_trace_v2`;其他取值需手动设置。它是 `table_data_model` 的后继选项,不依赖具体信号类型。 +- `pipeline`:内部摄入数据模型的标识,自由格式字符串。当前仅 OTLP trace 路径会自动设置,根据[所选 Trace Pipeline](/user-guide/traces/data-model.md#数据模型版本机制) 取值为 `greptime_trace_v2` 或 `greptime_trace_v1`;其他取值需手动设置。它是 `table_data_model` 的后继选项,不依赖具体信号类型。 - `metadata_quality`:`metric.type` 标注的来源,即其可信程度,取值为以下之一: - `declared` —— 摄入协议显式提供了 instrument 类型(如 OTLP 指标自带类型),可信。 - `inferred` —— 类型由指标名推断得到(如 Prometheus 的 `_total` 后缀被识别为 counter),对命名不规范的指标可能不准确。 diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/fluent-bit.md b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/fluent-bit.md index 3d1aa159d..7b7b36cc6 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/fluent-bit.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/fluent-bit.md @@ -94,7 +94,7 @@ GreptimeDB 也可以配置为 OpenTelemetry 收集器。使用 Fluent Bit 的 [O Log_response_payload True Tls Off Tls.verify Off - Header X-Greptime-Pipeline-Name greptime_trace_v1 + Header X-Greptime-Pipeline-Name greptime_trace_v2 Header X-Greptime-DB-Name ``` @@ -102,7 +102,7 @@ GreptimeDB 也可以配置为 OpenTelemetry 收集器。使用 Fluent Bit 的 [O - `Match`:在对应 Fluent Bit input 中配置的 signal tag。 - `http_user` 和 `http_passwd`:GreptimeDB 的[认证凭据](/user-guide/deployments-administration/authentication/static.md)。启用鉴权时,请将它们添加到每个 output 中。 -本示例使用的是 OpenTelemetry OTLP/HTTP API。不同 signal 支持的 header 和选项不同,具体请分别参考 OpenTelemetry API 的 [metrics](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api)、[logs](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api-1) 和 [traces](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api-2) 部分。上方 traces 示例使用了 `greptime_trace_v1`,它与 `greptime_trace_v2` 的区别请参阅 [Trace 数据模型的版本差异](/user-guide/traces/data-model.md#数据模型版本机制)。 +本示例使用的是 OpenTelemetry OTLP/HTTP API。不同 signal 支持的 header 和选项不同,具体请分别参考 OpenTelemetry API 的 [metrics](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api)、[logs](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api-1) 和 [traces](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api-2) 部分。上方 traces 示例使用了 `greptime_trace_v2`,它与 `greptime_trace_v1` 的区别请参阅 [Trace 数据模型的版本差异](/user-guide/traces/data-model.md#数据模型版本机制)。 ## Prometheus Remote Write diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/opentelemetry.md b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/opentelemetry.md index 9fb0d3c7e..3b1ada99e 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/opentelemetry.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/opentelemetry.md @@ -381,7 +381,7 @@ GreptimeDB 支持直接写入 OpenTelemetry 协议的 traces 数据,并内置 - `Authorization`: `Basic` 认证。 - `X-Greptime-DB-Name`: `` - `X-Greptime-Trace-Table-Name`: ``(可选)- 存储 traces 的表名。如果未提供,默认表名为 `opentelemetry_traces`。 - - `X-Greptime-Pipeline-Name`: `greptime_trace_v1` 或 `greptime_trace_v2`(必选)- 处理 traces 的 pipeline 名称,详见 [Trace 数据模型的版本差异](/user-guide/traces/data-model.md#数据模型版本机制)。 + - `X-Greptime-Pipeline-Name`: `greptime_trace_v2` 或 `greptime_trace_v1`(必选)- 处理 traces 的 pipeline 名称,详见 [Trace 数据模型的版本差异](/user-guide/traces/data-model.md#数据模型版本机制)。 GreptimeDB 会通过 **HTTP 协议** 接受 **protobuf 编码的 traces 数据**。 @@ -391,11 +391,11 @@ GreptimeDB 会通过 **HTTP 协议** 接受 **protobuf 编码的 traces 数据** ### 数据模型 -Trace 数据模型的表结构、属性存储方式和表选项统一介绍于 [Trace 数据模型](/user-guide/traces/data-model.md)。该页分别说明 `greptime_trace_v1` 和 `greptime_trace_v2`。 +Trace 数据模型的表结构、属性存储方式和表选项统一介绍于 [Trace 数据模型](/user-guide/traces/data-model.md)。该页分别说明 `greptime_trace_v2` 和 `greptime_trace_v1`。 ### Schema 演进与 Partial Success -`greptime_trace_v1` 模型会自动添加新的打平 attribute 列。当 trace 表已经存在时,GreptimeDB 会根据已有表结构协调新写入 attribute 的值类型。兼容的标量值可以转换为已有列类型;当已有 `Int64` attribute 列后续收到整数和浮点数混合写入时,该列可能会被扩展为 `Float64`。 +`greptime_trace_v2` 模型将属性存储在 `JSON2` 列中,新增属性键不会增加表列。如果使用 `greptime_trace_v1` 模型,GreptimeDB 会自动添加新的打平 attribute 列,并根据已有表结构协调新写入 attribute 的值类型:兼容的标量值可以转换为已有列类型;当已有 `Int64` attribute 列后续收到整数和浮点数混合写入时,该列可能会被扩展为 `Float64`。 如果一次 trace 请求中有部分 span 因 schema 或值不兼容而无法写入,GreptimeDB 仍可能接受其他 span,并返回包含 `rejected_spans` 和 `error_message` 的 OTLP `partial_success` 响应。如果所有 span 都被拒绝,接口会返回 `400 Bad Request`。 diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/otel-collector.md b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/otel-collector.md index 5a57b7416..5eff833c8 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/otel-collector.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/otel-collector.md @@ -30,7 +30,7 @@ exporters: # authenticator: basicauth/client headers: # x-greptime-db-name: '' - x-greptime-pipeline-name: 'greptime_trace_v1' + x-greptime-pipeline-name: 'greptime_trace_v2' tls: insecure: true otlp_http/logs: diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/integrations/grafana.md b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/integrations/grafana.md index 2dbce61e0..98fec4f34 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/integrations/grafana.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/integrations/grafana.md @@ -6,7 +6,8 @@ description: 介绍如何将 GreptimeDB 配置为 Grafana 数据源,包括使 # Grafana GreptimeDB 服务可以配置为 [Grafana 数据源](https://grafana.com/docs/grafana/latest/datasources/add-a-data-source/)。 -你可以选择使用以下三个数据源之一连接 GreptimeDB 与 Grafana:[GreptimeDB](#greptimedb-数据源插件)、[Prometheus](#prometheus-数据源) 或 [MySQL](#mysql-数据源)。 +你可以使用 [GreptimeDB 插件](#greptimedb-数据源插件)、[Prometheus](#prometheus-数据源)或 [MySQL](#mysql-数据源)连接 GreptimeDB 与 Grafana。 +如需在 Grafana 中搜索和查看 Trace,请使用 [Jaeger 数据源](/user-guide/query-data/jaeger.md#配置-jaeger-插件)。 ## GreptimeDB 数据源插件 @@ -95,11 +96,11 @@ GreptimeDB 开启认证时,在 **Authentication** 部分选择 **Basic authent 并将每个时间戳映射到最近区间的起点,从而把行归入时间窗口,再对每个窗口应用 聚合或选择函数。 -示例(或原始 SQL): +以下原始 SQL 查询按时间窗口汇总 `greptime_trace_v2` 表中的输入 token 数。 ```sql SELECT date_bin('$__interval', timestamp) AS time, - SUM(`span_attributes.gen_ai.usage.input_tokens`) AS input_tokens + SUM(span_attributes."gen_ai.usage.input_tokens"::BIGINT) AS input_tokens FROM opentelemetry_traces WHERE $__timeFilter(timestamp) GROUP BY time @@ -157,6 +158,9 @@ ORDER BY time; ### Traces 查询 +在 GreptimeDB 插件中,选择 `Traces` 查询类型即可查看 Trace。对于 `greptime_trace_v2` 表, +可使用 Grafana 的 [Jaeger 数据源](/user-guide/query-data/jaeger.md#配置-jaeger-插件)查看 Span 及其属性。 + | 主要设置项 | 对应值 | |-----------|---------------------| | Trace Mode | 选择 `Trace Search` 以查询 Trace 列表 @@ -168,14 +172,15 @@ ORDER BY time; | Start Time Column | 初始值 `timestamp` | Duration Time Column | 初始值 `duration_nano` | Duration Unit | 初始值 `nanoseconds` -| Tags Column | 可多选,对应以 `span_attributes` 开头的列 -| Service Tags Column| 可多选,对应以 `resource_attributes` 开头的列 +| Tags Column | 可从 `greptime_trace_v1` 表中选择一个或多个打平后的 Span 属性列,例如 `span_attributes.http.request.method`。 | +| Service Tags Column | 可从 `greptime_trace_v1` 表中选择一个或多个打平后的 Resource 属性列,例如 `resource_attributes.host.name`。 | ![Traces](/grafana/traceconfig.png) #### Attribute 自动发现 -当 Trace ID 查询使用 `SELECT *` 时,插件会自动发现所有以 `span_attributes.` 和 `resource_attributes.` 开头的列,并在瀑布图中作为可展开标签展示,无需手动枚举每个 attribute 列。 +对于 `greptime_trace_v1` 表,如果 Trace ID 查询使用 `SELECT *`,插件会将以 +`span_attributes.` 和 `resource_attributes.` 开头的列作为可展开的标签显示在瀑布图中。 ### SQL Macros @@ -257,8 +262,8 @@ ORDER BY time; | Duration Time Column | 耗时值 | `duration_nano` | | Duration Unit | 耗时列单位 | `nanoseconds` | | Start Time Column | Span 开始时间 | `timestamp` | -| Tags Column | Span attributes 前缀 | `span_attributes` | -| Service Tags Column | Resource attributes 前缀 | `resource_attributes` | +| Tags Column | `greptime_trace_v1` 打平后的 Span 属性列前缀 | `span_attributes` | +| Service Tags Column | `greptime_trace_v1` 打平后的 Resource 属性列前缀 | `resource_attributes` | #### OTel 预设 diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/semantic-layer/declaring-entities.md b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/semantic-layer/declaring-entities.md index 5b262c605..670f501a9 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/semantic-layer/declaring-entities.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/semantic-layer/declaring-entities.md @@ -17,7 +17,7 @@ description: 哪些数据无需配置即可进入语义图、如何在自己的 ### OTLP trace 表 -`table_data_model` 为 `greptime_trace_v1` 或 `greptime_trace_v2`(见 [Trace 数据模型的版本差异](/user-guide/traces/data-model.md#数据模型版本机制))的表都会自动获得以下实体声明,无需额外的实体选项。v1 从打平的属性列读取值;v2 从 JSON2 属性中读取值,使用相同的声明名称: +`table_data_model` 为 `greptime_trace_v2` 或 `greptime_trace_v1`(见 [Trace 数据模型的版本差异](/user-guide/traces/data-model.md#数据模型版本机制))的表都会自动获得以下实体声明,无需额外的实体选项。v2 从 JSON2 属性中读取值,v1 从打平的属性列读取值,两者使用相同的声明名称: | 实体 | 标识列 | 描述列 | | --- | --- | --- | diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/semantic-layer/table-semantics.md b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/semantic-layer/table-semantics.md index dc238651d..1506835fd 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/semantic-layer/table-semantics.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/semantic-layer/table-semantics.md @@ -24,7 +24,7 @@ description: greptime.semantic.* 表选项、接入时如何自动写入、如 | `greptime.semantic.signal_type` | 表所代表的遥测信号类型。 | `metric` / `trace` / `log` / `event` / `unknown` | | `greptime.semantic.source` | 写入数据的接入生态。 | `opentelemetry` / `prometheus` / `influxdb` / `opentsdb` / `loki` / `elasticsearch` / `custom` / `mixed` / `unknown` | | `greptime.semantic.source_version` | 来源协议的版本,由 Prometheus remote write 路径写入。 | `1.0` / `2.0` | -| `greptime.semantic.pipeline` | 内部接入数据模型。它是 `table_data_model` 的后继选项,不依赖具体信号类型;Trace 取值见 [Trace 数据模型的版本差异](/user-guide/traces/data-model.md#数据模型版本机制)。 | `greptime_trace_v1` / `greptime_trace_v2` | +| `greptime.semantic.pipeline` | 内部接入数据模型。它是 `table_data_model` 的后继选项,不依赖具体信号类型;Trace 取值见 [Trace 数据模型的版本差异](/user-guide/traces/data-model.md#数据模型版本机制)。 | `greptime_trace_v2` / `greptime_trace_v1` | ### Trace key @@ -53,7 +53,7 @@ description: greptime.semantic.* 表选项、接入时如何自动写入、如 | 接入路径 | `signal_type` | `source` | 额外 key | | --- | --- | --- | --- | | OTLP metrics | `metric` | `opentelemetry` | `metric.type`、`metric.unit`、`metric.temporality`、`metric.metadata_quality` = `declared`、`metric.original_name` | -| OTLP traces | `trace` | `opentelemetry` | `pipeline` = `greptime_trace_v1` 或 `greptime_trace_v2`(见 [Trace 数据模型的版本差异](/user-guide/traces/data-model.md#数据模型版本机制))、`trace.conventions` | +| OTLP traces | `trace` | `opentelemetry` | `pipeline` = `greptime_trace_v2` 或 `greptime_trace_v1`(见 [Trace 数据模型的版本差异](/user-guide/traces/data-model.md#数据模型版本机制))、`trace.conventions` | | OTLP logs | `log` | `opentelemetry` | — | | Prometheus remote write | `metric` | `prometheus` | `source_version`、`metric.metadata_quality` = `inferred` | | InfluxDB line protocol | `metric` | `influxdb` | 仅身份 | diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/traces/data-model.md b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/traces/data-model.md index 781303c8b..6e4918843 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/traces/data-model.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/traces/data-model.md @@ -21,10 +21,10 @@ description: 介绍 Trace 数据如何存入 GreptimeDB. GreptimeDB 本身的数据类型和相关功能在持续演化。为了实现向后兼容,我们使用 Pipeline 的名称来作为数据模型的版本。目前可用的内置 Pipeline 为: -- `greptime_trace_v1`:将属性打平为独立的表列。 - `greptime_trace_v2`:将属性存储在三个固定的 `JSON2` 列中。 +- `greptime_trace_v1`:将属性打平为独立的表列。 -在使用 OTLP/HTTP 协议写入数据时,需要通过 `x-greptime-pipeline-name` HTTP 头指定数据模型。需要打平属性列时选择 v1;希望使用 JSON2 存储属性、避免每个属性键都新增表列时选择 v2。 +在使用 OTLP/HTTP 协议写入数据时,需要通过 `x-greptime-pipeline-name` HTTP 头指定数据模型。希望使用 JSON2 存储属性、避免每个属性键都新增表列时选择 `greptime_trace_v2`;需要打平属性列时选择 `greptime_trace_v1`。 在未来我们可能引入新的 Pipeline 名称,即数据模型版本。新的 Pipeline 可能与老版本不兼容,因此建议创建新的数据表来使用。 @@ -50,9 +50,10 @@ v2 模型将每个 Span 存储为一行,固定包含 19 列。属性使用 与 v1 不同,v2 在提取 `service_name` 的同时,也会在 `resource_attributes` 中保留 `service.name`。如果 Resource 未提供可用的服务名称,Tag 值为 `NULL`。 -首次写入时会自动建表,默认表名仍为 `opentelemetry_traces`。v2 沿用下文介绍的 -Trace ID 分区规则、`service_name`、`trace_id` 和 `parent_span_id` 上的跳数索引、 -Append-only 模式,以及服务和操作辅助表。 +首次写入时会自动建表,默认表名为 `opentelemetry_traces`,可通过 OTLP/HTTP 请求中的 +`x-greptime-trace-table-name` 请求头自定义表名。v2 使用下文介绍的 Trace ID 分区规则、 +`service_name`、`trace_id` 和 `parent_span_id` 上的跳数索引、Append-only 模式, +以及服务和操作辅助表。 从 v1 切换到 v2 时,请使用新表。修改 Pipeline 请求头不会迁移已有数据:标记为 v1 的表会拒绝 v2 写入,反之亦然。已有 v1 表可以继续使用 v1 Pipeline。配置和 SQL 示例请参阅[写入与查询](./read-write.md)。 @@ -194,11 +195,11 @@ Create Table | CREATE TABLE IF NOT EXISTS "opentelemetry_traces" ( ## 通用表行为 -以下内容适用于 v1 和 v2。 +以下内容适用于 v2 和 v1。 ### 列存储选项 -OTLP 自动创建的 v1 和 v2 Trace 表使用以下列选项: +OTLP 自动创建的 v2 和 v1 Trace 表使用以下列选项: - `span_id` 和 `parent_span_id`:`encoding='plain'`、`page_size='64KiB'`。 - `timestamp_end`:`encoding='delta_binary_packed'`。 diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/traces/read-write.md b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/traces/read-write.md index e14eb82d5..95333912c 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/traces/read-write.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/traces/read-write.md @@ -35,6 +35,8 @@ Trace 也是 OpenTelemetry 中最广为接受的子协议,包含了良好的 立的用于收集和处理 OpenTelemetry 数据的服务。本文我们将介绍如何使用 OpenTelemetry Collector 将 traces 数据写入到 GreptimeDB。 + + #### 启动 OpenTelemetry Collector 你可以使用如下命令来快速启动一个 OpenTelemetry Collector 实例,此时 collector 会监听 `4317`(gRPC) 和 `4318`(HTTP) 端口: @@ -61,7 +63,7 @@ exporters: otlp_http: endpoint: "http://greptimedb:4000/v1/otlp" # GreptimeDB 的 OTLP 路径 headers: - x-greptime-pipeline-name: "greptime_trace_v1" + x-greptime-pipeline-name: "greptime_trace_v2" #authorization: "Basic " tls: insecure: true @@ -73,25 +75,29 @@ service: exporters: [otlp_http] ``` -#### 使用 greptime_trace_v2 写入 +按下文发送 Trace 后,GreptimeDB 会自动创建 `opentelemetry_traces` 表,并将属性存储为 +`JSON2`。如果 `opentelemetry_traces` 已作为 v1 表存在,请同时设置 +`x-greptime-trace-table-name`(例如 `"opentelemetry_traces_v2"`),将 v2 数据写入新表。 +SDK 直接写入时也使用相同的请求头。 + +#### 使用 greptime_trace_v1 写入 -上面的完整配置使用 v1。要使用 v2,请将其中的 `exporters` 配置替换为以下内容, -其余 receivers 和 service 配置保持不变: +上面的完整配置使用 `greptime_trace_v2`。如果需要打平属性列,请将其中的 `exporters` +配置替换为以下内容,其余 receivers 和 service 配置保持不变: ```yaml exporters: otlp_http: endpoint: "http://greptimedb:4000/v1/otlp" headers: - x-greptime-pipeline-name: "greptime_trace_v2" - x-greptime-trace-table-name: "opentelemetry_traces_v2" + x-greptime-pipeline-name: "greptime_trace_v1" + x-greptime-trace-table-name: "opentelemetry_traces_v1" #authorization: "Basic " tls: insecure: true ``` -请使用新表,避免向已有 v1 表写入 v2 数据。按下文发送 Trace 后,GreptimeDB 会自动 -创建 `opentelemetry_traces_v2`,并将属性存储为 JSON2。SDK 直接写入时也使用相同的请求头。 +请使用独立的表,避免在同一张表中混写 v1 和 v2 数据。 两个模型的差异请参阅[数据模型版本机制](./data-model.md#数据模型版本机制)。 #### 将 Trace 数据写入到 OpenTelemetry Collector @@ -133,7 +139,7 @@ GreptimeDB 的 OTEL 端点支持 Basic 认证。详情请参考 [鉴权](/user-g 在 OTLP 接口中,我们要求 HTTP 头 `x-greptime-pipeline-name` 作为必选参数。在这里 我们复用了日志接口中 Pipeline 的概念作为数据转化的机制。Trace 数据应使用内置的 -`greptime_trace_v1`(打平属性列)或 `greptime_trace_v2`(JSON2 属性)。 +`greptime_trace_v2`(JSON2 属性)或 `greptime_trace_v1`(打平属性列)。 有关模型差异和表选项,请参阅 [Trace 数据模型](./data-model.md)。切换模型时请使用独立的表。 自定义的 Pipeline 暂不支持。 @@ -159,16 +165,45 @@ GreptimeDB 内置的 Jaeger 兼容层使得用户可以直接复用市面上的 ### SQL +Trace 数据可以通过 SQL 查询。默认情况下,Trace 数据写入 `opentelemetry_traces` 表, +也可在写入时通过 `x-greptime-trace-table-name` 指定表名。 + +#### greptime_trace_v2 + +OpenTelemetry 属性键通常包含点号。请用双引号包住完整的键名,将其作为字面键读取, +而不是嵌套路径: + +```sql +SELECT * FROM public.opentelemetry_traces LIMIT 10; + +SELECT + timestamp, + trace_id, + service_name, + span_attributes."http.request.method"::STRING AS method, + span_attributes."http.response.status_code"::BIGINT AS status, + resource_attributes."service.name"::STRING AS resource_service +FROM public.opentelemetry_traces +WHERE span_attributes."http.response.status_code"::BIGINT >= 500 +ORDER BY timestamp DESC +LIMIT 20; +``` + +例如,`span_attributes."http.request.method"` 读取键 `http.request.method`,而 +`span_attributes.http.request.method` 读取嵌套对象。v1 中的 +`"span_attributes.http.request.method"` 表示打平后的表列,不适用于 v2。 +更多示例请参阅 [JSON2 查询语法](/user-guide/logs/json2.md#点号语法)。 +事件和链接仍使用 [JSON 函数](/reference/sql/functions/json.md)查询。 + #### greptime_trace_v1 -Trace 数据也可以通过 SQL 查询。默认 Trace 数据会写入 `opentelemetry_traces` 表中, -这个表名也可以在写入时通过 `x-greptime-trace-table-name` 来指定。通过 SQL 查询: +使用上面的 `greptime_trace_v1` 配置时,属性被打平为独立的列: ```sql -SELECT * FROM public.opentelemetry_traces \G +SELECT * FROM public.opentelemetry_traces_v1 \G ``` -使用上面的 v1 配置时,输出示例如下: +输出示例如下: ``` *************************** 1. row *************************** @@ -193,31 +228,4 @@ span_attributes.http.request.method: POST ... ``` -#### greptime_trace_v2 - -OpenTelemetry 属性键通常包含点号。请用双引号包住完整的键名,将其作为字面键读取, -而不是嵌套路径: - -```sql -SELECT * FROM public.opentelemetry_traces_v2 LIMIT 10; - -SELECT - timestamp, - trace_id, - service_name, - span_attributes."http.request.method"::STRING AS method, - span_attributes."http.response.status_code"::BIGINT AS status, - resource_attributes."service.name"::STRING AS resource_service -FROM public.opentelemetry_traces_v2 -WHERE span_attributes."http.response.status_code"::BIGINT >= 500 -ORDER BY timestamp DESC -LIMIT 20; -``` - -例如,`span_attributes."http.request.method"` 读取键 `http.request.method`,而 -`span_attributes.http.request.method` 读取嵌套对象。v1 中的 -`"span_attributes.http.request.method"` 表示打平后的表列,不适用于 v2。 -更多示例请参阅 [JSON2 查询语法](/user-guide/logs/json2.md#点号语法)。 -事件和链接仍使用 [JSON 函数](/reference/sql/functions/json.md)查询。 - 在下一节[数据模型](./data-model.md) 中我们会对这个表结构做详细介绍。 diff --git a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/greptimecloud/integrations/otlp.md b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/greptimecloud/integrations/otlp.md index 5a7df79be..85f40056e 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/greptimecloud/integrations/otlp.md +++ b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/greptimecloud/integrations/otlp.md @@ -42,7 +42,7 @@ exporters: authenticator: basicauth/client headers: x-greptime-db-name: '' - x-greptime-pipeline-name: 'greptime_trace_v1' + x-greptime-pipeline-name: 'greptime_trace_v2' otlphttp/logs: endpoint: 'https:///v1/otlp' auth: diff --git a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/reference/sql/information-schema/table-semantics.md b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/reference/sql/information-schema/table-semantics.md index 82b6a5dd6..d864f5bf5 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/reference/sql/information-schema/table-semantics.md +++ b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/reference/sql/information-schema/table-semantics.md @@ -67,7 +67,7 @@ DESC TABLE information_schema.table_semantics; - `unknown` —— 设置时无法确定。 - `source`:写入数据的来源生态,取值为 `opentelemetry`、`prometheus`、`influxdb`、`opentsdb`、`elasticsearch`、`loki`、`custom`、`mixed`、`unknown` 之一。`mixed` 表示同一张表接收了多个来源的数据,`unknown` 表示无法确定。 - `source_version`:来源协议的版本。Prometheus remote write 路径会写入 `1.0` 或 `2.0`,其他路径为空。 -- `pipeline`:内部摄入数据模型的标识,自由格式字符串。当前仅 OTLP trace 路径会自动设置,根据[所选 Trace Pipeline](/user-guide/traces/data-model.md#数据模型版本机制) 取值为 `greptime_trace_v1` 或 `greptime_trace_v2`;其他取值需手动设置。它是 `table_data_model` 的后继选项,不依赖具体信号类型。 +- `pipeline`:内部摄入数据模型的标识,自由格式字符串。当前仅 OTLP trace 路径会自动设置,根据[所选 Trace Pipeline](/user-guide/traces/data-model.md#数据模型版本机制) 取值为 `greptime_trace_v2` 或 `greptime_trace_v1`;其他取值需手动设置。它是 `table_data_model` 的后继选项,不依赖具体信号类型。 - `metadata_quality`:`metric.type` 标注的来源,即其可信程度,取值为以下之一: - `declared` —— 摄入协议显式提供了 instrument 类型(如 OTLP 指标自带类型),可信。 - `inferred` —— 类型由指标名推断得到(如 Prometheus 的 `_total` 后缀被识别为 counter),对命名不规范的指标可能不准确。 diff --git a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/ingest-data/for-observability/fluent-bit.md b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/ingest-data/for-observability/fluent-bit.md index 3d1aa159d..7b7b36cc6 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/ingest-data/for-observability/fluent-bit.md +++ b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/ingest-data/for-observability/fluent-bit.md @@ -94,7 +94,7 @@ GreptimeDB 也可以配置为 OpenTelemetry 收集器。使用 Fluent Bit 的 [O Log_response_payload True Tls Off Tls.verify Off - Header X-Greptime-Pipeline-Name greptime_trace_v1 + Header X-Greptime-Pipeline-Name greptime_trace_v2 Header X-Greptime-DB-Name ``` @@ -102,7 +102,7 @@ GreptimeDB 也可以配置为 OpenTelemetry 收集器。使用 Fluent Bit 的 [O - `Match`:在对应 Fluent Bit input 中配置的 signal tag。 - `http_user` 和 `http_passwd`:GreptimeDB 的[认证凭据](/user-guide/deployments-administration/authentication/static.md)。启用鉴权时,请将它们添加到每个 output 中。 -本示例使用的是 OpenTelemetry OTLP/HTTP API。不同 signal 支持的 header 和选项不同,具体请分别参考 OpenTelemetry API 的 [metrics](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api)、[logs](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api-1) 和 [traces](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api-2) 部分。上方 traces 示例使用了 `greptime_trace_v1`,它与 `greptime_trace_v2` 的区别请参阅 [Trace 数据模型的版本差异](/user-guide/traces/data-model.md#数据模型版本机制)。 +本示例使用的是 OpenTelemetry OTLP/HTTP API。不同 signal 支持的 header 和选项不同,具体请分别参考 OpenTelemetry API 的 [metrics](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api)、[logs](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api-1) 和 [traces](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api-2) 部分。上方 traces 示例使用了 `greptime_trace_v2`,它与 `greptime_trace_v1` 的区别请参阅 [Trace 数据模型的版本差异](/user-guide/traces/data-model.md#数据模型版本机制)。 ## Prometheus Remote Write diff --git a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/ingest-data/for-observability/opentelemetry.md b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/ingest-data/for-observability/opentelemetry.md index bae979191..a9ddf52ee 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/ingest-data/for-observability/opentelemetry.md +++ b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/ingest-data/for-observability/opentelemetry.md @@ -336,7 +336,7 @@ GreptimeDB 支持直接写入 OpenTelemetry 协议的 traces 数据,并内置 - `Authorization`: `Basic` 认证。 - `X-Greptime-DB-Name`: `` - `X-Greptime-Trace-Table-Name`: ``(可选)- 存储 traces 的表名。如果未提供,默认表名为 `opentelemetry_traces`。 - - `X-Greptime-Pipeline-Name`: `greptime_trace_v1` 或 `greptime_trace_v2`(必选)- 处理 traces 的 pipeline 名称,详见 [Trace 数据模型的版本差异](/user-guide/traces/data-model.md#数据模型版本机制)。 + - `X-Greptime-Pipeline-Name`: `greptime_trace_v2` 或 `greptime_trace_v1`(必选)- 处理 traces 的 pipeline 名称,详见 [Trace 数据模型的版本差异](/user-guide/traces/data-model.md#数据模型版本机制)。 GreptimeDB 会通过 **HTTP 协议** 接受 **protobuf 编码的 traces 数据**。 @@ -346,11 +346,11 @@ GreptimeDB 会通过 **HTTP 协议** 接受 **protobuf 编码的 traces 数据** ### 数据模型 -Trace 数据模型的表结构、属性存储方式和表选项统一介绍于 [Trace 数据模型](/user-guide/traces/data-model.md)。该页分别说明 `greptime_trace_v1` 和 `greptime_trace_v2`。 +Trace 数据模型的表结构、属性存储方式和表选项统一介绍于 [Trace 数据模型](/user-guide/traces/data-model.md)。该页分别说明 `greptime_trace_v2` 和 `greptime_trace_v1`。 ### Schema 演进与 Partial Success -`greptime_trace_v1` 模型会自动添加新的打平 attribute 列。当 trace 表已经存在时,GreptimeDB 会根据已有表结构协调新写入 attribute 的值类型。兼容的标量值可以转换为已有列类型;当已有 `Int64` attribute 列后续收到整数和浮点数混合写入时,该列可能会被扩展为 `Float64`。 +`greptime_trace_v2` 模型将属性存储在 `JSON2` 列中,新增属性键不会增加表列。如果使用 `greptime_trace_v1` 模型,GreptimeDB 会自动添加新的打平 attribute 列,并根据已有表结构协调新写入 attribute 的值类型:兼容的标量值可以转换为已有列类型;当已有 `Int64` attribute 列后续收到整数和浮点数混合写入时,该列可能会被扩展为 `Float64`。 如果一次 trace 请求中有部分 span 因 schema 或值不兼容而无法写入,GreptimeDB 仍可能接受其他 span,并返回包含 `rejected_spans` 和 `error_message` 的 OTLP `partial_success` 响应。如果所有 span 都被拒绝,接口会返回 `400 Bad Request`。 diff --git a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/ingest-data/for-observability/otel-collector.md b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/ingest-data/for-observability/otel-collector.md index 5a57b7416..5eff833c8 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/ingest-data/for-observability/otel-collector.md +++ b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/ingest-data/for-observability/otel-collector.md @@ -30,7 +30,7 @@ exporters: # authenticator: basicauth/client headers: # x-greptime-db-name: '' - x-greptime-pipeline-name: 'greptime_trace_v1' + x-greptime-pipeline-name: 'greptime_trace_v2' tls: insecure: true otlp_http/logs: diff --git a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/integrations/grafana.md b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/integrations/grafana.md index 2dbce61e0..98fec4f34 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/integrations/grafana.md +++ b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/integrations/grafana.md @@ -6,7 +6,8 @@ description: 介绍如何将 GreptimeDB 配置为 Grafana 数据源,包括使 # Grafana GreptimeDB 服务可以配置为 [Grafana 数据源](https://grafana.com/docs/grafana/latest/datasources/add-a-data-source/)。 -你可以选择使用以下三个数据源之一连接 GreptimeDB 与 Grafana:[GreptimeDB](#greptimedb-数据源插件)、[Prometheus](#prometheus-数据源) 或 [MySQL](#mysql-数据源)。 +你可以使用 [GreptimeDB 插件](#greptimedb-数据源插件)、[Prometheus](#prometheus-数据源)或 [MySQL](#mysql-数据源)连接 GreptimeDB 与 Grafana。 +如需在 Grafana 中搜索和查看 Trace,请使用 [Jaeger 数据源](/user-guide/query-data/jaeger.md#配置-jaeger-插件)。 ## GreptimeDB 数据源插件 @@ -95,11 +96,11 @@ GreptimeDB 开启认证时,在 **Authentication** 部分选择 **Basic authent 并将每个时间戳映射到最近区间的起点,从而把行归入时间窗口,再对每个窗口应用 聚合或选择函数。 -示例(或原始 SQL): +以下原始 SQL 查询按时间窗口汇总 `greptime_trace_v2` 表中的输入 token 数。 ```sql SELECT date_bin('$__interval', timestamp) AS time, - SUM(`span_attributes.gen_ai.usage.input_tokens`) AS input_tokens + SUM(span_attributes."gen_ai.usage.input_tokens"::BIGINT) AS input_tokens FROM opentelemetry_traces WHERE $__timeFilter(timestamp) GROUP BY time @@ -157,6 +158,9 @@ ORDER BY time; ### Traces 查询 +在 GreptimeDB 插件中,选择 `Traces` 查询类型即可查看 Trace。对于 `greptime_trace_v2` 表, +可使用 Grafana 的 [Jaeger 数据源](/user-guide/query-data/jaeger.md#配置-jaeger-插件)查看 Span 及其属性。 + | 主要设置项 | 对应值 | |-----------|---------------------| | Trace Mode | 选择 `Trace Search` 以查询 Trace 列表 @@ -168,14 +172,15 @@ ORDER BY time; | Start Time Column | 初始值 `timestamp` | Duration Time Column | 初始值 `duration_nano` | Duration Unit | 初始值 `nanoseconds` -| Tags Column | 可多选,对应以 `span_attributes` 开头的列 -| Service Tags Column| 可多选,对应以 `resource_attributes` 开头的列 +| Tags Column | 可从 `greptime_trace_v1` 表中选择一个或多个打平后的 Span 属性列,例如 `span_attributes.http.request.method`。 | +| Service Tags Column | 可从 `greptime_trace_v1` 表中选择一个或多个打平后的 Resource 属性列,例如 `resource_attributes.host.name`。 | ![Traces](/grafana/traceconfig.png) #### Attribute 自动发现 -当 Trace ID 查询使用 `SELECT *` 时,插件会自动发现所有以 `span_attributes.` 和 `resource_attributes.` 开头的列,并在瀑布图中作为可展开标签展示,无需手动枚举每个 attribute 列。 +对于 `greptime_trace_v1` 表,如果 Trace ID 查询使用 `SELECT *`,插件会将以 +`span_attributes.` 和 `resource_attributes.` 开头的列作为可展开的标签显示在瀑布图中。 ### SQL Macros @@ -257,8 +262,8 @@ ORDER BY time; | Duration Time Column | 耗时值 | `duration_nano` | | Duration Unit | 耗时列单位 | `nanoseconds` | | Start Time Column | Span 开始时间 | `timestamp` | -| Tags Column | Span attributes 前缀 | `span_attributes` | -| Service Tags Column | Resource attributes 前缀 | `resource_attributes` | +| Tags Column | `greptime_trace_v1` 打平后的 Span 属性列前缀 | `span_attributes` | +| Service Tags Column | `greptime_trace_v1` 打平后的 Resource 属性列前缀 | `resource_attributes` | #### OTel 预设 diff --git a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/semantic-layer/declaring-entities.md b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/semantic-layer/declaring-entities.md index 5b262c605..670f501a9 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/semantic-layer/declaring-entities.md +++ b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/semantic-layer/declaring-entities.md @@ -17,7 +17,7 @@ description: 哪些数据无需配置即可进入语义图、如何在自己的 ### OTLP trace 表 -`table_data_model` 为 `greptime_trace_v1` 或 `greptime_trace_v2`(见 [Trace 数据模型的版本差异](/user-guide/traces/data-model.md#数据模型版本机制))的表都会自动获得以下实体声明,无需额外的实体选项。v1 从打平的属性列读取值;v2 从 JSON2 属性中读取值,使用相同的声明名称: +`table_data_model` 为 `greptime_trace_v2` 或 `greptime_trace_v1`(见 [Trace 数据模型的版本差异](/user-guide/traces/data-model.md#数据模型版本机制))的表都会自动获得以下实体声明,无需额外的实体选项。v2 从 JSON2 属性中读取值,v1 从打平的属性列读取值,两者使用相同的声明名称: | 实体 | 标识列 | 描述列 | | --- | --- | --- | diff --git a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/semantic-layer/table-semantics.md b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/semantic-layer/table-semantics.md index dc238651d..1506835fd 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/semantic-layer/table-semantics.md +++ b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/semantic-layer/table-semantics.md @@ -24,7 +24,7 @@ description: greptime.semantic.* 表选项、接入时如何自动写入、如 | `greptime.semantic.signal_type` | 表所代表的遥测信号类型。 | `metric` / `trace` / `log` / `event` / `unknown` | | `greptime.semantic.source` | 写入数据的接入生态。 | `opentelemetry` / `prometheus` / `influxdb` / `opentsdb` / `loki` / `elasticsearch` / `custom` / `mixed` / `unknown` | | `greptime.semantic.source_version` | 来源协议的版本,由 Prometheus remote write 路径写入。 | `1.0` / `2.0` | -| `greptime.semantic.pipeline` | 内部接入数据模型。它是 `table_data_model` 的后继选项,不依赖具体信号类型;Trace 取值见 [Trace 数据模型的版本差异](/user-guide/traces/data-model.md#数据模型版本机制)。 | `greptime_trace_v1` / `greptime_trace_v2` | +| `greptime.semantic.pipeline` | 内部接入数据模型。它是 `table_data_model` 的后继选项,不依赖具体信号类型;Trace 取值见 [Trace 数据模型的版本差异](/user-guide/traces/data-model.md#数据模型版本机制)。 | `greptime_trace_v2` / `greptime_trace_v1` | ### Trace key @@ -53,7 +53,7 @@ description: greptime.semantic.* 表选项、接入时如何自动写入、如 | 接入路径 | `signal_type` | `source` | 额外 key | | --- | --- | --- | --- | | OTLP metrics | `metric` | `opentelemetry` | `metric.type`、`metric.unit`、`metric.temporality`、`metric.metadata_quality` = `declared`、`metric.original_name` | -| OTLP traces | `trace` | `opentelemetry` | `pipeline` = `greptime_trace_v1` 或 `greptime_trace_v2`(见 [Trace 数据模型的版本差异](/user-guide/traces/data-model.md#数据模型版本机制))、`trace.conventions` | +| OTLP traces | `trace` | `opentelemetry` | `pipeline` = `greptime_trace_v2` 或 `greptime_trace_v1`(见 [Trace 数据模型的版本差异](/user-guide/traces/data-model.md#数据模型版本机制))、`trace.conventions` | | OTLP logs | `log` | `opentelemetry` | — | | Prometheus remote write | `metric` | `prometheus` | `source_version`、`metric.metadata_quality` = `inferred` | | InfluxDB line protocol | `metric` | `influxdb` | 仅身份 | diff --git a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/traces/data-model.md b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/traces/data-model.md index 7df8a92a0..1f133ecbe 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/traces/data-model.md +++ b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/traces/data-model.md @@ -21,10 +21,10 @@ description: 介绍 Trace 数据如何存入 GreptimeDB. GreptimeDB 本身的数据类型和相关功能在持续演化。为了实现向后兼容,我们使用 Pipeline 的名称来作为数据模型的版本。目前可用的内置 Pipeline 为: -- `greptime_trace_v1`:将属性打平为独立的表列。 - `greptime_trace_v2`:将属性存储在三个固定的 `JSON2` 列中。 +- `greptime_trace_v1`:将属性打平为独立的表列。 -在使用 OTLP/HTTP 协议写入数据时,需要通过 `x-greptime-pipeline-name` HTTP 头指定数据模型。需要打平属性列时选择 v1;希望使用 JSON2 存储属性、避免每个属性键都新增表列时选择 v2。 +在使用 OTLP/HTTP 协议写入数据时,需要通过 `x-greptime-pipeline-name` HTTP 头指定数据模型。希望使用 JSON2 存储属性、避免每个属性键都新增表列时选择 `greptime_trace_v2`;需要打平属性列时选择 `greptime_trace_v1`。 在未来我们可能引入新的 Pipeline 名称,即数据模型版本。新的 Pipeline 可能与老版本不兼容,因此建议创建新的数据表来使用。 @@ -50,9 +50,10 @@ v2 模型将每个 Span 存储为一行,固定包含 19 列。属性使用 与 v1 不同,v2 在提取 `service_name` 的同时,也会在 `resource_attributes` 中保留 `service.name`。如果 Resource 未提供可用的服务名称,Tag 值为 `NULL`。 -首次写入时会自动建表,默认表名仍为 `opentelemetry_traces`。v2 沿用下文介绍的 -Trace ID 分区规则、`service_name`、`trace_id` 和 `parent_span_id` 上的跳数索引、 -Append-only 模式,以及服务和操作辅助表。 +首次写入时会自动建表,默认表名为 `opentelemetry_traces`,可通过 OTLP/HTTP 请求中的 +`x-greptime-trace-table-name` 请求头自定义表名。v2 使用下文介绍的 Trace ID 分区规则、 +`service_name`、`trace_id` 和 `parent_span_id` 上的跳数索引、Append-only 模式, +以及服务和操作辅助表。 从 v1 切换到 v2 时,请使用新表。修改 Pipeline 请求头不会迁移已有数据:标记为 v1 的表会拒绝 v2 写入,反之亦然。已有 v1 表可以继续使用 v1 Pipeline。配置和 SQL 示例请参阅[写入与查询](./read-write.md)。 @@ -194,7 +195,7 @@ Create Table | CREATE TABLE IF NOT EXISTS "opentelemetry_traces" ( ## 通用表行为 -以下内容适用于 v1 和 v2。 +以下内容适用于 v2 和 v1。 ### 分区规则 diff --git a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/traces/read-write.md b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/traces/read-write.md index e14eb82d5..95333912c 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/traces/read-write.md +++ b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/traces/read-write.md @@ -35,6 +35,8 @@ Trace 也是 OpenTelemetry 中最广为接受的子协议,包含了良好的 立的用于收集和处理 OpenTelemetry 数据的服务。本文我们将介绍如何使用 OpenTelemetry Collector 将 traces 数据写入到 GreptimeDB。 + + #### 启动 OpenTelemetry Collector 你可以使用如下命令来快速启动一个 OpenTelemetry Collector 实例,此时 collector 会监听 `4317`(gRPC) 和 `4318`(HTTP) 端口: @@ -61,7 +63,7 @@ exporters: otlp_http: endpoint: "http://greptimedb:4000/v1/otlp" # GreptimeDB 的 OTLP 路径 headers: - x-greptime-pipeline-name: "greptime_trace_v1" + x-greptime-pipeline-name: "greptime_trace_v2" #authorization: "Basic " tls: insecure: true @@ -73,25 +75,29 @@ service: exporters: [otlp_http] ``` -#### 使用 greptime_trace_v2 写入 +按下文发送 Trace 后,GreptimeDB 会自动创建 `opentelemetry_traces` 表,并将属性存储为 +`JSON2`。如果 `opentelemetry_traces` 已作为 v1 表存在,请同时设置 +`x-greptime-trace-table-name`(例如 `"opentelemetry_traces_v2"`),将 v2 数据写入新表。 +SDK 直接写入时也使用相同的请求头。 + +#### 使用 greptime_trace_v1 写入 -上面的完整配置使用 v1。要使用 v2,请将其中的 `exporters` 配置替换为以下内容, -其余 receivers 和 service 配置保持不变: +上面的完整配置使用 `greptime_trace_v2`。如果需要打平属性列,请将其中的 `exporters` +配置替换为以下内容,其余 receivers 和 service 配置保持不变: ```yaml exporters: otlp_http: endpoint: "http://greptimedb:4000/v1/otlp" headers: - x-greptime-pipeline-name: "greptime_trace_v2" - x-greptime-trace-table-name: "opentelemetry_traces_v2" + x-greptime-pipeline-name: "greptime_trace_v1" + x-greptime-trace-table-name: "opentelemetry_traces_v1" #authorization: "Basic " tls: insecure: true ``` -请使用新表,避免向已有 v1 表写入 v2 数据。按下文发送 Trace 后,GreptimeDB 会自动 -创建 `opentelemetry_traces_v2`,并将属性存储为 JSON2。SDK 直接写入时也使用相同的请求头。 +请使用独立的表,避免在同一张表中混写 v1 和 v2 数据。 两个模型的差异请参阅[数据模型版本机制](./data-model.md#数据模型版本机制)。 #### 将 Trace 数据写入到 OpenTelemetry Collector @@ -133,7 +139,7 @@ GreptimeDB 的 OTEL 端点支持 Basic 认证。详情请参考 [鉴权](/user-g 在 OTLP 接口中,我们要求 HTTP 头 `x-greptime-pipeline-name` 作为必选参数。在这里 我们复用了日志接口中 Pipeline 的概念作为数据转化的机制。Trace 数据应使用内置的 -`greptime_trace_v1`(打平属性列)或 `greptime_trace_v2`(JSON2 属性)。 +`greptime_trace_v2`(JSON2 属性)或 `greptime_trace_v1`(打平属性列)。 有关模型差异和表选项,请参阅 [Trace 数据模型](./data-model.md)。切换模型时请使用独立的表。 自定义的 Pipeline 暂不支持。 @@ -159,16 +165,45 @@ GreptimeDB 内置的 Jaeger 兼容层使得用户可以直接复用市面上的 ### SQL +Trace 数据可以通过 SQL 查询。默认情况下,Trace 数据写入 `opentelemetry_traces` 表, +也可在写入时通过 `x-greptime-trace-table-name` 指定表名。 + +#### greptime_trace_v2 + +OpenTelemetry 属性键通常包含点号。请用双引号包住完整的键名,将其作为字面键读取, +而不是嵌套路径: + +```sql +SELECT * FROM public.opentelemetry_traces LIMIT 10; + +SELECT + timestamp, + trace_id, + service_name, + span_attributes."http.request.method"::STRING AS method, + span_attributes."http.response.status_code"::BIGINT AS status, + resource_attributes."service.name"::STRING AS resource_service +FROM public.opentelemetry_traces +WHERE span_attributes."http.response.status_code"::BIGINT >= 500 +ORDER BY timestamp DESC +LIMIT 20; +``` + +例如,`span_attributes."http.request.method"` 读取键 `http.request.method`,而 +`span_attributes.http.request.method` 读取嵌套对象。v1 中的 +`"span_attributes.http.request.method"` 表示打平后的表列,不适用于 v2。 +更多示例请参阅 [JSON2 查询语法](/user-guide/logs/json2.md#点号语法)。 +事件和链接仍使用 [JSON 函数](/reference/sql/functions/json.md)查询。 + #### greptime_trace_v1 -Trace 数据也可以通过 SQL 查询。默认 Trace 数据会写入 `opentelemetry_traces` 表中, -这个表名也可以在写入时通过 `x-greptime-trace-table-name` 来指定。通过 SQL 查询: +使用上面的 `greptime_trace_v1` 配置时,属性被打平为独立的列: ```sql -SELECT * FROM public.opentelemetry_traces \G +SELECT * FROM public.opentelemetry_traces_v1 \G ``` -使用上面的 v1 配置时,输出示例如下: +输出示例如下: ``` *************************** 1. row *************************** @@ -193,31 +228,4 @@ span_attributes.http.request.method: POST ... ``` -#### greptime_trace_v2 - -OpenTelemetry 属性键通常包含点号。请用双引号包住完整的键名,将其作为字面键读取, -而不是嵌套路径: - -```sql -SELECT * FROM public.opentelemetry_traces_v2 LIMIT 10; - -SELECT - timestamp, - trace_id, - service_name, - span_attributes."http.request.method"::STRING AS method, - span_attributes."http.response.status_code"::BIGINT AS status, - resource_attributes."service.name"::STRING AS resource_service -FROM public.opentelemetry_traces_v2 -WHERE span_attributes."http.response.status_code"::BIGINT >= 500 -ORDER BY timestamp DESC -LIMIT 20; -``` - -例如,`span_attributes."http.request.method"` 读取键 `http.request.method`,而 -`span_attributes.http.request.method` 读取嵌套对象。v1 中的 -`"span_attributes.http.request.method"` 表示打平后的表列,不适用于 v2。 -更多示例请参阅 [JSON2 查询语法](/user-guide/logs/json2.md#点号语法)。 -事件和链接仍使用 [JSON 函数](/reference/sql/functions/json.md)查询。 - 在下一节[数据模型](./data-model.md) 中我们会对这个表结构做详细介绍。 diff --git a/versioned_docs/version-1.3/greptimecloud/integrations/otlp.md b/versioned_docs/version-1.3/greptimecloud/integrations/otlp.md index 5c3de2d26..92289fdb7 100644 --- a/versioned_docs/version-1.3/greptimecloud/integrations/otlp.md +++ b/versioned_docs/version-1.3/greptimecloud/integrations/otlp.md @@ -44,7 +44,7 @@ exporters: authenticator: basicauth/client headers: x-greptime-db-name: '' - x-greptime-pipeline-name: 'greptime_trace_v1' + x-greptime-pipeline-name: 'greptime_trace_v2' otlphttp/logs: endpoint: 'https:///v1/otlp' auth: diff --git a/versioned_docs/version-1.3/reference/sql/information-schema/table-semantics.md b/versioned_docs/version-1.3/reference/sql/information-schema/table-semantics.md index 83a871965..209771761 100644 --- a/versioned_docs/version-1.3/reference/sql/information-schema/table-semantics.md +++ b/versioned_docs/version-1.3/reference/sql/information-schema/table-semantics.md @@ -67,7 +67,7 @@ The output is as follows: - `unknown` — could not be determined when the option was stamped. - `source`: The ingestion ecosystem that wrote the data. One of `opentelemetry`, `prometheus`, `influxdb`, `opentsdb`, `elasticsearch`, `loki`, `custom`, `mixed`, or `unknown`. `mixed` means one table received data from more than one source; `unknown` means it could not be determined. - `source_version`: The version of the source protocol. The Prometheus remote write path stamps `1.0` or `2.0`; other paths leave it empty. -- `pipeline`: A free-form identifier of the internal ingestion data model. Today the OTLP trace path stamps `greptime_trace_v1` or `greptime_trace_v2`, depending on the [selected trace pipeline](/user-guide/traces/data-model.md#data-model-versioning); other values can be set manually. It is the signal-agnostic successor to the `table_data_model` option. +- `pipeline`: A free-form identifier of the internal ingestion data model. Today the OTLP trace path stamps `greptime_trace_v2` or `greptime_trace_v1`, depending on the [selected trace pipeline](/user-guide/traces/data-model.md#data-model-versioning); other values can be set manually. It is the signal-agnostic successor to the `table_data_model` option. - `metadata_quality`: How the metric type metadata was obtained — that is, how much you can trust the `metric.type` value. One of: - `declared` — the ingestion protocol stated the instrument type explicitly (for example OTLP metrics carry the type). Trustworthy. - `inferred` — the type was guessed from the metric name (for example a Prometheus `_total` suffix is read as a counter). May be wrong for non-conventional names. diff --git a/versioned_docs/version-1.3/user-guide/ingest-data/for-observability/fluent-bit.md b/versioned_docs/version-1.3/user-guide/ingest-data/for-observability/fluent-bit.md index d225a47d5..3e8b9e6ff 100644 --- a/versioned_docs/version-1.3/user-guide/ingest-data/for-observability/fluent-bit.md +++ b/versioned_docs/version-1.3/user-guide/ingest-data/for-observability/fluent-bit.md @@ -95,7 +95,7 @@ Use a separate output for each signal because GreptimeDB uses signal-specific he Log_response_payload True Tls Off Tls.verify Off - Header X-Greptime-Pipeline-Name greptime_trace_v1 + Header X-Greptime-Pipeline-Name greptime_trace_v2 Header X-Greptime-DB-Name ``` @@ -103,7 +103,7 @@ Use a separate output for each signal because GreptimeDB uses signal-specific he - `Match`: The signal-specific tag configured on the corresponding Fluent Bit input. - `http_user` and `http_passwd`: The [authentication credentials](/user-guide/deployments-administration/authentication/static.md) for GreptimeDB. Add them to each output when authentication is enabled. -In this example, the OpenTelemetry OTLP/HTTP API is used. For signal-specific headers and options, see the OpenTelemetry API sections for [metrics](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api), [logs](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api-1), and [traces](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api-2). The trace output above uses `greptime_trace_v1`; see [trace data model versions](/user-guide/traces/data-model.md#data-model-versioning) to compare it with `greptime_trace_v2`. +In this example, the OpenTelemetry OTLP/HTTP API is used. For signal-specific headers and options, see the OpenTelemetry API sections for [metrics](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api), [logs](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api-1), and [traces](/user-guide/ingest-data/for-observability/opentelemetry.md#otlphttp-api-2). The trace output above uses `greptime_trace_v2`; see [trace data model versions](/user-guide/traces/data-model.md#data-model-versioning) to compare it with `greptime_trace_v1`. ## Prometheus Remote Write diff --git a/versioned_docs/version-1.3/user-guide/ingest-data/for-observability/opentelemetry.md b/versioned_docs/version-1.3/user-guide/ingest-data/for-observability/opentelemetry.md index fd180a0a9..46256e0ca 100644 --- a/versioned_docs/version-1.3/user-guide/ingest-data/for-observability/opentelemetry.md +++ b/versioned_docs/version-1.3/user-guide/ingest-data/for-observability/opentelemetry.md @@ -346,7 +346,7 @@ To send OpenTelemetry traces data to GreptimeDB through OpenTelemetry SDK librar - `Authorization`: `Basic` authentication. - `X-Greptime-DB-Name`: `` - `X-Greptime-Trace-Table-Name`: `` (optional) - The table name to store the traces. If not provided, the default table name is `opentelemetry_traces`. - - `X-Greptime-Pipeline-Name`: `greptime_trace_v1` or `greptime_trace_v2` (required) - The pipeline name to process the traces; see [trace data model versions](/user-guide/traces/data-model.md#data-model-versioning). + - `X-Greptime-Pipeline-Name`: `greptime_trace_v2` or `greptime_trace_v1` (required) - The pipeline name to process the traces; see [trace data model versions](/user-guide/traces/data-model.md#data-model-versioning). GreptimeDB accepts **protobuf encoded traces data** via **HTTP protocol**. @@ -357,11 +357,11 @@ You can directly send OpenTelemetry traces data to GreptimeDB, or use OpenTeleme ### Data Model See [Trace Data Modeling](/user-guide/traces/data-model.md) for table schemas, -attribute storage, and table options for `greptime_trace_v1` and `greptime_trace_v2`. +attribute storage, and table options for `greptime_trace_v2` and `greptime_trace_v1`. ### Schema Evolution and Partial Success -The `greptime_trace_v1` model automatically adds new flattened attribute columns. When a trace table already exists, GreptimeDB reconciles incoming attribute value types with the existing table schema. Compatible scalar values can be coerced to the existing column type, and existing `Int64` attribute columns may be widened to `Float64` when incoming values contain both integers and floats. +The `greptime_trace_v2` model stores attributes in `JSON2` columns without adding table columns for new attribute keys. If you use `greptime_trace_v1`, GreptimeDB automatically adds new flattened attribute columns and reconciles incoming attribute value types with the existing table schema: compatible scalar values can be coerced to the existing column type, and existing `Int64` attribute columns may be widened to `Float64` when incoming values contain both integers and floats. If some spans in a trace request cannot be written because of incompatible schema or values, GreptimeDB may still accept the other spans and return an OTLP `partial_success` response with `rejected_spans` and `error_message`. If all spans are rejected, the endpoint returns a `400 Bad Request` response. diff --git a/versioned_docs/version-1.3/user-guide/ingest-data/for-observability/otel-collector.md b/versioned_docs/version-1.3/user-guide/ingest-data/for-observability/otel-collector.md index 41d0a3f4f..62bacb949 100644 --- a/versioned_docs/version-1.3/user-guide/ingest-data/for-observability/otel-collector.md +++ b/versioned_docs/version-1.3/user-guide/ingest-data/for-observability/otel-collector.md @@ -30,7 +30,7 @@ exporters: # authenticator: basicauth/client headers: # x-greptime-db-name: '' - x-greptime-pipeline-name: 'greptime_trace_v1' + x-greptime-pipeline-name: 'greptime_trace_v2' tls: insecure: true otlp_http/logs: diff --git a/versioned_docs/version-1.3/user-guide/integrations/grafana.md b/versioned_docs/version-1.3/user-guide/integrations/grafana.md index 963338ba3..720e4b272 100644 --- a/versioned_docs/version-1.3/user-guide/integrations/grafana.md +++ b/versioned_docs/version-1.3/user-guide/integrations/grafana.md @@ -6,7 +6,9 @@ description: Steps to configure GreptimeDB as a data source in Grafana using dif # Grafana GreptimeDB can be configured as a [Grafana data source](https://grafana.com/docs/grafana/latest/datasources/add-a-data-source/). -You have the option to connect GreptimeDB with Grafana using one of three data sources: [GreptimeDB](#greptimedb-data-source-plugin), [Prometheus](#prometheus-data-source), or [MySQL](#mysql-data-source). +Connect using the [GreptimeDB plugin](#greptimedb-data-source-plugin), [Prometheus](#prometheus-data-source), +or [MySQL](#mysql-data-source). To search for and view traces, use Grafana's +[Jaeger data source](/user-guide/query-data/jaeger.md#configure-the-grafana-jaeger-plugin). ## GreptimeDB data source plugin @@ -101,11 +103,11 @@ series data: it calculates time intervals and returns the start of the interval nearest to each timestamp, so rows are grouped into time-based bins (windows). Apply an aggregate or selector function to each window. -Example (or raw SQL): +This raw SQL query sums input tokens per time bucket from a `greptime_trace_v2` table. ```sql SELECT date_bin('$__interval', timestamp) AS time, - SUM(`span_attributes.gen_ai.usage.input_tokens`) AS input_tokens + SUM(span_attributes."gen_ai.usage.input_tokens"::BIGINT) AS input_tokens FROM opentelemetry_traces WHERE $__timeFilter(timestamp) GROUP BY time @@ -167,7 +169,9 @@ Performs an approximate time range query based on the value of context columns i ### Traces Query -Select the `Traces` query type for distributed tracing data. +Select the `Traces` query type to view traces with the GreptimeDB plugin. +For `greptime_trace_v2` tables, use Grafana's +[Jaeger data source](/user-guide/query-data/jaeger.md#configure-the-grafana-jaeger-plugin) to view spans and their attributes. | Main Setting | Description | | :-------------------- | :------------------------------------------------------------------------------------------------------ | @@ -180,17 +184,16 @@ Select the `Traces` query type for distributed tracing data. | **Start Time Column** | Default value: `timestamp` | | **Duration Time Column** | Default value: `duration_nano` | | **Duration Unit** | Default value: `nanoseconds` | -| **Tags Column** | Multiple selections allowed. Corresponds to columns starting with `span_attributes` (e.g., `span_attributes.http.method`). | -| **Service Tags Column** | Multiple selections allowed. Corresponds to columns starting with `resource_attributes` (e.g., `resource_attributes.host.name`). | +| **Tags Column** | For `greptime_trace_v1`, select one or more flattened span attribute columns, such as `span_attributes.http.request.method`. | +| **Service Tags Column** | For `greptime_trace_v1`, select one or more flattened resource attribute columns, such as `resource_attributes.host.name`. | ![Traces](/grafana/traceconfig.png) #### Attribute Auto-Discovery -When the Trace ID query uses `SELECT *`, the plugin automatically discovers -all columns starting with `span_attributes.` and `resource_attributes.` and -includes them as expandable tags in the waterfall view. No need to manually -enumerate every attribute column. +For `greptime_trace_v1` tables, when the Trace ID query uses `SELECT *`, the plugin +shows columns with the `span_attributes.` and `resource_attributes.` prefixes as +expandable tags in the waterfall. ### SQL Macros @@ -277,8 +280,8 @@ Enable **Auto-Select Columns** to automatically include them in log queries. | Duration Time Column | Duration value | `duration_nano` | | Duration Unit | Unit of duration column | `nanoseconds` | | Start Time Column | Span start time | `timestamp` | -| Tags Column | Span attributes prefix | `span_attributes` | -| Service Tags Column | Resource attributes prefix | `resource_attributes` | +| Tags Column | Prefix for flattened span attributes in `greptime_trace_v1` | `span_attributes` | +| Service Tags Column | Prefix for flattened resource attributes in `greptime_trace_v1` | `resource_attributes` | #### OTel Preset diff --git a/versioned_docs/version-1.3/user-guide/semantic-layer/declaring-entities.md b/versioned_docs/version-1.3/user-guide/semantic-layer/declaring-entities.md index ff88a4a12..73cec7978 100644 --- a/versioned_docs/version-1.3/user-guide/semantic-layer/declaring-entities.md +++ b/versioned_docs/version-1.3/user-guide/semantic-layer/declaring-entities.md @@ -17,10 +17,10 @@ Conventions ship with the binary and are not configurable. An explicit declarati ### OTLP trace tables -Tables with `table_data_model` set to the `greptime_trace_v1` or `greptime_trace_v2` +Tables with `table_data_model` set to the `greptime_trace_v2` or `greptime_trace_v1` [trace data model](/user-guide/traces/data-model.md#data-model-versioning) -receive the following entity declarations without additional entity options. V1 -reads flattened attribute columns; v2 reads JSON2 attributes using the same +receive the following entity declarations without additional entity options. V2 +reads JSON2 attributes and v1 reads flattened attribute columns, using the same declaration names: | Entity | Identifying columns | Descriptive columns | diff --git a/versioned_docs/version-1.3/user-guide/semantic-layer/table-semantics.md b/versioned_docs/version-1.3/user-guide/semantic-layer/table-semantics.md index b3c736129..4587e4af3 100644 --- a/versioned_docs/version-1.3/user-guide/semantic-layer/table-semantics.md +++ b/versioned_docs/version-1.3/user-guide/semantic-layer/table-semantics.md @@ -24,7 +24,7 @@ The whitelist is closed: an unrecognized key under the prefix (such as `greptime | `greptime.semantic.signal_type` | The telemetry signal the table represents. | `metric` / `trace` / `log` / `event` / `unknown` | | `greptime.semantic.source` | The ingestion ecosystem that wrote the data. | `opentelemetry` / `prometheus` / `influxdb` / `opentsdb` / `loki` / `elasticsearch` / `custom` / `mixed` / `unknown` | | `greptime.semantic.source_version` | The source protocol version. Stamped by the Prometheus remote write path. | `1.0` / `2.0` | -| `greptime.semantic.pipeline` | The internal ingestion data model. The signal-agnostic successor to `table_data_model`; for traces, see [trace data model versions](/user-guide/traces/data-model.md#data-model-versioning). | `greptime_trace_v1` / `greptime_trace_v2` | +| `greptime.semantic.pipeline` | The internal ingestion data model. The signal-agnostic successor to `table_data_model`; for traces, see [trace data model versions](/user-guide/traces/data-model.md#data-model-versioning). | `greptime_trace_v2` / `greptime_trace_v1` | ### Trace keys @@ -53,7 +53,7 @@ Supported auto-create paths stamp identity (`signal_type` + `source`). OTLP metr | Ingestion path | `signal_type` | `source` | Additional keys | | --- | --- | --- | --- | | OTLP metrics | `metric` | `opentelemetry` | `metric.type`, `metric.unit`, `metric.temporality`, `metric.metadata_quality` = `declared`, `metric.original_name` | -| OTLP traces | `trace` | `opentelemetry` | `pipeline` = `greptime_trace_v1` or `greptime_trace_v2` (see [trace data model versions](/user-guide/traces/data-model.md#data-model-versioning)), `trace.conventions` | +| OTLP traces | `trace` | `opentelemetry` | `pipeline` = `greptime_trace_v2` or `greptime_trace_v1` (see [trace data model versions](/user-guide/traces/data-model.md#data-model-versioning)), `trace.conventions` | | OTLP logs | `log` | `opentelemetry` | — | | Prometheus remote write | `metric` | `prometheus` | `source_version`, `metric.metadata_quality` = `inferred` | | InfluxDB line protocol | `metric` | `influxdb` | identity only | diff --git a/versioned_docs/version-1.3/user-guide/traces/data-model.md b/versioned_docs/version-1.3/user-guide/traces/data-model.md index 447db59a7..0785e1260 100644 --- a/versioned_docs/version-1.3/user-guide/traces/data-model.md +++ b/versioned_docs/version-1.3/user-guide/traces/data-model.md @@ -21,14 +21,15 @@ the moment, only built-in pipelines are supported. First, the data types and features in GreptimeDB are evolving. For forward-compatibility, we use the pipeline name for data model -versioning. Currently we have the following built-in pipeline for trace: +versioning. Currently we have the following built-in pipelines for traces: -- `greptime_trace_v1`: Flattens attributes into individual table columns. - `greptime_trace_v2`: Stores attributes in three fixed `JSON2` columns. +- `greptime_trace_v1`: Flattens attributes into individual table columns. Specify the data model in OpenTelemetry OTLP/HTTP requests with the -`x-greptime-pipeline-name` header. Choose v1 for flattened attribute columns, -or v2 for JSON2 attributes without adding a table column for every attribute key. +`x-greptime-pipeline-name` header. Choose `greptime_trace_v2` for JSON2 attributes +without adding a table column for every attribute key, or `greptime_trace_v1` for +flattened attribute columns. We may introduce new data models by adding new available pipeline names. Note that a new pipeline may not be compatible with previous ones, so you are @@ -58,10 +59,11 @@ Unlike v1, v2 keeps `service.name` in `resource_attributes` as well as extractin it into `service_name`. If the resource does not provide a usable service name, the tag is `NULL`. -The table is created automatically on the first write. The default table name -is still `opentelemetry_traces`. V2 uses the same trace-ID partitioning, skipping -indexes on `service_name`, `trace_id`, and `parent_span_id`, append-only mode, -and auxiliary service/operation tables described below. +The table is created automatically on the first write. By default, trace data is +stored in `opentelemetry_traces`; set the `x-greptime-trace-table-name` header in +OTLP/HTTP requests to customize the table name. V2 uses the trace-ID partitioning, +skipping indexes on `service_name`, `trace_id`, and `parent_span_id`, append-only +mode, and auxiliary service/operation tables described below. Use a new table when switching from v1 to v2. Changing the pipeline header does not migrate existing data: writes using v2 are rejected for a table marked as @@ -224,7 +226,7 @@ Create Table | CREATE TABLE IF NOT EXISTS "opentelemetry_traces" ( ## Shared Table Behavior -The following behavior applies to both v1 and v2. +The following behavior applies to both v2 and v1. ### Partition Rules diff --git a/versioned_docs/version-1.3/user-guide/traces/read-write.md b/versioned_docs/version-1.3/user-guide/traces/read-write.md index 37a466a2c..ad88edf3b 100644 --- a/versioned_docs/version-1.3/user-guide/traces/read-write.md +++ b/versioned_docs/version-1.3/user-guide/traces/read-write.md @@ -38,6 +38,8 @@ follow the guide for endpoint and parameters. vendor-neutral service for collecting and processing OpenTelemetry data. You can also configure it to send trace data to GreptimeDB using OTLP/HTTP. + + #### Start OpenTelemetry Collector You can use the following command to quickly start an OpenTelemetry Collector @@ -65,7 +67,7 @@ exporters: otlp_http: endpoint: "http://greptimedb:4000/v1/otlp" # Replace greptimedb with your setup headers: - x-greptime-pipeline-name: "greptime_trace_v1" + x-greptime-pipeline-name: "greptime_trace_v2" #authorization: "Basic " tls: insecure: true @@ -77,26 +79,31 @@ service: exporters: [otlp_http] ``` -#### Ingest with greptime_trace_v2 +Sending traces as described below automatically creates `opentelemetry_traces` +with `JSON2` attributes. If `opentelemetry_traces` already exists as a v1 table, +also set `x-greptime-trace-table-name` (for example `"opentelemetry_traces_v2"`) +so v2 writes go to a new table. Use the same headers when writing directly from +an SDK. + +#### Ingest with greptime_trace_v1 -The complete configuration above uses v1. To use v2, replace its `exporters` -section with the following; keep the receivers and service configuration: +The complete configuration above uses `greptime_trace_v2`. If you need flattened +attribute columns instead, replace its `exporters` section with the following; +keep the receivers and service configuration: ```yaml exporters: otlp_http: endpoint: "http://greptimedb:4000/v1/otlp" headers: - x-greptime-pipeline-name: "greptime_trace_v2" - x-greptime-trace-table-name: "opentelemetry_traces_v2" + x-greptime-pipeline-name: "greptime_trace_v1" + x-greptime-trace-table-name: "opentelemetry_traces_v1" #authorization: "Basic " tls: insecure: true ``` -Use a new table to avoid sending v2 data to an existing v1 table. Sending traces -as described below automatically creates `opentelemetry_traces_v2` with JSON2 -attributes. Use the same headers when writing directly from an SDK. +Use a separate table to avoid mixing v1 and v2 data in the same table. See [how the trace data models differ](./data-model.md#data-model-versioning). #### Write Trace Data to OpenTelemetry Collector @@ -140,8 +147,8 @@ The GreptimeDB OTEL endpoint supports Basic authentication. For details, please The HTTP header `x-greptime-pipeline-name` is required for ingesting trace data. Here we reuse the Pipeline concept of GreptimeDB for data -transformation. Use the built-in `greptime_trace_v1` pipeline for flattened -attribute columns, or `greptime_trace_v2` for JSON2 attributes. See +transformation. Use the built-in `greptime_trace_v2` pipeline for JSON2 +attributes, or `greptime_trace_v1` for flattened attribute columns. See [Trace Data Modeling](./data-model.md) for model differences and table options. Use a separate table when switching models. No custom pipeline is allowed for the moment. @@ -167,20 +174,48 @@ docs](/user-guide/query-data/jaeger.md). ### SQL -#### greptime_trace_v1 +All data in GreptimeDB can be queried with SQL over HTTP, MySQL, or PostgreSQL. +By default, trace data is written into `opentelemetry_traces`, customizable via +the `x-greptime-trace-table-name` header. + +#### greptime_trace_v2 + +OpenTelemetry attribute keys often contain dots. Quote the entire key to read +it as a literal JSON key rather than a nested path: + +```sql +SELECT * FROM public.opentelemetry_traces LIMIT 10; + +SELECT + timestamp, + trace_id, + service_name, + span_attributes."http.request.method"::STRING AS method, + span_attributes."http.response.status_code"::BIGINT AS status, + resource_attributes."service.name"::STRING AS resource_service +FROM public.opentelemetry_traces +WHERE span_attributes."http.response.status_code"::BIGINT >= 500 +ORDER BY timestamp DESC +LIMIT 20; +``` + +For example, `span_attributes."http.request.method"` reads the key +`http.request.method`, while `span_attributes.http.request.method` reads nested +objects. The v1 form `"span_attributes.http.request.method"` names a flattened +table column and does not apply to v2. See [JSON2 query syntax](/user-guide/logs/json2.md#dot-syntax) +for more examples. Events and links continue to use the +[JSON functions](/reference/sql/functions/json.md). -All data in GreptimeDB is available for query using SQL, via MySQL and other -transport protocol. +#### greptime_trace_v1 -By default, trace data is written into the table called -`opentelemetry_traces`. The table name is customizable via header -`x-greptime-trace-table-name`. You can run SQL queries against the table: +For the `greptime_trace_v1` configuration above, attributes are flattened into +individual columns: ```sql -SELECT * FROM public.opentelemetry_traces \G +SELECT * FROM public.opentelemetry_traces_v1 \G ``` -For the v1 configuration above, an example output is like +Example output: ``` *************************** 1. row *************************** @@ -205,33 +240,5 @@ span_attributes.http.request.method: POST ... ``` -#### greptime_trace_v2 - -OpenTelemetry attribute keys often contain dots. Quote the entire key to read -it as a literal JSON key rather than a nested path: - -```sql -SELECT * FROM public.opentelemetry_traces_v2 LIMIT 10; - -SELECT - timestamp, - trace_id, - service_name, - span_attributes."http.request.method"::STRING AS method, - span_attributes."http.response.status_code"::BIGINT AS status, - resource_attributes."service.name"::STRING AS resource_service -FROM public.opentelemetry_traces_v2 -WHERE span_attributes."http.response.status_code"::BIGINT >= 500 -ORDER BY timestamp DESC -LIMIT 20; -``` - -For example, `span_attributes."http.request.method"` reads the key -`http.request.method`, while `span_attributes.http.request.method` reads nested -objects. The v1 form `"span_attributes.http.request.method"` names a flattened -table column and does not apply to v2. See [JSON2 query syntax](/user-guide/logs/json2.md#dot-syntax) -for more examples. Events and links continue to use the -[JSON functions](/reference/sql/functions/json.md). - We will cover more information about the table structure in [Data Model](./data-model.md) section. From 59fe0bd9a80748a4fd7d080af30911842706f5b5 Mon Sep 17 00:00:00 2001 From: shuiyisong Date: Thu, 26 Nov 2026 16:46:41 +0800 Subject: [PATCH 3/4] docs: warn against writing v2 traces to v1 tables Signed-off-by: shuiyisong --- docs/greptimecloud/integrations/otlp.md | 2 ++ .../for-observability/fluent-bit.md | 2 ++ .../for-observability/opentelemetry.md | 2 ++ .../for-observability/otel-collector.md | 2 ++ docs/user-guide/traces/read-write.md | 18 ++++++++++++------ .../current/greptimecloud/integrations/otlp.md | 1 + .../for-observability/fluent-bit.md | 2 ++ .../for-observability/opentelemetry.md | 2 ++ .../for-observability/otel-collector.md | 2 ++ .../current/user-guide/traces/read-write.md | 15 ++++++++++----- .../greptimecloud/integrations/otlp.md | 1 + .../for-observability/fluent-bit.md | 2 ++ .../for-observability/opentelemetry.md | 2 ++ .../for-observability/otel-collector.md | 2 ++ .../user-guide/traces/read-write.md | 15 ++++++++++----- .../greptimecloud/integrations/otlp.md | 2 ++ .../for-observability/fluent-bit.md | 2 ++ .../for-observability/opentelemetry.md | 2 ++ .../for-observability/otel-collector.md | 2 ++ .../user-guide/traces/read-write.md | 18 ++++++++++++------ 20 files changed, 74 insertions(+), 22 deletions(-) diff --git a/docs/greptimecloud/integrations/otlp.md b/docs/greptimecloud/integrations/otlp.md index 92289fdb7..ec46239b6 100644 --- a/docs/greptimecloud/integrations/otlp.md +++ b/docs/greptimecloud/integrations/otlp.md @@ -74,6 +74,8 @@ service: exporters: [otlphttp/metrics] ``` +If `opentelemetry_traces` is a v1 table, [send v2 traces to a new table](/user-guide/traces/read-write.md#existing-v1-trace-tables). + ## Grafana Alloy If you prefer to use [Grafana Alloy](https://grafana.com/docs/alloy/latest/)'s OpenTelemetry exporter, you can use the following configuration to send your data. diff --git a/docs/user-guide/ingest-data/for-observability/fluent-bit.md b/docs/user-guide/ingest-data/for-observability/fluent-bit.md index 3e8b9e6ff..250dee45d 100644 --- a/docs/user-guide/ingest-data/for-observability/fluent-bit.md +++ b/docs/user-guide/ingest-data/for-observability/fluent-bit.md @@ -99,6 +99,8 @@ Use a separate output for each signal because GreptimeDB uses signal-specific he Header X-Greptime-DB-Name ``` +If `opentelemetry_traces` is a v1 table, [send v2 traces to a new table](/user-guide/traces/read-write.md#existing-v1-trace-tables). + - `Metrics_uri`, `Logs_uri`, and `Traces_uri`: The endpoints for metrics, logs, and traces. - `Match`: The signal-specific tag configured on the corresponding Fluent Bit input. - `http_user` and `http_passwd`: The [authentication credentials](/user-guide/deployments-administration/authentication/static.md) for GreptimeDB. Add them to each output when authentication is enabled. diff --git a/docs/user-guide/ingest-data/for-observability/opentelemetry.md b/docs/user-guide/ingest-data/for-observability/opentelemetry.md index 202823ec7..90ac4b385 100644 --- a/docs/user-guide/ingest-data/for-observability/opentelemetry.md +++ b/docs/user-guide/ingest-data/for-observability/opentelemetry.md @@ -400,6 +400,8 @@ To send OpenTelemetry traces data to GreptimeDB through OpenTelemetry SDK librar - `X-Greptime-Trace-Table-Name`: `` (optional) - The table name to store the traces. If not provided, the default table name is `opentelemetry_traces`. - `X-Greptime-Pipeline-Name`: `greptime_trace_v2` or `greptime_trace_v1` (required) - The pipeline name to process the traces; see [trace data model versions](/user-guide/traces/data-model.md#data-model-versioning). +If `opentelemetry_traces` is a v1 table, [send v2 traces to a new table](/user-guide/traces/read-write.md#existing-v1-trace-tables). + GreptimeDB accepts **protobuf encoded traces data** via **HTTP protocol**. ### Example Code diff --git a/docs/user-guide/ingest-data/for-observability/otel-collector.md b/docs/user-guide/ingest-data/for-observability/otel-collector.md index 62bacb949..17053543d 100644 --- a/docs/user-guide/ingest-data/for-observability/otel-collector.md +++ b/docs/user-guide/ingest-data/for-observability/otel-collector.md @@ -68,6 +68,8 @@ service: exporters: [otlp_http/metrics] ``` +If `opentelemetry_traces` is a v1 table, [send v2 traces to a new table](/user-guide/traces/read-write.md#existing-v1-trace-tables). + In the above configuration, we define a receiver `otlp` that can receive data from OpenTelemetry. We also define three exporters: `otlp_http/traces`, `otlp_http/logs`, and `otlp_http/metrics`, which send data to the OTLP endpoint of GreptimeDB. Based on the OTLP/HTTP protocol, we have added some headers to specify certain parameters, such as `x-greptime-pipeline-name` and `x-greptime-log-table-name`: diff --git a/docs/user-guide/traces/read-write.md b/docs/user-guide/traces/read-write.md index ad88edf3b..6981977d3 100644 --- a/docs/user-guide/traces/read-write.md +++ b/docs/user-guide/traces/read-write.md @@ -52,7 +52,8 @@ docker run --rm \ otel/opentelemetry-collector-contrib:0.165.0 ``` -The content of the `config.yaml` file is as follows: +With the following `config.yaml`, the first write to a new database creates +`opentelemetry_traces` with `JSON2` attribute columns. ```yaml receivers: @@ -79,11 +80,16 @@ service: exporters: [otlp_http] ``` -Sending traces as described below automatically creates `opentelemetry_traces` -with `JSON2` attributes. If `opentelemetry_traces` already exists as a v1 table, -also set `x-greptime-trace-table-name` (for example `"opentelemetry_traces_v2"`) -so v2 writes go to a new table. Use the same headers when writing directly from -an SDK. +#### Existing v1 trace tables + +:::warning + +If `greptime_trace_v1` created `opentelemetry_traces`, GreptimeDB rejects v2 writes +to that table. When you set `x-greptime-pipeline-name` to `greptime_trace_v2`, +also set `x-greptime-trace-table-name` to a new table name such as +`opentelemetry_traces_v2`. Use both headers for direct SDK writes as well. + +::: #### Ingest with greptime_trace_v1 diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/greptimecloud/integrations/otlp.md b/i18n/zh/docusaurus-plugin-content-docs/current/greptimecloud/integrations/otlp.md index 85f40056e..83ea6dbfc 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/greptimecloud/integrations/otlp.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/greptimecloud/integrations/otlp.md @@ -72,6 +72,7 @@ service: exporters: [otlphttp/metrics] ``` +如果 `opentelemetry_traces` 是 v1 表,请[将 v2 数据写入新表](/user-guide/traces/read-write.md#existing-v1-trace-tables)。 ## Grafana Alloy diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/fluent-bit.md b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/fluent-bit.md index 7b7b36cc6..34cc98b5a 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/fluent-bit.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/fluent-bit.md @@ -98,6 +98,8 @@ GreptimeDB 也可以配置为 OpenTelemetry 收集器。使用 Fluent Bit 的 [O Header X-Greptime-DB-Name ``` +如果 `opentelemetry_traces` 是 v1 表,请[将 v2 数据写入新表](/user-guide/traces/read-write.md#existing-v1-trace-tables)。 + - `Metrics_uri`、`Logs_uri` 和 `Traces_uri`:分别用于发送 metrics、logs 和 traces 的端点。 - `Match`:在对应 Fluent Bit input 中配置的 signal tag。 - `http_user` 和 `http_passwd`:GreptimeDB 的[认证凭据](/user-guide/deployments-administration/authentication/static.md)。启用鉴权时,请将它们添加到每个 output 中。 diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/opentelemetry.md b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/opentelemetry.md index 3b1ada99e..ff0d1caf9 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/opentelemetry.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/opentelemetry.md @@ -383,6 +383,8 @@ GreptimeDB 支持直接写入 OpenTelemetry 协议的 traces 数据,并内置 - `X-Greptime-Trace-Table-Name`: ``(可选)- 存储 traces 的表名。如果未提供,默认表名为 `opentelemetry_traces`。 - `X-Greptime-Pipeline-Name`: `greptime_trace_v2` 或 `greptime_trace_v1`(必选)- 处理 traces 的 pipeline 名称,详见 [Trace 数据模型的版本差异](/user-guide/traces/data-model.md#数据模型版本机制)。 +如果 `opentelemetry_traces` 是 v1 表,请[将 v2 数据写入新表](/user-guide/traces/read-write.md#existing-v1-trace-tables)。 + GreptimeDB 会通过 **HTTP 协议** 接受 **protobuf 编码的 traces 数据**。 ### 示例代码 diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/otel-collector.md b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/otel-collector.md index 5eff833c8..b888933ad 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/otel-collector.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/ingest-data/for-observability/otel-collector.md @@ -68,6 +68,8 @@ service: exporters: [otlp_http/metrics] ``` +如果 `opentelemetry_traces` 是 v1 表,请[将 v2 数据写入新表](/user-guide/traces/read-write.md#existing-v1-trace-tables)。 + 在上面的配置中,我们定义了一个接收器 `otlp`,它可以接收来自 OpenTelemetry 的数据。我们还定义了三个导出器 `otlp_http/traces`、`otlp_http/logs` 和 `otlp_http/metrics`,它们将数据发送到 GreptimeDB 的 OTLP 路径。 基于 OTLP/HTTP 协议,我们增加了一些 header 用来指定参数,比如 `x-greptime-pipeline-name` 和 `x-greptime-log-table-name`: diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/traces/read-write.md b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/traces/read-write.md index 95333912c..a1dc6612a 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/traces/read-write.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/traces/read-write.md @@ -48,7 +48,7 @@ docker run --rm \ otel/opentelemetry-collector-contrib:0.165.0 ``` -其中 `config.yaml` 文件内容如下: +使用以下 `config.yaml` 配置首次向新数据库写入 Trace 时,GreptimeDB 会创建 `opentelemetry_traces` 表,并将属性存储在 `JSON2` 列中。 ```yaml receivers: @@ -75,10 +75,15 @@ service: exporters: [otlp_http] ``` -按下文发送 Trace 后,GreptimeDB 会自动创建 `opentelemetry_traces` 表,并将属性存储为 -`JSON2`。如果 `opentelemetry_traces` 已作为 v1 表存在,请同时设置 -`x-greptime-trace-table-name`(例如 `"opentelemetry_traces_v2"`),将 v2 数据写入新表。 -SDK 直接写入时也使用相同的请求头。 +#### 已有的 v1 Trace 表 {#existing-v1-trace-tables} + +:::warning + +如果 `opentelemetry_traces` 由 `greptime_trace_v1` 创建,GreptimeDB 会拒绝向该表写入 v2 数据。 +将 `x-greptime-pipeline-name` 改为 `greptime_trace_v2` 时,请同时将 `x-greptime-trace-table-name` +设为新表名,例如 `opentelemetry_traces_v2`。通过 SDK 直接写入时也应设置这两个请求头。 + +::: #### 使用 greptime_trace_v1 写入 diff --git a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/greptimecloud/integrations/otlp.md b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/greptimecloud/integrations/otlp.md index 85f40056e..83ea6dbfc 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/greptimecloud/integrations/otlp.md +++ b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/greptimecloud/integrations/otlp.md @@ -72,6 +72,7 @@ service: exporters: [otlphttp/metrics] ``` +如果 `opentelemetry_traces` 是 v1 表,请[将 v2 数据写入新表](/user-guide/traces/read-write.md#existing-v1-trace-tables)。 ## Grafana Alloy diff --git a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/ingest-data/for-observability/fluent-bit.md b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/ingest-data/for-observability/fluent-bit.md index 7b7b36cc6..34cc98b5a 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/ingest-data/for-observability/fluent-bit.md +++ b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/ingest-data/for-observability/fluent-bit.md @@ -98,6 +98,8 @@ GreptimeDB 也可以配置为 OpenTelemetry 收集器。使用 Fluent Bit 的 [O Header X-Greptime-DB-Name ``` +如果 `opentelemetry_traces` 是 v1 表,请[将 v2 数据写入新表](/user-guide/traces/read-write.md#existing-v1-trace-tables)。 + - `Metrics_uri`、`Logs_uri` 和 `Traces_uri`:分别用于发送 metrics、logs 和 traces 的端点。 - `Match`:在对应 Fluent Bit input 中配置的 signal tag。 - `http_user` 和 `http_passwd`:GreptimeDB 的[认证凭据](/user-guide/deployments-administration/authentication/static.md)。启用鉴权时,请将它们添加到每个 output 中。 diff --git a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/ingest-data/for-observability/opentelemetry.md b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/ingest-data/for-observability/opentelemetry.md index a9ddf52ee..dfe4f4f05 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/ingest-data/for-observability/opentelemetry.md +++ b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/ingest-data/for-observability/opentelemetry.md @@ -338,6 +338,8 @@ GreptimeDB 支持直接写入 OpenTelemetry 协议的 traces 数据,并内置 - `X-Greptime-Trace-Table-Name`: ``(可选)- 存储 traces 的表名。如果未提供,默认表名为 `opentelemetry_traces`。 - `X-Greptime-Pipeline-Name`: `greptime_trace_v2` 或 `greptime_trace_v1`(必选)- 处理 traces 的 pipeline 名称,详见 [Trace 数据模型的版本差异](/user-guide/traces/data-model.md#数据模型版本机制)。 +如果 `opentelemetry_traces` 是 v1 表,请[将 v2 数据写入新表](/user-guide/traces/read-write.md#existing-v1-trace-tables)。 + GreptimeDB 会通过 **HTTP 协议** 接受 **protobuf 编码的 traces 数据**。 ### 示例代码 diff --git a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/ingest-data/for-observability/otel-collector.md b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/ingest-data/for-observability/otel-collector.md index 5eff833c8..b888933ad 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/ingest-data/for-observability/otel-collector.md +++ b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/ingest-data/for-observability/otel-collector.md @@ -68,6 +68,8 @@ service: exporters: [otlp_http/metrics] ``` +如果 `opentelemetry_traces` 是 v1 表,请[将 v2 数据写入新表](/user-guide/traces/read-write.md#existing-v1-trace-tables)。 + 在上面的配置中,我们定义了一个接收器 `otlp`,它可以接收来自 OpenTelemetry 的数据。我们还定义了三个导出器 `otlp_http/traces`、`otlp_http/logs` 和 `otlp_http/metrics`,它们将数据发送到 GreptimeDB 的 OTLP 路径。 基于 OTLP/HTTP 协议,我们增加了一些 header 用来指定参数,比如 `x-greptime-pipeline-name` 和 `x-greptime-log-table-name`: diff --git a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/traces/read-write.md b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/traces/read-write.md index 95333912c..a1dc6612a 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/traces/read-write.md +++ b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/user-guide/traces/read-write.md @@ -48,7 +48,7 @@ docker run --rm \ otel/opentelemetry-collector-contrib:0.165.0 ``` -其中 `config.yaml` 文件内容如下: +使用以下 `config.yaml` 配置首次向新数据库写入 Trace 时,GreptimeDB 会创建 `opentelemetry_traces` 表,并将属性存储在 `JSON2` 列中。 ```yaml receivers: @@ -75,10 +75,15 @@ service: exporters: [otlp_http] ``` -按下文发送 Trace 后,GreptimeDB 会自动创建 `opentelemetry_traces` 表,并将属性存储为 -`JSON2`。如果 `opentelemetry_traces` 已作为 v1 表存在,请同时设置 -`x-greptime-trace-table-name`(例如 `"opentelemetry_traces_v2"`),将 v2 数据写入新表。 -SDK 直接写入时也使用相同的请求头。 +#### 已有的 v1 Trace 表 {#existing-v1-trace-tables} + +:::warning + +如果 `opentelemetry_traces` 由 `greptime_trace_v1` 创建,GreptimeDB 会拒绝向该表写入 v2 数据。 +将 `x-greptime-pipeline-name` 改为 `greptime_trace_v2` 时,请同时将 `x-greptime-trace-table-name` +设为新表名,例如 `opentelemetry_traces_v2`。通过 SDK 直接写入时也应设置这两个请求头。 + +::: #### 使用 greptime_trace_v1 写入 diff --git a/versioned_docs/version-1.3/greptimecloud/integrations/otlp.md b/versioned_docs/version-1.3/greptimecloud/integrations/otlp.md index 92289fdb7..ec46239b6 100644 --- a/versioned_docs/version-1.3/greptimecloud/integrations/otlp.md +++ b/versioned_docs/version-1.3/greptimecloud/integrations/otlp.md @@ -74,6 +74,8 @@ service: exporters: [otlphttp/metrics] ``` +If `opentelemetry_traces` is a v1 table, [send v2 traces to a new table](/user-guide/traces/read-write.md#existing-v1-trace-tables). + ## Grafana Alloy If you prefer to use [Grafana Alloy](https://grafana.com/docs/alloy/latest/)'s OpenTelemetry exporter, you can use the following configuration to send your data. diff --git a/versioned_docs/version-1.3/user-guide/ingest-data/for-observability/fluent-bit.md b/versioned_docs/version-1.3/user-guide/ingest-data/for-observability/fluent-bit.md index 3e8b9e6ff..250dee45d 100644 --- a/versioned_docs/version-1.3/user-guide/ingest-data/for-observability/fluent-bit.md +++ b/versioned_docs/version-1.3/user-guide/ingest-data/for-observability/fluent-bit.md @@ -99,6 +99,8 @@ Use a separate output for each signal because GreptimeDB uses signal-specific he Header X-Greptime-DB-Name ``` +If `opentelemetry_traces` is a v1 table, [send v2 traces to a new table](/user-guide/traces/read-write.md#existing-v1-trace-tables). + - `Metrics_uri`, `Logs_uri`, and `Traces_uri`: The endpoints for metrics, logs, and traces. - `Match`: The signal-specific tag configured on the corresponding Fluent Bit input. - `http_user` and `http_passwd`: The [authentication credentials](/user-guide/deployments-administration/authentication/static.md) for GreptimeDB. Add them to each output when authentication is enabled. diff --git a/versioned_docs/version-1.3/user-guide/ingest-data/for-observability/opentelemetry.md b/versioned_docs/version-1.3/user-guide/ingest-data/for-observability/opentelemetry.md index 46256e0ca..0aecd48f0 100644 --- a/versioned_docs/version-1.3/user-guide/ingest-data/for-observability/opentelemetry.md +++ b/versioned_docs/version-1.3/user-guide/ingest-data/for-observability/opentelemetry.md @@ -348,6 +348,8 @@ To send OpenTelemetry traces data to GreptimeDB through OpenTelemetry SDK librar - `X-Greptime-Trace-Table-Name`: `` (optional) - The table name to store the traces. If not provided, the default table name is `opentelemetry_traces`. - `X-Greptime-Pipeline-Name`: `greptime_trace_v2` or `greptime_trace_v1` (required) - The pipeline name to process the traces; see [trace data model versions](/user-guide/traces/data-model.md#data-model-versioning). +If `opentelemetry_traces` is a v1 table, [send v2 traces to a new table](/user-guide/traces/read-write.md#existing-v1-trace-tables). + GreptimeDB accepts **protobuf encoded traces data** via **HTTP protocol**. ### Example Code diff --git a/versioned_docs/version-1.3/user-guide/ingest-data/for-observability/otel-collector.md b/versioned_docs/version-1.3/user-guide/ingest-data/for-observability/otel-collector.md index 62bacb949..17053543d 100644 --- a/versioned_docs/version-1.3/user-guide/ingest-data/for-observability/otel-collector.md +++ b/versioned_docs/version-1.3/user-guide/ingest-data/for-observability/otel-collector.md @@ -68,6 +68,8 @@ service: exporters: [otlp_http/metrics] ``` +If `opentelemetry_traces` is a v1 table, [send v2 traces to a new table](/user-guide/traces/read-write.md#existing-v1-trace-tables). + In the above configuration, we define a receiver `otlp` that can receive data from OpenTelemetry. We also define three exporters: `otlp_http/traces`, `otlp_http/logs`, and `otlp_http/metrics`, which send data to the OTLP endpoint of GreptimeDB. Based on the OTLP/HTTP protocol, we have added some headers to specify certain parameters, such as `x-greptime-pipeline-name` and `x-greptime-log-table-name`: diff --git a/versioned_docs/version-1.3/user-guide/traces/read-write.md b/versioned_docs/version-1.3/user-guide/traces/read-write.md index ad88edf3b..6981977d3 100644 --- a/versioned_docs/version-1.3/user-guide/traces/read-write.md +++ b/versioned_docs/version-1.3/user-guide/traces/read-write.md @@ -52,7 +52,8 @@ docker run --rm \ otel/opentelemetry-collector-contrib:0.165.0 ``` -The content of the `config.yaml` file is as follows: +With the following `config.yaml`, the first write to a new database creates +`opentelemetry_traces` with `JSON2` attribute columns. ```yaml receivers: @@ -79,11 +80,16 @@ service: exporters: [otlp_http] ``` -Sending traces as described below automatically creates `opentelemetry_traces` -with `JSON2` attributes. If `opentelemetry_traces` already exists as a v1 table, -also set `x-greptime-trace-table-name` (for example `"opentelemetry_traces_v2"`) -so v2 writes go to a new table. Use the same headers when writing directly from -an SDK. +#### Existing v1 trace tables + +:::warning + +If `greptime_trace_v1` created `opentelemetry_traces`, GreptimeDB rejects v2 writes +to that table. When you set `x-greptime-pipeline-name` to `greptime_trace_v2`, +also set `x-greptime-trace-table-name` to a new table name such as +`opentelemetry_traces_v2`. Use both headers for direct SDK writes as well. + +::: #### Ingest with greptime_trace_v1 From 65cdd95e197154ad28d1a97faa11e81a83002c55 Mon Sep 17 00:00:00 2001 From: shuiyisong Date: Thu, 26 Nov 2026 17:05:25 +0800 Subject: [PATCH 4/4] fix: CI Signed-off-by: shuiyisong --- docs/greptimecloud/integrations/otlp.md | 2 +- .../current/greptimecloud/integrations/otlp.md | 2 +- .../version-1.3/greptimecloud/integrations/otlp.md | 2 +- versioned_docs/version-1.3/greptimecloud/integrations/otlp.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/greptimecloud/integrations/otlp.md b/docs/greptimecloud/integrations/otlp.md index ec46239b6..2ef97e7dc 100644 --- a/docs/greptimecloud/integrations/otlp.md +++ b/docs/greptimecloud/integrations/otlp.md @@ -74,7 +74,7 @@ service: exporters: [otlphttp/metrics] ``` -If `opentelemetry_traces` is a v1 table, [send v2 traces to a new table](/user-guide/traces/read-write.md#existing-v1-trace-tables). +If `opentelemetry_traces` is a v1 table, [send v2 traces to a new table](https://docs.greptime.com/user-guide/traces/read-write/#existing-v1-trace-tables). ## Grafana Alloy diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/greptimecloud/integrations/otlp.md b/i18n/zh/docusaurus-plugin-content-docs/current/greptimecloud/integrations/otlp.md index 83ea6dbfc..75fdf2356 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/greptimecloud/integrations/otlp.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/greptimecloud/integrations/otlp.md @@ -72,7 +72,7 @@ service: exporters: [otlphttp/metrics] ``` -如果 `opentelemetry_traces` 是 v1 表,请[将 v2 数据写入新表](/user-guide/traces/read-write.md#existing-v1-trace-tables)。 +如果 `opentelemetry_traces` 是 v1 表,请[将 v2 数据写入新表](https://docs.greptime.cn/user-guide/traces/read-write/#existing-v1-trace-tables)。 ## Grafana Alloy diff --git a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/greptimecloud/integrations/otlp.md b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/greptimecloud/integrations/otlp.md index 83ea6dbfc..75fdf2356 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/version-1.3/greptimecloud/integrations/otlp.md +++ b/i18n/zh/docusaurus-plugin-content-docs/version-1.3/greptimecloud/integrations/otlp.md @@ -72,7 +72,7 @@ service: exporters: [otlphttp/metrics] ``` -如果 `opentelemetry_traces` 是 v1 表,请[将 v2 数据写入新表](/user-guide/traces/read-write.md#existing-v1-trace-tables)。 +如果 `opentelemetry_traces` 是 v1 表,请[将 v2 数据写入新表](https://docs.greptime.cn/user-guide/traces/read-write/#existing-v1-trace-tables)。 ## Grafana Alloy diff --git a/versioned_docs/version-1.3/greptimecloud/integrations/otlp.md b/versioned_docs/version-1.3/greptimecloud/integrations/otlp.md index ec46239b6..2ef97e7dc 100644 --- a/versioned_docs/version-1.3/greptimecloud/integrations/otlp.md +++ b/versioned_docs/version-1.3/greptimecloud/integrations/otlp.md @@ -74,7 +74,7 @@ service: exporters: [otlphttp/metrics] ``` -If `opentelemetry_traces` is a v1 table, [send v2 traces to a new table](/user-guide/traces/read-write.md#existing-v1-trace-tables). +If `opentelemetry_traces` is a v1 table, [send v2 traces to a new table](https://docs.greptime.com/user-guide/traces/read-write/#existing-v1-trace-tables). ## Grafana Alloy