diff --git a/docs/instrumentation-list.yaml b/docs/instrumentation-list.yaml index 3d87266408e8..fc0840c255bf 100644 --- a/docs/instrumentation-list.yaml +++ b/docs/instrumentation-list.yaml @@ -6899,50 +6899,2614 @@ libraries: default: false telemetry: - when: default + metrics: + - name: kafka.consumer.assigned_partitions + description: The number of partitions currently assigned to this consumer + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.bytes_consumed_rate + description: The average number of bytes consumed per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: topic + type: STRING + - name: kafka.consumer.bytes_consumed_total + description: The total number of bytes consumed + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: topic + type: STRING + - name: kafka.consumer.commit_latency_avg + description: The average time taken for a commit request + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.commit_latency_max + description: The max time taken for a commit request + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.commit_rate + description: The number of commit calls per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.commit_sync_time_ns_total + description: The total time the consumer has spent in commitSync in nanoseconds + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.commit_total + description: The total number of commit calls + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.committed_time_ns_total + description: The total time the consumer has spent in committed in nanoseconds + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.connection_close_rate + description: The number of connections closed per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.connection_close_total + description: The total number of connections closed + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.connection_count + description: The current number of active connections. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.connection_creation_rate + description: The number of new connections established per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.connection_creation_total + description: The total number of new connections established + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.failed_authentication_rate + description: The number of connections with failed authentication per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.failed_authentication_total + description: The total number of connections with failed authentication + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.failed_reauthentication_rate + description: The number of failed re-authentication of connections per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.failed_reauthentication_total + description: The total number of failed re-authentication of connections + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.failed_rebalance_rate_per_hour + description: The number of failed rebalance events per hour + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.failed_rebalance_total + description: The total number of failed rebalance events + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.fetch_latency_avg + description: The average time taken for a fetch request. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.fetch_latency_max + description: The max time taken for any fetch request. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.fetch_rate + description: The number of fetch requests per second. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.fetch_size_avg + description: The average number of bytes fetched per request + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: topic + type: STRING + - name: kafka.consumer.fetch_size_max + description: The maximum number of bytes fetched per request + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: topic + type: STRING + - name: kafka.consumer.fetch_throttle_time_avg + description: The average throttle time in ms + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.fetch_throttle_time_max + description: The maximum throttle time in ms + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.fetch_total + description: The total number of fetch requests. + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.heartbeat_rate + description: The number of heartbeats per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.heartbeat_total + description: The total number of heartbeats + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.incoming_byte_rate + description: The number of bytes read off all sockets per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.consumer.incoming_byte_total + description: The total number of bytes read off all sockets + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.consumer.io_ratio + description: The fraction of time the I/O thread spent doing I/O + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.io_time_ns_avg + description: The average length of time for I/O per select call in nanoseconds. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.io_time_ns_total + description: The total time the I/O thread spent doing I/O + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.io_wait_ratio + description: The fraction of time the I/O thread spent waiting + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.io_wait_time_ns_avg + description: The average length of time the I/O thread spent waiting for a + socket ready for reads or writes in nanoseconds. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.io_wait_time_ns_total + description: The total time the I/O thread spent waiting + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.join_rate + description: The number of group joins per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.join_time_avg + description: The average time taken for a group rejoin + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.join_time_max + description: The max time taken for a group rejoin + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.join_total + description: The total number of group joins + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.last_heartbeat_seconds_ago + description: The number of seconds since the last coordinator heartbeat was + sent + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.last_poll_seconds_ago + description: The number of seconds since the last poll() invocation. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.last_rebalance_seconds_ago + description: The number of seconds since the last successful rebalance event + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.network_io_rate + description: The number of network operations (reads or writes) on all connections + per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.network_io_total + description: The total number of network operations (reads or writes) on all + connections + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.outgoing_byte_rate + description: The number of outgoing bytes sent to all servers per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.consumer.outgoing_byte_total + description: The total number of outgoing bytes sent to all servers + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.consumer.partition_assigned_latency_avg + description: The average time taken for a partition-assigned rebalance listener + callback + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.partition_assigned_latency_max + description: The max time taken for a partition-assigned rebalance listener + callback + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.poll_idle_ratio_avg + description: The average fraction of time the consumer's poll() is idle as + opposed to waiting for the user code to process records. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.rebalance_latency_avg + description: The average time taken for a group to complete a successful rebalance, + which may be composed of several failed re-trials until it succeeded + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.rebalance_latency_max + description: The max time taken for a group to complete a successful rebalance, + which may be composed of several failed re-trials until it succeeded + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.rebalance_latency_total + description: The total number of milliseconds this consumer has spent in successful + rebalances since creation + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.rebalance_rate_per_hour + description: The number of successful rebalance events per hour, each event + is composed of several failed re-trials until it succeeded + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.rebalance_total + description: The total number of successful rebalance events, each event is + composed of several failed re-trials until it succeeded + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.records_consumed_rate + description: The average number of records consumed per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: topic + type: STRING + - name: kafka.consumer.records_consumed_total + description: The total number of records consumed + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: topic + type: STRING + - name: kafka.consumer.records_lag + description: 'The latest lag of the partition. Note: For topic names with + periods (.), an additional metric with underscores is emitted. However, + the periods replaced metric is deprecated. Please use the metric with actual + topic name instead.' + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: partition + type: STRING + - name: topic + type: STRING + - name: kafka.consumer.records_lag_avg + description: 'The average lag of the partition. Note: For topic names with + periods (.), an additional metric with underscores is emitted. However, + the periods replaced metric is deprecated. Please use the metric with actual + topic name instead.' + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: partition + type: STRING + - name: topic + type: STRING + - name: kafka.consumer.records_lag_max + description: 'The maximum lag in terms of number of records for any partition + in this window. NOTE: This is based on current offset and not committed + offset' + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: partition + type: STRING + - name: topic + type: STRING + - name: kafka.consumer.records_lead + description: 'The latest lead of the partition. Note: For topic names with + periods (.), an additional metric with underscores is emitted. However, + the periods replaced metric is deprecated. Please use the metric with actual + topic name instead.' + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: partition + type: STRING + - name: topic + type: STRING + - name: kafka.consumer.records_lead_avg + description: 'The average lead of the partition. Note: For topic names with + periods (.), an additional metric with underscores is emitted. However, + the periods replaced metric is deprecated. Please use the metric with actual + topic name instead.' + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: partition + type: STRING + - name: topic + type: STRING + - name: kafka.consumer.records_lead_min + description: The minimum lead in terms of number of records for any partition + in this window + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: partition + type: STRING + - name: topic + type: STRING + - name: kafka.consumer.records_per_request_avg + description: The average number of records in each request + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: topic + type: STRING + - name: kafka.consumer.request_latency_avg + description: '' + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.consumer.request_latency_max + description: '' + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.consumer.request_rate + description: The number of requests sent per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.consumer.request_size_avg + description: The average size of requests sent. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.consumer.request_size_max + description: The maximum size of any request sent. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.consumer.request_total + description: The total number of requests sent + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.consumer.response_rate + description: The number of responses received per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.consumer.response_total + description: The total number of responses received + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.consumer.select_rate + description: The number of times the I/O layer checked for new I/O to perform + per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.select_total + description: The total number of times the I/O layer checked for new I/O to + perform + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.successful_authentication_no_reauth_total + description: The total number of connections with successful authentication + where the client does not support re-authentication + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.successful_authentication_rate + description: The number of connections with successful authentication per + second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.successful_authentication_total + description: The total number of connections with successful authentication + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.successful_reauthentication_rate + description: The number of successful re-authentication of connections per + second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.successful_reauthentication_total + description: The total number of successful re-authentication of connections + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.sync_rate + description: The number of group syncs per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.sync_time_avg + description: The average time taken for a group sync + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.sync_time_max + description: The max time taken for a group sync + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.sync_total + description: The total number of group syncs + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.time_between_poll_avg + description: The average delay between invocations of poll() in milliseconds. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.time_between_poll_max + description: The max delay between invocations of poll() in milliseconds. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.batch_size_avg + description: The average number of bytes sent per partition per-request. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.batch_size_max + description: The max number of bytes sent per partition per-request. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.batch_split_rate + description: The average number of batch splits per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.batch_split_total + description: The total number of batch splits + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.buffer_available_bytes + description: The total amount of buffer memory that is not being used (either + unallocated or in the free list). + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.buffer_exhausted_rate + description: The average per-second number of record sends that are dropped + due to buffer exhaustion + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.buffer_exhausted_total + description: The total number of record sends that are dropped due to buffer + exhaustion + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.buffer_total_bytes + description: The maximum amount of buffer memory the client can use (whether + or not it is currently used). + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.bufferpool_wait_ratio + description: The fraction of time an appender waits for space allocation. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.bufferpool_wait_time_ns_total + description: The total time in nanoseconds an appender waits for space allocation. + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.byte_rate + description: The average number of bytes sent per second for a topic. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: topic + type: STRING + - name: kafka.producer.byte_total + description: The total number of bytes sent for a topic. + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: topic + type: STRING + - name: kafka.producer.compression_rate + description: The average compression rate of record batches for a topic, defined + as the average ratio of the compressed batch size over the uncompressed + size. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: topic + type: STRING + - name: kafka.producer.compression_rate_avg + description: The average compression rate of record batches, defined as the + average ratio of the compressed batch size over the uncompressed size. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.connection_close_rate + description: The number of connections closed per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.connection_close_total + description: The total number of connections closed + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.connection_count + description: The current number of active connections. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.connection_creation_rate + description: The number of new connections established per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.connection_creation_total + description: The total number of new connections established + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.failed_authentication_rate + description: The number of connections with failed authentication per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.failed_authentication_total + description: The total number of connections with failed authentication + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.failed_reauthentication_rate + description: The number of failed re-authentication of connections per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.failed_reauthentication_total + description: The total number of failed re-authentication of connections + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.flush_time_ns_total + description: Total time producer has spent in flush in nanoseconds. + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.incoming_byte_rate + description: The number of bytes read off all sockets per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.producer.incoming_byte_total + description: The total number of bytes read off all sockets + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.producer.io_ratio + description: The fraction of time the I/O thread spent doing I/O + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.io_time_ns_avg + description: The average length of time for I/O per select call in nanoseconds. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.io_time_ns_total + description: The total time the I/O thread spent doing I/O + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.io_wait_ratio + description: The fraction of time the I/O thread spent waiting + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.io_wait_time_ns_avg + description: The average length of time the I/O thread spent waiting for a + socket ready for reads or writes in nanoseconds. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.io_wait_time_ns_total + description: The total time the I/O thread spent waiting + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.metadata_age + description: The age in seconds of the current producer metadata being used. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.metadata_wait_time_ns_total + description: Total time producer has spent waiting on topic metadata in nanoseconds. + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.network_io_rate + description: The number of network operations (reads or writes) on all connections + per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.network_io_total + description: The total number of network operations (reads or writes) on all + connections + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.outgoing_byte_rate + description: The number of outgoing bytes sent to all servers per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.producer.outgoing_byte_total + description: The total number of outgoing bytes sent to all servers + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.producer.produce_throttle_time_avg + description: The average time in ms a request was throttled by a broker + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.produce_throttle_time_max + description: The maximum time in ms a request was throttled by a broker + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.record_error_rate + description: The average per-second number of record sends that resulted in + errors + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: topic + type: STRING + - name: kafka.producer.record_error_total + description: The total number of record sends that resulted in errors + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: topic + type: STRING + - name: kafka.producer.record_queue_time_avg + description: The average time in ms record batches spent in the send buffer. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.record_queue_time_max + description: The maximum time in ms record batches spent in the send buffer. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.record_retry_rate + description: The average per-second number of retried record sends + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: topic + type: STRING + - name: kafka.producer.record_retry_total + description: The total number of retried record sends + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: topic + type: STRING + - name: kafka.producer.record_send_rate + description: The average number of records sent per second. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: topic + type: STRING + - name: kafka.producer.record_send_total + description: The total number of records sent. + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: topic + type: STRING + - name: kafka.producer.record_size_avg + description: The average record size + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.record_size_max + description: The maximum record size + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.records_per_request_avg + description: The average number of records per request. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.request_latency_avg + description: The average request latency in ms + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.producer.request_latency_max + description: The maximum request latency in ms + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.producer.request_rate + description: The number of requests sent per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.producer.request_size_avg + description: The average size of requests sent. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.producer.request_size_max + description: The maximum size of any request sent. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.producer.request_total + description: The total number of requests sent + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.producer.requests_in_flight + description: The current number of in-flight requests awaiting a response. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.response_rate + description: The number of responses received per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.producer.response_total + description: The total number of responses received + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.producer.select_rate + description: The number of times the I/O layer checked for new I/O to perform + per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.select_total + description: The total number of times the I/O layer checked for new I/O to + perform + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.successful_authentication_no_reauth_total + description: The total number of connections with successful authentication + where the client does not support re-authentication + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.successful_authentication_rate + description: The number of connections with successful authentication per + second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.successful_authentication_total + description: The total number of connections with successful authentication + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.successful_reauthentication_rate + description: The number of successful re-authentication of connections per + second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.successful_reauthentication_total + description: The total number of successful re-authentication of connections + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.txn_abort_time_ns_total + description: Total time producer has spent in abortTransaction in nanoseconds. + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.txn_begin_time_ns_total + description: Total time producer has spent in beginTransaction in nanoseconds. + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.txn_commit_time_ns_total + description: Total time producer has spent in commitTransaction in nanoseconds. + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.txn_init_time_ns_total + description: Total time producer has spent in initTransactions in nanoseconds. + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.txn_prepare_time_ns_total + description: Total time producer has spent in prepareTransaction in nanoseconds. + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.txn_send_offsets_time_ns_total + description: Total time producer has spent in sendOffsetsToTransaction in + nanoseconds. + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.waiting_threads + description: The number of user threads blocked waiting for buffer memory + to enqueue their records + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING spans: - span_kind: CONSUMER attributes: - - name: messaging.batch.message_count - type: LONG - - name: messaging.client_id + - name: messaging.batch.message_count + type: LONG + - name: messaging.client_id + type: STRING + - name: messaging.destination.name + type: STRING + - name: messaging.destination.partition.id + type: STRING + - name: messaging.kafka.consumer.group + type: STRING + - name: messaging.kafka.message.key + type: STRING + - name: messaging.kafka.message.offset + type: LONG + - name: messaging.kafka.message.tombstone + type: BOOLEAN + - name: messaging.message.body.size + type: LONG + - name: messaging.operation + type: STRING + - name: messaging.system + type: STRING + - span_kind: PRODUCER + attributes: + - name: messaging.client_id + type: STRING + - name: messaging.destination.name + type: STRING + - name: messaging.destination.partition.id + type: STRING + - name: messaging.kafka.message.key + type: STRING + - name: messaging.kafka.message.offset + type: LONG + - name: messaging.kafka.message.tombstone + type: BOOLEAN + - name: messaging.operation + type: STRING + - name: messaging.system + type: STRING + - when: otel.instrumentation.kafka.experimental-span-attributes=true + metrics: + - name: kafka.consumer.assigned_partitions + description: The number of partitions currently assigned to this consumer + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.bytes_consumed_rate + description: The average number of bytes consumed per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: topic + type: STRING + - name: kafka.consumer.bytes_consumed_total + description: The total number of bytes consumed + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: topic + type: STRING + - name: kafka.consumer.commit_latency_avg + description: The average time taken for a commit request + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.commit_latency_max + description: The max time taken for a commit request + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.commit_rate + description: The number of commit calls per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.commit_sync_time_ns_total + description: The total time the consumer has spent in commitSync in nanoseconds + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.commit_total + description: The total number of commit calls + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.committed_time_ns_total + description: The total time the consumer has spent in committed in nanoseconds + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.connection_close_rate + description: The number of connections closed per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.connection_close_total + description: The total number of connections closed + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.connection_count + description: The current number of active connections. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.connection_creation_rate + description: The number of new connections established per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.connection_creation_total + description: The total number of new connections established + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.failed_authentication_rate + description: The number of connections with failed authentication per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.failed_authentication_total + description: The total number of connections with failed authentication + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.failed_reauthentication_rate + description: The number of failed re-authentication of connections per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.failed_reauthentication_total + description: The total number of failed re-authentication of connections + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.failed_rebalance_rate_per_hour + description: The number of failed rebalance events per hour + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.failed_rebalance_total + description: The total number of failed rebalance events + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.fetch_latency_avg + description: The average time taken for a fetch request. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.fetch_latency_max + description: The max time taken for any fetch request. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.fetch_rate + description: The number of fetch requests per second. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.fetch_size_avg + description: The average number of bytes fetched per request + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: topic + type: STRING + - name: kafka.consumer.fetch_size_max + description: The maximum number of bytes fetched per request + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: topic + type: STRING + - name: kafka.consumer.fetch_throttle_time_avg + description: The average throttle time in ms + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.fetch_throttle_time_max + description: The maximum throttle time in ms + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.fetch_total + description: The total number of fetch requests. + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.heartbeat_rate + description: The number of heartbeats per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.heartbeat_total + description: The total number of heartbeats + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.incoming_byte_rate + description: The number of bytes read off all sockets per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.consumer.incoming_byte_total + description: The total number of bytes read off all sockets + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.consumer.io_ratio + description: The fraction of time the I/O thread spent doing I/O + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.io_time_ns_avg + description: The average length of time for I/O per select call in nanoseconds. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.io_time_ns_total + description: The total time the I/O thread spent doing I/O + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.io_wait_ratio + description: The fraction of time the I/O thread spent waiting + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.io_wait_time_ns_avg + description: The average length of time the I/O thread spent waiting for a + socket ready for reads or writes in nanoseconds. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.io_wait_time_ns_total + description: The total time the I/O thread spent waiting + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.join_rate + description: The number of group joins per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.join_time_avg + description: The average time taken for a group rejoin + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.join_time_max + description: The max time taken for a group rejoin + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.join_total + description: The total number of group joins + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.last_heartbeat_seconds_ago + description: The number of seconds since the last coordinator heartbeat was + sent + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.last_poll_seconds_ago + description: The number of seconds since the last poll() invocation. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.last_rebalance_seconds_ago + description: The number of seconds since the last successful rebalance event + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.network_io_rate + description: The number of network operations (reads or writes) on all connections + per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.network_io_total + description: The total number of network operations (reads or writes) on all + connections + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.outgoing_byte_rate + description: The number of outgoing bytes sent to all servers per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.consumer.outgoing_byte_total + description: The total number of outgoing bytes sent to all servers + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.consumer.partition_assigned_latency_avg + description: The average time taken for a partition-assigned rebalance listener + callback + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.partition_assigned_latency_max + description: The max time taken for a partition-assigned rebalance listener + callback + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.poll_idle_ratio_avg + description: The average fraction of time the consumer's poll() is idle as + opposed to waiting for the user code to process records. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.rebalance_latency_avg + description: The average time taken for a group to complete a successful rebalance, + which may be composed of several failed re-trials until it succeeded + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.rebalance_latency_max + description: The max time taken for a group to complete a successful rebalance, + which may be composed of several failed re-trials until it succeeded + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.rebalance_latency_total + description: The total number of milliseconds this consumer has spent in successful + rebalances since creation + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.rebalance_rate_per_hour + description: The number of successful rebalance events per hour, each event + is composed of several failed re-trials until it succeeded + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.rebalance_total + description: The total number of successful rebalance events, each event is + composed of several failed re-trials until it succeeded + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.records_consumed_rate + description: The average number of records consumed per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: topic + type: STRING + - name: kafka.consumer.records_consumed_total + description: The total number of records consumed + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: topic + type: STRING + - name: kafka.consumer.records_lag + description: 'The latest lag of the partition. Note: For topic names with + periods (.), an additional metric with underscores is emitted. However, + the periods replaced metric is deprecated. Please use the metric with actual + topic name instead.' + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: partition + type: STRING + - name: topic + type: STRING + - name: kafka.consumer.records_lag_avg + description: 'The average lag of the partition. Note: For topic names with + periods (.), an additional metric with underscores is emitted. However, + the periods replaced metric is deprecated. Please use the metric with actual + topic name instead.' + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: partition + type: STRING + - name: topic + type: STRING + - name: kafka.consumer.records_lag_max + description: 'The maximum lag in terms of number of records for any partition + in this window. NOTE: This is based on current offset and not committed + offset' + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: partition + type: STRING + - name: topic + type: STRING + - name: kafka.consumer.records_lead + description: 'The latest lead of the partition. Note: For topic names with + periods (.), an additional metric with underscores is emitted. However, + the periods replaced metric is deprecated. Please use the metric with actual + topic name instead.' + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: partition + type: STRING + - name: topic + type: STRING + - name: kafka.consumer.records_lead_avg + description: 'The average lead of the partition. Note: For topic names with + periods (.), an additional metric with underscores is emitted. However, + the periods replaced metric is deprecated. Please use the metric with actual + topic name instead.' + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: partition + type: STRING + - name: topic + type: STRING + - name: kafka.consumer.records_lead_min + description: The minimum lead in terms of number of records for any partition + in this window + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: partition + type: STRING + - name: topic + type: STRING + - name: kafka.consumer.records_per_request_avg + description: The average number of records in each request + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: topic + type: STRING + - name: kafka.consumer.request_latency_avg + description: '' + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.consumer.request_latency_max + description: '' + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.consumer.request_rate + description: The number of requests sent per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.consumer.request_size_avg + description: The average size of requests sent. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.consumer.request_size_max + description: The maximum size of any request sent. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.consumer.request_total + description: The total number of requests sent + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.consumer.response_rate + description: The number of responses received per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.consumer.response_total + description: The total number of responses received + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.consumer.select_rate + description: The number of times the I/O layer checked for new I/O to perform + per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.select_total + description: The total number of times the I/O layer checked for new I/O to + perform + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.successful_authentication_no_reauth_total + description: The total number of connections with successful authentication + where the client does not support re-authentication + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.successful_authentication_rate + description: The number of connections with successful authentication per + second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.successful_authentication_total + description: The total number of connections with successful authentication + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.successful_reauthentication_rate + description: The number of successful re-authentication of connections per + second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.successful_reauthentication_total + description: The total number of successful re-authentication of connections + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.sync_rate + description: The number of group syncs per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.sync_time_avg + description: The average time taken for a group sync + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.sync_time_max + description: The max time taken for a group sync + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.sync_total + description: The total number of group syncs + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.time_between_poll_avg + description: The average delay between invocations of poll() in milliseconds. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.consumer.time_between_poll_max + description: The max delay between invocations of poll() in milliseconds. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.batch_size_avg + description: The average number of bytes sent per partition per-request. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.batch_size_max + description: The max number of bytes sent per partition per-request. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.batch_split_rate + description: The average number of batch splits per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.batch_split_total + description: The total number of batch splits + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.buffer_available_bytes + description: The total amount of buffer memory that is not being used (either + unallocated or in the free list). + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.buffer_exhausted_rate + description: The average per-second number of record sends that are dropped + due to buffer exhaustion + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.buffer_exhausted_total + description: The total number of record sends that are dropped due to buffer + exhaustion + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.buffer_total_bytes + description: The maximum amount of buffer memory the client can use (whether + or not it is currently used). + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.bufferpool_wait_ratio + description: The fraction of time an appender waits for space allocation. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.bufferpool_wait_time_ns_total + description: The total time in nanoseconds an appender waits for space allocation. + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.byte_rate + description: The average number of bytes sent per second for a topic. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: topic + type: STRING + - name: kafka.producer.byte_total + description: The total number of bytes sent for a topic. + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: topic + type: STRING + - name: kafka.producer.compression_rate + description: The average compression rate of record batches for a topic, defined + as the average ratio of the compressed batch size over the uncompressed + size. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: topic + type: STRING + - name: kafka.producer.compression_rate_avg + description: The average compression rate of record batches, defined as the + average ratio of the compressed batch size over the uncompressed size. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.connection_close_rate + description: The number of connections closed per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.connection_close_total + description: The total number of connections closed + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.connection_count + description: The current number of active connections. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.connection_creation_rate + description: The number of new connections established per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.connection_creation_total + description: The total number of new connections established + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.failed_authentication_rate + description: The number of connections with failed authentication per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.failed_authentication_total + description: The total number of connections with failed authentication + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.failed_reauthentication_rate + description: The number of failed re-authentication of connections per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.failed_reauthentication_total + description: The total number of failed re-authentication of connections + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.flush_time_ns_total + description: Total time producer has spent in flush in nanoseconds. + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.incoming_byte_rate + description: The number of bytes read off all sockets per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.producer.incoming_byte_total + description: The total number of bytes read off all sockets + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.producer.io_ratio + description: The fraction of time the I/O thread spent doing I/O + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.io_time_ns_avg + description: The average length of time for I/O per select call in nanoseconds. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.io_time_ns_total + description: The total time the I/O thread spent doing I/O + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.io_wait_ratio + description: The fraction of time the I/O thread spent waiting + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.io_wait_time_ns_avg + description: The average length of time the I/O thread spent waiting for a + socket ready for reads or writes in nanoseconds. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.io_wait_time_ns_total + description: The total time the I/O thread spent waiting + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.metadata_age + description: The age in seconds of the current producer metadata being used. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.metadata_wait_time_ns_total + description: Total time producer has spent waiting on topic metadata in nanoseconds. + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.network_io_rate + description: The number of network operations (reads or writes) on all connections + per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.network_io_total + description: The total number of network operations (reads or writes) on all + connections + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.outgoing_byte_rate + description: The number of outgoing bytes sent to all servers per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.producer.outgoing_byte_total + description: The total number of outgoing bytes sent to all servers + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.producer.produce_throttle_time_avg + description: The average time in ms a request was throttled by a broker + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id type: STRING - - name: messaging.destination.name + - name: kafka.producer.produce_throttle_time_max + description: The maximum time in ms a request was throttled by a broker + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id type: STRING - - name: messaging.destination.partition.id + - name: kafka.producer.record_error_rate + description: The average per-second number of record sends that resulted in + errors + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id type: STRING - - name: messaging.kafka.consumer.group + - name: topic type: STRING - - name: messaging.kafka.message.key + - name: kafka.producer.record_error_total + description: The total number of record sends that resulted in errors + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id type: STRING - - name: messaging.kafka.message.offset - type: LONG - - name: messaging.kafka.message.tombstone - type: BOOLEAN - - name: messaging.message.body.size - type: LONG - - name: messaging.operation + - name: topic type: STRING - - name: messaging.system + - name: kafka.producer.record_queue_time_avg + description: The average time in ms record batches spent in the send buffer. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id type: STRING - - span_kind: PRODUCER + - name: kafka.producer.record_queue_time_max + description: The maximum time in ms record batches spent in the send buffer. + type: DOUBLE_GAUGE + unit: '' attributes: - - name: messaging.client_id + - name: client-id type: STRING - - name: messaging.destination.name + - name: kafka.producer.record_retry_rate + description: The average per-second number of retried record sends + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id type: STRING - - name: messaging.destination.partition.id + - name: topic type: STRING - - name: messaging.kafka.message.key + - name: kafka.producer.record_retry_total + description: The total number of retried record sends + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id type: STRING - - name: messaging.kafka.message.offset - type: LONG - - name: messaging.kafka.message.tombstone - type: BOOLEAN - - name: messaging.operation + - name: topic type: STRING - - name: messaging.system + - name: kafka.producer.record_send_rate + description: The average number of records sent per second. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: topic + type: STRING + - name: kafka.producer.record_send_total + description: The total number of records sent. + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: topic + type: STRING + - name: kafka.producer.record_size_avg + description: The average record size + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.record_size_max + description: The maximum record size + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.records_per_request_avg + description: The average number of records per request. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.request_latency_avg + description: The average request latency in ms + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.producer.request_latency_max + description: The maximum request latency in ms + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.producer.request_rate + description: The number of requests sent per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.producer.request_size_avg + description: The average size of requests sent. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.producer.request_size_max + description: The maximum size of any request sent. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.producer.request_total + description: The total number of requests sent + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.producer.requests_in_flight + description: The current number of in-flight requests awaiting a response. + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.response_rate + description: The number of responses received per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.producer.response_total + description: The total number of responses received + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: node-id + type: STRING + - name: kafka.producer.select_rate + description: The number of times the I/O layer checked for new I/O to perform + per second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.select_total + description: The total number of times the I/O layer checked for new I/O to + perform + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.successful_authentication_no_reauth_total + description: The total number of connections with successful authentication + where the client does not support re-authentication + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.successful_authentication_rate + description: The number of connections with successful authentication per + second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.successful_authentication_total + description: The total number of connections with successful authentication + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.successful_reauthentication_rate + description: The number of successful re-authentication of connections per + second + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.successful_reauthentication_total + description: The total number of successful re-authentication of connections + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.txn_abort_time_ns_total + description: Total time producer has spent in abortTransaction in nanoseconds. + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.txn_begin_time_ns_total + description: Total time producer has spent in beginTransaction in nanoseconds. + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.txn_commit_time_ns_total + description: Total time producer has spent in commitTransaction in nanoseconds. + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.txn_init_time_ns_total + description: Total time producer has spent in initTransactions in nanoseconds. + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.txn_prepare_time_ns_total + description: Total time producer has spent in prepareTransaction in nanoseconds. + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.txn_send_offsets_time_ns_total + description: Total time producer has spent in sendOffsetsToTransaction in + nanoseconds. + type: DOUBLE_SUM + unit: '' + attributes: + - name: client-id + type: STRING + - name: kafka.producer.waiting_threads + description: The number of user threads blocked waiting for buffer memory + to enqueue their records + type: DOUBLE_GAUGE + unit: '' + attributes: + - name: client-id type: STRING - - when: otel.instrumentation.kafka.experimental-span-attributes=true spans: - span_kind: CONSUMER attributes: @@ -8278,8 +10842,6 @@ libraries: spans: - span_kind: CONSUMER attributes: - - name: asdf - type: STRING - name: messaging.client_id type: STRING - name: messaging.destination.name @@ -8302,8 +10864,6 @@ libraries: spans: - span_kind: CONSUMER attributes: - - name: asdf - type: STRING - name: kafka.record.queue_time_ms type: LONG - name: messaging.client_id diff --git a/instrumentation-docs/src/main/java/io/opentelemetry/instrumentation/docs/parsers/EmittedSpanParser.java b/instrumentation-docs/src/main/java/io/opentelemetry/instrumentation/docs/parsers/EmittedSpanParser.java index fd01ba6dbe7a..cf632841c3f5 100644 --- a/instrumentation-docs/src/main/java/io/opentelemetry/instrumentation/docs/parsers/EmittedSpanParser.java +++ b/instrumentation-docs/src/main/java/io/opentelemetry/instrumentation/docs/parsers/EmittedSpanParser.java @@ -64,7 +64,8 @@ public static Map getSpansByScopeFromFiles( } }); } catch (IOException e) { - logger.severe("Error reading span files: " + e.getMessage()); + logger.severe( + "Error reading span files from " + instrumentationDirectory + ": " + e.getMessage()); } } diff --git a/instrumentation-docs/src/main/java/io/opentelemetry/instrumentation/docs/parsers/SpanParser.java b/instrumentation-docs/src/main/java/io/opentelemetry/instrumentation/docs/parsers/SpanParser.java index b35c35a29826..de6130532d5a 100644 --- a/instrumentation-docs/src/main/java/io/opentelemetry/instrumentation/docs/parsers/SpanParser.java +++ b/instrumentation-docs/src/main/java/io/opentelemetry/instrumentation/docs/parsers/SpanParser.java @@ -26,6 +26,7 @@ public class SpanParser { // We want to ignore test related attributes private static final List EXCLUDED_ATTRIBUTES = List.of( + "asdf", "x-test-", "test-baggage-", "test_message", diff --git a/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/internal/MetaDataCollector.java b/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/internal/MetaDataCollector.java index e94a0a4e677f..6e8488d18455 100644 --- a/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/internal/MetaDataCollector.java +++ b/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/internal/MetaDataCollector.java @@ -5,22 +5,27 @@ package io.opentelemetry.instrumentation.testing.internal; -import static java.nio.charset.StandardCharsets.UTF_8; - import io.opentelemetry.api.common.AttributeType; import io.opentelemetry.api.internal.InternalAttributeKeyImpl; import io.opentelemetry.api.trace.SpanKind; import io.opentelemetry.sdk.common.InstrumentationScopeInfo; import io.opentelemetry.sdk.metrics.data.MetricData; -import java.io.BufferedWriter; +import io.opentelemetry.testing.internal.jackson.annotation.JsonProperty; +import io.opentelemetry.testing.internal.jackson.dataformat.yaml.YAMLFactory; +import io.opentelemetry.testing.internal.jackson.dataformat.yaml.YAMLGenerator; +import io.opentelemetry.testing.internal.jackson.dataformat.yaml.YAMLMapper; import java.io.IOException; import java.nio.file.FileAlreadyExistsException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; import java.util.Map; import java.util.Set; import java.util.UUID; +import java.util.logging.Logger; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -34,10 +39,20 @@ */ public final class MetaDataCollector { + private static final Logger logger = Logger.getLogger(MetaDataCollector.class.getName()); + private static final String TMP_DIR = ".telemetry"; private static final Pattern MODULE_PATTERN = Pattern.compile("(.*?/instrumentation/.*?)(/javaagent|/library|/testing)"); + private static final YAMLMapper YAML = + YAMLMapper.builder( + YAMLFactory.builder() + .disable(YAMLGenerator.Feature.WRITE_DOC_START_MARKER) + .enable(YAMLGenerator.Feature.MINIMIZE_QUOTES) + .build()) + .build(); + public static void writeTelemetryToFiles( String path, Map> metricsByScope, @@ -85,53 +100,53 @@ private static void writeSpanData( Path spansPath = Paths.get(instrumentationPath, TMP_DIR, "spans-" + UUID.randomUUID() + ".yaml"); - try (BufferedWriter writer = Files.newBufferedWriter(spansPath.toFile().toPath(), UTF_8)) { - String config = System.getProperty("metadataConfig"); - String when = "default"; - if (config != null && !config.isEmpty()) { - when = config; + String config = System.getProperty("metadataConfig"); + String when = (config != null && !config.isEmpty()) ? config : "default"; + + SpanData spanData = new SpanData(); + spanData.when = when; + spanData.spansByScope = new ArrayList<>(); + + for (Map.Entry< + InstrumentationScopeInfo, + Map, AttributeType>>> + entry : spansByScopeAndKind.entrySet()) { + InstrumentationScopeInfo scope = entry.getKey(); + Map, AttributeType>> spansByKind = entry.getValue(); + + ScopeSpans scopeSpans = new ScopeSpans(); + scopeSpans.scope = scope.getName(); + scopeSpans.spans = new ArrayList<>(); + + for (Map.Entry, AttributeType>> kindEntry : + spansByKind.entrySet()) { + SpanKind spanKind = kindEntry.getKey(); + Map, AttributeType> attributes = kindEntry.getValue(); + + Span span = new Span(); + span.spanKind = spanKind.toString(); + span.attributes = new ArrayList<>(); + + attributes.forEach( + (key, value) -> { + AttributeInfo attr = new AttributeInfo(); + attr.name = key.getKey(); + attr.type = key.getType().toString(); + span.attributes.add(attr); + }); + + scopeSpans.spans.add(span); } - writer.write("when: " + when + "\n"); - - writer.write("spans_by_scope:\n"); - - for (Map.Entry< - InstrumentationScopeInfo, - Map, AttributeType>>> - entry : spansByScopeAndKind.entrySet()) { - InstrumentationScopeInfo scope = entry.getKey(); - Map, AttributeType>> spansByKind = - entry.getValue(); - - writer.write(" - scope: " + scope.getName() + "\n"); - writer.write(" spans:\n"); - - for (Map.Entry, AttributeType>> kindEntry : - spansByKind.entrySet()) { - SpanKind spanKind = kindEntry.getKey(); - Map, AttributeType> attributes = kindEntry.getValue(); - - writer.write(" - span_kind: " + spanKind.toString() + "\n"); - writer.write(" attributes:\n"); - attributes.forEach( - (key, value) -> { - try { - writer.write(" - name: " + key.getKey() + "\n"); - writer.write(" type: " + key.getType().toString() + "\n"); - } catch (IOException e) { - throw new IllegalStateException(e); - } - }); - } - } + spanData.spansByScope.add(scopeSpans); } + + YAML.writeValue(spansPath.toFile(), spanData); } private static void writeMetricData( String instrumentationPath, - Map> metricsByScope) - throws IOException { + Map> metricsByScope) { if (metricsByScope.isEmpty()) { return; @@ -140,46 +155,54 @@ private static void writeMetricData( Path metricsPath = Paths.get(instrumentationPath, TMP_DIR, "metrics-" + UUID.randomUUID() + ".yaml"); - try (BufferedWriter writer = Files.newBufferedWriter(metricsPath.toFile().toPath(), UTF_8)) { + try { String config = System.getProperty("metadataConfig"); - String when = "default"; - if (config != null && !config.isEmpty()) { - when = config; - } - - writer.write("when: " + when + "\n"); + String when = (config != null && !config.isEmpty()) ? config : "default"; - writer.write("metrics_by_scope:\n"); + MetricsData metricsData = new MetricsData(); + metricsData.when = when; + metricsData.metricsByScope = new ArrayList<>(); for (Map.Entry> entry : metricsByScope.entrySet()) { InstrumentationScopeInfo scope = entry.getKey(); Map metrics = entry.getValue(); - writer.write(" - scope: " + scope.getName() + "\n"); - writer.write(" metrics:\n"); + ScopeMetrics scopeMetrics = new ScopeMetrics(); + scopeMetrics.scope = scope.getName(); + scopeMetrics.metrics = new ArrayList<>(); for (MetricData metric : metrics.values()) { - writer.write(" - name: " + metric.getName() + "\n"); - writer.write(" description: " + metric.getDescription() + "\n"); - writer.write(" type: " + metric.getType().toString() + "\n"); - writer.write(" unit: " + sanitizeUnit(metric.getUnit()) + "\n"); - writer.write(" attributes: \n"); + Metric metricInfo = new Metric(); + metricInfo.name = metric.getName(); + metricInfo.description = metric.getDescription(); + metricInfo.type = metric.getType().toString(); + metricInfo.unit = sanitizeUnit(metric.getUnit()); + metricInfo.attributes = new ArrayList<>(); + metric.getData().getPoints().stream() .findFirst() - .get() - .getAttributes() - .forEach( - (key, value) -> { - try { - writer.write(" - name: " + key.getKey() + "\n"); - writer.write(" type: " + key.getType().toString() + "\n"); - } catch (IOException e) { - throw new IllegalStateException(e); - } - }); + .ifPresent( + point -> + point + .getAttributes() + .forEach( + (key, value) -> { + AttributeInfo attr = new AttributeInfo(); + attr.name = key.getKey(); + attr.type = key.getType().toString(); + metricInfo.attributes.add(attr); + })); + + scopeMetrics.metrics.add(metricInfo); } + + metricsData.metricsByScope.add(scopeMetrics); } + + YAML.writeValue(metricsPath.toFile(), metricsData); + } catch (Exception e) { + logger.warning("Failed to write metric data: " + e.getMessage()); } } @@ -193,27 +216,27 @@ private static void writeScopeData( Path outputPath = Paths.get(instrumentationPath, TMP_DIR, "scope-" + UUID.randomUUID() + ".yaml"); - try (BufferedWriter writer = Files.newBufferedWriter(outputPath.toFile().toPath(), UTF_8)) { - writer.write("scopes:\n"); - for (InstrumentationScopeInfo scope : instrumentationScopes) { - writer.write(" - name: " + scope.getName() + "\n"); - writer.write(" version: " + scope.getVersion() + "\n"); - writer.write(" schemaUrl: " + scope.getSchemaUrl() + "\n"); - if (scope.getAttributes() != null && !scope.getAttributes().isEmpty()) { - writer.write(" attributes:\n"); - scope - .getAttributes() - .forEach( - (key, value) -> { - try { - writer.write(" " + key + ": " + value + "\n"); - } catch (IOException e) { - throw new IllegalStateException(e); - } - }); - } + + ScopesData scopesData = new ScopesData(); + scopesData.scopes = new ArrayList<>(); + + for (InstrumentationScopeInfo scope : instrumentationScopes) { + ScopeInfo scopeInfo = new ScopeInfo(); + scopeInfo.name = scope.getName(); + scopeInfo.version = scope.getVersion(); + scopeInfo.schemaUrl = scope.getSchemaUrl(); + + if (scope.getAttributes() != null && !scope.getAttributes().isEmpty()) { + scopeInfo.attributes = new LinkedHashMap<>(); + scope + .getAttributes() + .forEach((key, value) -> scopeInfo.attributes.put(key.getKey(), value.toString())); } + + scopesData.scopes.add(scopeInfo); } + + YAML.writeValue(outputPath.toFile(), scopesData); } private static String sanitizeUnit(String unit) { @@ -221,4 +244,59 @@ private static String sanitizeUnit(String unit) { } private MetaDataCollector() {} + + static class SpanData { + public String when; + + @JsonProperty("spans_by_scope") + public List spansByScope; + } + + static class ScopeSpans { + public String scope; + public List spans; + } + + static class Span { + @JsonProperty("span_kind") + public String spanKind; + + public List attributes; + } + + static class MetricsData { + public String when; + + @JsonProperty("metrics_by_scope") + public List metricsByScope; + } + + static class ScopeMetrics { + public String scope; + public List metrics; + } + + static class Metric { + public String name; + public String description; + public String type; + public String unit; + public List attributes; + } + + static class ScopesData { + public List scopes; + } + + static class ScopeInfo { + public String name; + public String version; + public String schemaUrl; + public Map attributes; + } + + static class AttributeInfo { + public String name; + public String type; + } }