本节介绍服务器和客户端的配置。This section describes the configuration for server and client.
以下是服务器跟踪遥测配置变量:The following are the server trace telemetry configuration variables:
系统变量System Variable telemetry.trace_enabled范围Scope 全球Global 动态Dynamic 是Yes SET_VAR提示适用SET_VARHint Applies否No 类型Type 布尔Boolean 默认值Default Value ONON控制是否收集遥测跟踪。Controls whether telemetry traces are collected or not .
系统变量System Variable telemetry.query_text_enabled范围Scope 全球Global 动态Dynamic 是Yes SET_VAR提示适用SET_VARHint Applies否No 类型Type 布尔Boolean 默认值Default Value ONON控制是否在跟踪中包含 SQL 查询文本Controls whether the SQL query text is included in the trace
系统变量System Variable telemetry.otel_log_level范围Scope 全球Global 动态Dynamic 是Yes SET_VAR提示适用SET_VARHint Applies否No 类型Type 枚举Enumeration 默认值Default Value ERRORERROR有效值Valid Values SILENTSILENTINFOERRORERRORWARNINGWARNINGDEBUGDEBUG控制哪些 OpenTelemetry 日志会打印到服务器日志中Controls which OpenTelemetry logs are printed in the server logs
telemetry.otel_resource_attributes系统变量System Variable telemetry.otel_resource_attributes范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 字符串String 默认值Default Value emptyempty参见对应的 OpenTelemetry 变量 OTEL_RESOURCE_ATTRIBUTES。See corresponding OpenTelemetry variable OTEL_RESOURCE_ATTRIBUTES.
telemetry.otel_exporter_otlp_traces_protocol系统变量System Variable telemetry.otel_exporter_otlp_traces_protocol范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 枚举Enumeration 默认值Default Value http/protobuf有效值Valid Values http/protobufhttp/jsonOTLP 传输协议OTLP transport protocol
telemetry.otel_exporter_otlp_traces_endpoint系统变量System Variable telemetry.otel_exporter_otlp_traces_endpoint范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 字符串String 默认值Default Value http://localhost:4318/v1/traces导出器发送追踪的目标 URLTarget URL to which the exporter sends traces
telemetry.otel_exporter_otlp_traces_certificates系统变量System Variable telemetry.otel_exporter_otlp_traces_certificates范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 字符串String 默认值Default Value 验证服务器的 TLS 凭证时使用的受信任证书。The trusted certificate to use when verifying a server's TLS credentials.
telemetry.otel_exporter_otlp_traces_client_key系统变量System Variable telemetry.otel_exporter_otlp_traces_client_key范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 字符串String 默认值Default Value 客户端的 PEM 格式私钥。Client's private key in PEM format.
telemetry.otel_exporter_otlp_traces_client_certificates系统变量System Variable telemetry.otel_exporter_otlp_traces_client_certificates范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 字符串String 默认值Default Value 用于客户端私钥的客户端证书/证书链信任,格式为 PEM。Client certificate/chain trust for clients private key in PEM format.
telemetry.otel_exporter_otlp_traces_headers系统变量System Variable telemetry.otel_exporter_otlp_traces_headers范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 字符串String 默认值Default Value emptyempty参见对应的 OpenTelemetry 变量 OTEL_EXPORTER_TRACES_HEADERS。See corresponding OpenTelemetry variable OTEL_EXPORTER_TRACES_HEADERS.
telemetry.otel_exporter_otlp_traces_compression系统变量System Variable telemetry.otel_exporter_otlp_traces_compression范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 字符串String 默认值Default Value none (no compression)none (no compression)有效值Valid Values none (no compression)none (no compression)gzip导出器使用的压缩方式Compression used by exporter
telemetry.otel_exporter_otlp_traces_timeout系统变量System Variable telemetry.otel_exporter_otlp_traces_timeout范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value 10000单位Unit 毫秒milliseconds OLTP 导出器等待每批导出的时间(毫秒)。Time in milliseconds the OLTP exporter waits for each batch export.
telemetry.otel_bsp_schedule_delay系统变量System Variable telemetry.otel_bsp_schedule_delay范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value 5000单位Unit 毫秒milliseconds 两次连续导出之间的延迟间隔(毫秒)Delay interval between two consecutive exports in milliseconds
telemetry.otel_bsp_max_queue_size系统变量System Variable telemetry.otel_bsp_max_queue_size范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value 2048最大队列大小Maximum queue size
telemetry.otel_bsp_max_export_batch_size系统变量System Variable telemetry.otel_bsp_max_export_batch_size范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 整数Integer 默认值Default Value 512最大批量大小Maximum batch size
telemetry.otel_exporter_otlp_traces_min_tls系统变量System Variable telemetry.otel_exporter_otlp_traces_min_tls范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 枚举Enumeration 默认值Default Value [none][none]有效值Valid Values [none][none]1.21.3telemetry.otel_exporter_otlp_traces_max_tls系统变量System Variable telemetry.otel_exporter_otlp_traces_max_tls范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 枚举Enumeration 默认值Default Value [none][none]有效值Valid Values [none][none]1.21.3telemetry.otel_exporter_otlp_traces_cipher系统变量System Variable telemetry.otel_exporter_otlp_traces_cipher范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 字符串String 默认值Default Value [none][none]telemetry.otel_exporter_otlp_traces_cipher_suite系统变量System Variable telemetry.otel_exporter_otlp_traces_cipher_suite范围Scope 全球Global 动态Dynamic 否No SET_VAR提示适用SET_VARHint Applies否No 类型Type 字符串String 默认值Default Value [none][none]
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. |
命令行格式Command-Line Format --otel-trace类型Type 布尔Boolean 默认值Default Value ONON控制是否收集遥测跟踪。Controls whether telemetry traces are collected or not .
命令行格式Command-Line Format --otel-help类型Type 布尔Boolean 默认值Default Value OFFOFF启用后,打印有关 telemetry_client 选项的帮助信息。When enabled, prints help about telemetry_client options .
命令行格式Command-Line Format --otel_log_level类型Type 枚举Enumeration 默认值Default Value ERRORERROR有效值Valid Values ERRORERRORSILENTSILENTWARNINGWARNINGINFODEBUGDEBUG控制哪些 OpenTelemetry 日志会打印到服务器日志中Controls which OpenTelemetry logs are printed in the server logs
命令行格式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/protobufhttp/jsonOTLP 传输协议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 nonenonegzip导出器使用的压缩方式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
命令行格式Command-Line Format --otel_bsp_schedule_delay类型Type 整数Integer 默认值Default Value 5000两次连续导出之间的延迟间隔(毫秒)Delay interval between two consecutive exports in milliseconds
命令行格式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
下面是一个包含客户端遥测插件配置的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.