8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

MySQL 8.4 参考手册 / 35 Telemetry / 35.3 OpenTelemetry Trace / 35.3.1 Configuring Trace Telemetry
中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 78%

35.3.1 配置跟踪遥测35.3.1 Configuring Trace Telemetry

本节介绍服务器和客户端的配置。This section describes the configuration for server and client.

服务器配置Server Configuration

以下是服务器跟踪遥测配置变量:The following are the server trace telemetry configuration variables:

客户端配置Client Configuration

MySQL 客户端从配置文件的 [telemetry_client] 部分读取遥测配置。有关 telemetry_client 选项的信息,请参见 安装客户端插件。The MySQL client reads telemetry configuration from the [telemetry_client] section of the configuration file. See Installing Client Plugin for information on the telemetry_client option. The following configuration options are available:

表 35.2 mysql 客户端遥测选项摘要Table 35.2 mysql client Telemetry Option Summary

选项名称Option Name 说明Description
--telemetry_client 启用遥测客户端。Enables the telemetry client.
--otel_bsp_max_export_batch_size 请参阅变量 OTEL_BSP_MAX_EXPORT_BATCH_SIZE。See variable OTEL_BSP_MAX_EXPORT_BATCH_SIZE.
--otel_bsp_max_queue_size 参见变量 OTEL_BSP_MAX_QUEUE_SIZE。See variable OTEL_BSP_MAX_QUEUE_SIZE.
--otel_bsp_schedule_delay 参见变量 OTEL_BSP_SCHEDULE_DELAY。See variable OTEL_BSP_SCHEDULE_DELAY.
--otel_exporter_otlp_traces_certificates 目前未使用。保留用于未来开发。Not in use at this time. Reserved for future development.
--otel_exporter_otlp_traces_client_certificates 目前未使用。保留用于未来开发。Not in use at this time. Reserved for future development.
--otel_exporter_otlp_traces_client_key 目前未使用。保留用于未来开发。Not in use at this time. Reserved for future development.
--otel_exporter_otlp_traces_compression 压缩类型Compression type
--otel_exporter_otlp_traces_endpoint 追踪导出端点The trace export endpoint
--otel_exporter_otlp_traces_headers 用于与 HTTP 请求关联的键值对作为头信息Key-value pairs to be used as headers associated with HTTP requests
--otel_exporter_otlp_traces_protocol OTLP 传输协议The OTLP transport protocol
--otel_exporter_otlp_traces_timeout 每批导出操作中 OLTP 导出器等待的时间Time OLTP exporter waits for each batch export
--otel-help 启用时,打印关于 telemetry_client 选项的帮助信息。When enabled, prints help about telemetry_client options.
--otel_log_level 控制在服务器日志中打印哪些 OpenTelemetry 日志Controls which opentelemetry logs are printed in the server logs
--otel_resource_attributes 参见对应的 OpenTelemetry 变量 OTEL_RESOURCE_ATTRIBUTES。See corresponding OpenTelemetry variable OTEL_RESOURCE_ATTRIBUTES.
--otel-trace 该系统变量控制是否收集遥测跟踪。This system variable controls whether telemetry traces are collected or not.

  • trace

    命令行格式Command-Line Format --otel-trace
    类型Type 布尔Boolean
    默认值Default Value ONON

    控制是否收集遥测跟踪。Controls whether telemetry traces are collected or not .

  • help

    命令行格式Command-Line Format --otel-help
    类型Type 布尔Boolean
    默认值Default Value OFFOFF

    启用后,打印有关 telemetry_client 选项的帮助信息。When enabled, prints help about telemetry_client options .

  • otel_log_level

    命令行格式Command-Line Format --otel_log_level
    类型Type 枚举Enumeration
    默认值Default Value ERRORERROR
    有效值Valid Values

    ERRORERROR

    SILENTSILENT

    WARNINGWARNING

    INFO

    DEBUGDEBUG

    控制哪些 OpenTelemetry 日志会打印到服务器日志中Controls which OpenTelemetry logs are printed in the server logs

  • otel_resource_attributes

    命令行格式Command-Line Format --otel_resource_attributes
    类型Type 字符串String
    默认值Default Value

    参见对应的 OpenTelemetry 变量 OTEL_RESOURCE_ATTRIBUTES。See corresponding OpenTelemetry variable OTEL_RESOURCE_ATTRIBUTES.

  • otel_exporter_otlp_traces_protocol

    命令行格式Command-Line Format --otel_exporter_otlp_traces_protocol
    类型Type 枚举Enumeration
    默认值Default Value http/protobuf
    有效值Valid Values

    http/protobuf

    http/json

    OTLP 传输协议OTLP transport protocol

  • otel_exporter_otlp_traces_endpoint

    命令行格式Command-Line Format --otel_exporter_otlp_traces_endpoint
    类型Type 字符串String
    默认值Default Value http://localhost:4318/v1/traces

    导出器发送追踪的目标 URLTarget URL to which the exporter sends traces

  • otel_exporter_otlp_traces_certificates

    命令行格式Command-Line Format --otel_exporter_otlp_traces_certificates
    类型Type 字符串String
    默认值Default Value

    验证服务器的 TLS 凭证时使用的受信任证书。The trusted certificate to use when verifying a server's TLS credentials.

  • otel_exporter_otlp_traces_client_key

    命令行格式Command-Line Format --otel_exporter_otlp_traces_client_key
    类型Type 字符串String
    默认值Default Value

    客户端的 PEM 格式私钥。Client's private key in PEM format.

  • otel_exporter_otlp_traces_client_certificates

    命令行格式Command-Line Format --otel_exporter_otlp_traces_client_certificates
    类型Type 字符串String
    默认值Default Value

    用于客户端私钥的客户端证书/证书链信任,格式为 PEM。Client certificate/chain trust for clients private key in PEM format.

  • otel_exporter_otlp_traces_headers

    命令行格式Command-Line Format --otel_exporter_otlp_traces_headers
    类型Type 字符串String
    默认值Default Value

    参见对应的 OpenTelemetry 变量 OTEL_EXPORTER_TRACES_HEADERS。See corresponding OpenTelemetry variable OTEL_EXPORTER_TRACES_HEADERS.

  • otel_exporter_otlp_traces_compression

    命令行格式Command-Line Format --otel_exporter_otlp_traces_compression
    类型Type 字符串String
    默认值Default Value nonenone
    有效值Valid Values

    nonenone

    gzip

    导出器使用的压缩方式Compression used by exporter

  • otel_exporter_otlp_traces_timeout

    命令行格式Command-Line Format --otel_exporter_otlp_traces_timeout
    类型Type 整数Integer
    默认值Default Value 10000

    每批导出操作中 OLTP 导出器等待的时间Time OLTP exporter waits for each batch export

  • otel_bsp_schedule_delay

    命令行格式Command-Line Format --otel_bsp_schedule_delay
    类型Type 整数Integer
    默认值Default Value 5000

    两次连续导出之间的延迟间隔(毫秒)Delay interval between two consecutive exports in milliseconds

  • otel_bsp_max_queue_size

    命令行格式Command-Line Format --otel_bsp_max_queue_size
    类型Type 整数Integer
    默认值Default Value 2048

    最大队列大小Maximum queue size

  • otel_bsp_max_export_batch_size

    命令行格式Command-Line Format --otel_bsp_max_export_batch_size
    类型Type 整数Integer
    默认值Default Value 512

    最大批量大小Maximum batch size

客户端配置示例Client Configuration Example

下面是一个包含客户端遥测插件配置的my.cnf配置文件示例:The following is an example of a my.cnf configuration file containing the Client Telemetry plugin configuration:

[mysql]

telemetry-client = ON

[telemetry_client]
help = ON
trace = OFF
otel-resource-attributes = "RK1=RV1, RK2=RV2, RK3=RV3"
otel-log-level = "error"
otel-exporter-otlp-traces-headers = "K1=V1, K2=V2"
otel-exporter-otlp-traces-protocol = "http/json"
        

如果在配置文件中设置了telemetry-client = ON,启动客户端时无需指定--telemetry-client。If telemetry-client = ON is set in the configuration file, you do not need to specify --telemetry-client when starting the client.