dragosvictor opened a new pull request, #22837: URL: https://github.com/apache/pulsar/pull/22837
### Motivation PR https://github.com/apache/pulsar/pull/22693 introduced OpenTelemetry consumer stats. Two issues surfaced as part of a follow-up review: 1. The attribute sets are immutable and should be cached, such that they are not allocated on each metric collection run. 2. Too many attributes are being exposed, potentially slowing down the metric pipeline as a result. Many of these attributes are currently being emitted as 'string' metrics in Prometheus. ### Modifications 1. Cache the attribute sets in the Consumer class, using lazy initialization to conserve memory if OTel is disabled. 2. Remove consumer attributes `pulsar.consumer.connected_since`, `pulsar.consumer.metadata`, `pulsar.client.address`, and `pulsar.client.version`. 3. Extract attribute `pulsar.consumer.blocked` from metric `"pulsar.broker.consumer.message.unack.count` into its own metric `pulsar.broker.consumer.blocked`. ### Verifying this change - [ ] Make sure that the change passes the CI checks. This change added tests and can be verified as follows: - Updated test `OpenTelemetryTopicStatsTest#testMessagingMetrics` to account for these changes ### Does this pull request potentially affect one of the following parts: - [ ] Dependencies (add or upgrade a dependency) - [ ] The public API - [ ] The schema - [ ] The default values of configurations - [ ] The threading model - [ ] The binary protocol - [ ] The REST endpoints - [ ] The admin CLI options - [x] The metrics: _As described above_ - [ ] Anything that affects deployment ### Documentation - [ ] `doc` <!-- Your PR contains doc changes. --> - [x] `doc-required` <!-- Your PR changes impact docs and you will update later --> - [ ] `doc-not-needed` <!-- Your PR changes do not impact docs --> - [ ] `doc-complete` <!-- Docs have been already added --> ### Matching PR in forked repository PR in forked repository: https://github.com/dragosvictor/pulsar/pull/30 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@pulsar.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org