MySQL 8.4 Reference Manual  /  ...  /  Configuring TRACE Telemetry

35.2.1 Configuring TRACE 遥测

This section describes the configuration for server and client.

The following are the server trace telemetry configuration variables:

Table 35.1 Telemetry Variable Summary

Name Cmd-Line Option File System Var Status Var Var Scope Dynamic
telemetry.live_sessions Yes Global No
telemetry.metrics_reader_frequency_1 Yes Global No
telemetry.metrics_reader_frequency_2 Yes Global No
telemetry.metrics_reader_frequency_3 Yes Global No
telemetry.otel_bsp_max_export_batch_size Yes Global No
telemetry.otel_bsp_max_queue_size Yes Global No
telemetry.otel_bsp_schedule_delay Yes Global No
telemetry.otel_exporter_otlp_metrics_certificates Yes Global No
telemetry.otel_exporter_otlp_metrics_cipher Yes Global No
telemetry.otel_exporter_otlp_metrics_cipher_suite Yes Global No
telemetry.otel_exporter_otlp_metrics_client_certificates Yes Global No
telemetry.otel_exporter_otlp_metrics_client_key Yes Global No
telemetry.otel_exporter_otlp_metrics_compression Yes Global No
telemetry.otel_exporter_otlp_metrics_endpoint Yes Global No
telemetry.otel_exporter_otlp_metrics_headers Yes Global No
telemetry.otel_exporter_otlp_metrics_max_tls Yes Global No
telemetry.otel_exporter_otlp_metrics_min_tls Yes Global No
telemetry.otel_exporter_otlp_metrics_protocol Yes Global No
telemetry.otel_exporter_otlp_metrics_timeout Yes Global No
telemetry.otel_exporter_otlp_traces_certificates Yes Global No
telemetry.otel_exporter_otlp_traces_cipher Yes Global No
telemetry.otel_exporter_otlp_traces_cipher_suite Yes Global No
telemetry.otel_exporter_otlp_traces_client_certificates Yes Global No
telemetry.otel_exporter_otlp_traces_client_key Yes Global No
telemetry.otel_exporter_otlp_traces_compression Yes Global No
telemetry.otel_exporter_otlp_traces_endpoint Yes Global No
telemetry.otel_exporter_otlp_traces_headers Yes Global No
telemetry.otel_exporter_otlp_traces_max_tls Yes Global No
telemetry.otel_exporter_otlp_traces_min_tls Yes Global No
telemetry.otel_exporter_otlp_traces_protocol Yes Global No
telemetry.otel_exporter_otlp_traces_timeout Yes Global No
telemetry.otel_log_level Yes Global Yes
telemetry.otel_resource_attributes Yes Global No
telemetry.query_text_enabled Yes Global Yes
telemetry.trace_enabled Yes Global Yes

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:

Table 35.2 mysql client Telemetry Option Summary

Option Name Description
--telemetry_client Enables the telemetry client.
--otel_bsp_max_export_batch_size See variable OTEL_BSP_MAX_EXPORT_BATCH_SIZE.
--otel_bsp_max_queue_size See variable OTEL_BSP_MAX_QUEUE_SIZE.
--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 Key-value pairs to be used as headers associated with HTTP requests
--otel_exporter_otlp_traces_protocol The OTLP transport protocol
--otel_exporter_otlp_traces_timeout Time OLTP exporter waits for each batch export
--otel-help When enabled, prints help about telemetry_client options.
--otel_log_level Controls which opentelemetry logs are printed in the server logs
--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 ON

    Controls whether telemetry traces are collected or not .

  • help

    Command-Line Format --otel-help
    Type Boolean
    Default Value OFF

    When enabled, prints help about telemetry_client options .

  • otel_log_level

    Command-Line Format --otel_log_level
    Type Enumeration
    Default Value ERROR
    Valid Values

    ERROR

    SILENT

    WARNING

    INFO

    DEBUG

    Controls which OpenTelemetry logs are printed in the server logs

  • otel_resource_attributes

    Command-Line Format --otel_resource_attributes
    Type String
    Default Value

    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 transport protocol

  • otel_exporter_otlp_traces_endpoint

    Command-Line Format --otel_exporter_otlp_traces_endpoint
    Type String
    Default Value http://localhost:4318/v1/traces

    Target URL to which the exporter sends traces

  • otel_exporter_otlp_traces_certificates

    Command-Line Format --otel_exporter_otlp_traces_certificates
    Type String
    Default Value

    Unused at this time. For future development.

  • otel_exporter_otlp_traces_client_key

    Command-Line Format --otel_exporter_otlp_traces_client_key
    Type String
    Default Value

    Unused at this time. For future development.

  • otel_exporter_otlp_traces_client_certificates

    Command-Line Format --otel_exporter_otlp_traces_client_certificates
    Type String
    Default Value

    Unused at this time. For future development.

  • otel_exporter_otlp_traces_headers

    Command-Line Format --otel_exporter_otlp_traces_headers
    Type String
    Default Value

    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 none
    Valid Values

    none

    gzip

    Compression used by exporter

  • otel_exporter_otlp_traces_timeout

    Command-Line Format --otel_exporter_otlp_traces_timeout
    Type Integer
    Default Value 10000

    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

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"

If telemetry-client = ON is set in the configuration file, you do not need to specify --telemetry-client when starting the client.