35.2.1 遥测配置
本节描述了服务器和客户端的配置。
以下是服务器遥测配置变量:
表35.1 遥测变量总结
-
System Variable telemetry.trace_enabledScope 全局 Dynamic 是 SET_VARHint Applies否 Platform Specific Linux Type 布尔 Default Value ON控制是否收集遥测跟踪。
-
System Variable telemetry.query_text_enabledScope 全局 Dynamic 是 SET_VARHint Applies否 Platform Specific Linux Type 布尔 Default Value ON控制是否包括 SQL 查询文本在跟踪中
-
System Variable telemetry.otel_log_levelScope 全局 Dynamic 是 SET_VARHint Applies否 Platform Specific Linux Type 枚举 Default Value ERRORValid Values SILENTINFOERRORWARNINGDEBUG控制 OpenTelemetry 日志在服务器日志中的打印
-
telemetry.otel_resource_attributesSystem Variable telemetry.otel_resource_attributesScope 全局 Dynamic 否 SET_VARHint Applies否 Platform Specific Linux Type 字符串 Default Value empty请参阅对应的 OpenTelemetry 变量 OTEL_RESOURCE_ATTRIBUTES。
-
telemetry.otel_exporter_otlp_traces_protocolSystem Variable telemetry.otel_exporter_otlp_traces_protocolScope 全局 Dynamic 否 SET_VARHint Applies否 Platform Specific Linux Type 枚举 Default Value http/protobufValid Values http/protobufhttp/jsonOTLP 传输协议
-
telemetry.otel_exporter_otlp_traces_endpointSystem Variable telemetry.otel_exporter_otlp_traces_endpointScope 全局 Dynamic 否 SET_VARHint Applies否 Platform Specific Linux Type 字符串 Default Value http://localhost:4318/v1/traces目标 URL,exporter 将将追踪发送到该 URL
-
telemetry.otel_exporter_otlp_traces_certificatesSystem Variable telemetry.otel_exporter_otlp_traces_certificatesScope 全局 Dynamic 否 SET_VARHint Applies否 Platform Specific Linux Type 字符串 Default Value 当前暂不使用。为将来开发。
-
telemetry.otel_exporter_otlp_traces_client_keySystem Variable telemetry.otel_exporter_otlp_traces_client_keyScope 全局 Dynamic 否 SET_VARHint Applies否 Platform Specific Linux Type 字符串 Default Value 当前暂不使用。为将来开发。
-
telemetry.otel_exporter_otlp_traces_client_certificatesSystem Variable telemetry.otel_exporter_otlp_traces_client_certificatesScope 全局 Dynamic 否 SET_VARHint Applies否 Platform Specific Linux Type 字符串 Default Value 当前暂不使用。为将来开发。
-
telemetry.otel_exporter_otlp_traces_headersSystem Variable telemetry.otel_exporter_otlp_traces_headersScope 全局 Dynamic 否 SET_VARHint Applies否 Platform Specific Linux Type 字符串 Default Value empty请查看对应的 OpenTelemetry 变量 OTEL_EXPORTER_TRACES_HEADERS。
-
telemetry.otel_exporter_otlp_traces_compressionSystem Variable telemetry.otel_exporter_otlp_traces_compressionScope 全局 Dynamic 否 SET_VARHint Applies否 Platform Specific Linux Type 字符串 Default Value none (no compression)Valid Values none (无压缩)gzipExporter使用的压缩
-
telemetry.otel_exporter_otlp_traces_timeoutSystem Variable telemetry.otel_exporter_otlp_traces_timeoutScope 全局 Dynamic 否 SET_VARHint Applies否 Platform Specific Linux Type 整数 Default Value 10000Unit 毫秒 OLTP exporter对每个批量导出等待的时间。
-
telemetry.otel_bsp_schedule_delaySystem Variable telemetry.otel_bsp_schedule_delayScope 全局 Dynamic 否 SET_VARHint Applies否 Platform Specific Linux Type 整数 Default Value 5000Unit 毫秒 两个连续导出之间的延迟间隔。
-
telemetry.otel_bsp_max_queue_sizeSystem Variable telemetry.otel_bsp_max_queue_sizeScope 全局 Dynamic 否 SET_VARHint Applies否 Platform Specific Linux Type 整数 Default Value 2048队列大小的最大值。
-
telemetry.otel_bsp_max_export_batch_sizeSystem Variable telemetry.otel_bsp_max_export_batch_sizeScope 全局 Dynamic 否 SET_VARHint Applies否 Platform Specific Linux Type 整数 Default Value 512批量大小的最大值。
-
telemetry.otel_exporter_otlp_traces_min_tlsSystem Variable telemetry.otel_exporter_otlp_traces_min_tlsScope 全局 Dynamic 否 SET_VARHint Applies否 Platform Specific Linux Type 枚举 Default Value [none]Valid Values [none]1.21.3 -
telemetry.otel_exporter_otlp_traces_max_tlsSystem Variable telemetry.otel_exporter_otlp_traces_max_tlsScope 全局 Dynamic 否 SET_VARHint Applies否 Platform Specific Linux Type 枚举 Default Value [none]Valid Values [none]1.21.3 -
telemetry.otel_exporter_otlp_traces_cipherSystem Variable telemetry.otel_exporter_otlp_traces_cipherScope 全局 Dynamic 否 SET_VARHint Applies否 Platform Specific Linux Type 字符串 Default Value [none] -
telemetry.otel_exporter_otlp_traces_cipher_suiteSystem Variable telemetry.otel_exporter_otlp_traces_cipher_suiteScope 全局 Dynamic 否 SET_VARHint Applies否 Platform Specific Linux Type 字符串 Default Value [none]
MySQL 客户端从配置文件的 [telemetry_client] 部分读取遥测配置。有关 telemetry_client 选项的信息,请参阅Installing Client Plugin。以下配置选项可用:
Table 35.2 mysql client Telemetry Option Summary
| Option Name | Description |
|---|---|
| --telemetry_client | 启用遥测客户端。 |
| --otel_bsp_max_export_batch_size | 查看变量 OTEL_BSP_MAX_EXPORT_BATCH_SIZE。 |
| --otel_bsp_max_queue_size | 查看变量 OTEL_BSP_MAX_QUEUE_SIZE。 |
| --otel_bsp_schedule_delay | 查看变量 OTEL_BSP_SCHEDULE_DELAY。 |
| --otel_exporter_otlp_traces_certificates | 当前不使用。保留以备将来开发。 |
| --otel_exporter_otlp_traces_client_certificates | 当前不使用。预留用于将来开发。 |
| --otel_exporter_otlp_traces_client_key | 当前不使用。预留用于将来开发。 |
| --otel_exporter_otlp_traces_compression | 压缩类型 |
| --otel_exporter_otlp_traces_endpoint | trace 导出端点 |
| --otel_exporter_otlp_traces_headers | HTTP 请求关联的键值对 |
| --otel_exporter_otlp_traces_protocol | OTLP 传输协议 |
| --otel_exporter_otlp_traces_timeout | OLTP 导出器等待每批导出的时间 |
| --otel-help | 启用时,打印telemetry_client选项的帮助信息。 |
| --otel_log_level | 控制哪些opentelemetry日志在服务器日志中被打印 |
| --otel_resource_attributes | 请参阅OpenTelemetry变量 OTEL_RESOURCE_ATTRIBUTES对应的内容。 |
| --otel-trace | 该系统变量控制是否收集telemetry 跟踪。 |
-
Command-Line Format --otel-traceType 布尔值 Default Value ON控制是否收集telemetry 跟踪。
-
Command-Line Format --otel-helpType 布尔值 Default Value OFF启用时,打印telemetry_client选项的帮助信息。
-
Command-Line Format --otel_log_levelType 枚举 Default Value ERRORValid Values ERRORSILENTWARNINGINFODEBUG控制服务器日志中显示的OpenTelemetry日志
-
Command-Line Format --otel_resource_attributesType 字符串 Default Value 请参阅相应的OpenTelemetry变量 OTEL_RESOURCE_ATTRIBUTES。
-
otel_exporter_otlp_traces_protocolCommand-Line Format --otel_exporter_otlp_traces_protocolType 枚举 Default Value http/protobufValid Values http/protobufhttp/jsonOTLP传输协议
-
otel_exporter_otlp_traces_endpointCommand-Line Format --otel_exporter_otlp_traces_endpointType 字符串 Default Value http://localhost:4318/v1/traces将跟踪发送到目标URL
-
otel_exporter_otlp_traces_certificatesCommand-Line Format --otel_exporter_otlp_traces_certificatesType 字符串 Default Value 当前暂不使用。用于将来开发。
-
otel_exporter_otlp_traces_client_keyCommand-Line Format --otel_exporter_otlp_traces_client_keyType 字符串 Default Value 当前暂不使用。用于将来开发。
-
otel_exporter_otlp_traces_client_certificatesCommand-Line Format --otel_exporter_otlp_traces_client_certificatesType 字符串 Default Value 当前暂不使用。用于将来开发。
-
otel_exporter_otlp_traces_headersCommand-Line Format --otel_exporter_otlp_traces_headersType 字符串 Default Value 请查看对应的OpenTelemetry变量 OTEL_EXPORTER_TRACES_HEADERS。
-
otel_exporter_otlp_traces_compressionCommand-Line Format --otel_exporter_otlp_traces_compressionType 字符串 Default Value noneValid Values nonegzip导出器使用的压缩方式
-
otel_exporter_otlp_traces_timeoutCommand-Line Format --otel_exporter_otlp_traces_timeoutType 整数 Default Value 10000OLTP 导出器等待每批导出
-
Command-Line Format --otel_bsp_schedule_delayType 整数 Default Value 5000延迟时间(毫秒)
-
Command-Line Format --otel_bsp_max_queue_sizeType 整数 Default Value 2048队列最大大小
-
otel_bsp_max_export_batch_sizeCommand-Line Format --otel_bsp_max_export_batch_sizeType 整数 Default Value 512批处理最大大小
以下是一个使用 Client Telemetry 插件的 my.cnf 配置文件的示例:
[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。