本节描述了服务器和客户端的配置。
以下是服务器跟踪遥测配置变量:
表 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 沉默信息错误警告调试控制哪些 OpenTelemetry 日志被打印在服务器日志中
-
telemetry.otel_resource_attributesSystem Variable telemetry.otel_resource_attributesScope 全局 Dynamic 否 SET_VARHint Applies否 Platform Specific Linux Type 字符串 Default Value 空参见相应的 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 空参见相应的 OpenTelemetry 变量 OTEL_EXPORTER_TRACES_HEADERS。
-
telemetry.otel_exporter_otlp_traces_compressionSystem Variable 遥测.otel_exporter_otlp_traces_compressionScope 全局 Dynamic 否 SET_VARHint Applies否 Platform Specific Linux Type 字符串 Default Value 无(无压缩)Valid Values 无(无压缩)gzipExporter 使用的压缩方式
-
遥测.otel_exporter_otlp_traces_timeoutSystem Variable 遥测.otel_exporter_otlp_traces_timeoutScope 全局 Dynamic 否 SET_VARHint Applies否 Platform Specific Linux Type 整数 Default Value 10000Unit 毫秒 Exporter 等待每批次导出所需的时间(毫秒).
-
System Variable 遥测.otel_bsp_schedule_delayScope 全局 Dynamic 否 SET_VARHint Applies否 Platform Specific Linux Type 整数 Default Value 5000Unit 毫秒 两次连续导出之间的延迟间隔(毫秒)
-
System Variable 遥测.otel_bsp_max_queue_sizeScope 全局 Dynamic 否 SET_VARHint Applies否 Platform Specific Linux Type 整数 Default Value 2048最大队列大小
-
遥测.otel_bsp_max_export_batch_sizeSystem Variable 遥测.otel_bsp_max_export_batch_sizeScope 全局 Dynamic 否 SET_VARHint Applies否 Platform Specific Linux Type 整数 Default Value 512最大批量大小
-
遥测.otel_exporter_otlp_traces_min_tlsSystem Variable 遥测.otel_exporter_otlp_traces_min_tlsScope 全局 Dynamic 否 SET_VARHint Applies否 Platform Specific Linux Type 枚举 Default Value [none]Valid Values [none]1.21.3 -
遥测.otel_exporter_otlp_traces_max_tlsSystem Variable 遥测.otel_exporter_otlp_traces_max_tlsScope 全局 Dynamic 否 SET_VARHint Applies否 Platform Specific Linux Type 枚举 Default Value [none]Valid Values [none]1.21.3 -
遥测.otel_exporter_otlp_traces_cipherSystem Variable 遥测.otel_exporter_otlp_traces_cipherScope 全局 Dynamic 否 SET_VARHint Applies否 Platform Specific Linux Type 字符串 Default Value [none] -
System Variable 跟踪导出器OTLP跟踪加密套件Scope 全局 Dynamic 否 SET_VARHint Applies否 Platform Specific Linux Type 字符串 Default Value [无]
MySQL 客户端从配置文件的 [telemetry_client] 部分读取遥测配置。请参阅 安装客户端插件,了解 telemetry_client 选项的信息。以下是可用的配置选项:
表 35.2 MySQL 客户端遥测选项摘要
| 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 | 跟踪导出端点 |
| --otel_exporter_otlp_traces_headers | 与 HTTP 请求关联的键值对 |
| --otel_exporter_otlp_traces_protocol | OTLP 传输协议 |
| --otel_exporter_otlp_traces_timeout | OLTP 导出器等待每批导出 |
| --otel-help | 启用时,打印遥测客户端选项的帮助。 |
| --otel_log_level | 控制哪些 OpenTelemetry 日志被打印在服务器日志中 |
| --otel_resource_attributes | 请参阅对应的 OpenTelemetry 变量 OTEL_RESOURCE_ATTRIBUTES。 |
| --otel-trace | 该系统变量控制是否收集遥测跟踪。 |
-
Command-Line Format --otel-traceType 布尔值 Default Value ON控制是否收集遥测跟踪。
-
Command-Line Format --otel-helpType 布尔值 Default Value 关闭启用时,打印 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,exporter 将跟踪发送到该 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 nonegzipexporter 使用的压缩方式
-
otel_exporter_otlp_traces_timeoutCommand-Line Format --otel_exporter_otlp_traces_timeoutType 整数 Default Value 10000OLTP exporter 等待每批次导出时间
-
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最大批量大小
以下是一个包含客户端遥测插件配置的 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。