pkutilina opened a new pull request #600:
URL: https://github.com/apache/pulsar-client-go/pull/600


   ### Motivation
   
   It's a bug: when there're several consumers for several topics, builtin 
pulsar metrics are collected only for first subscribed topic. It happens so 
because prometheus collector is identified by metric_name + const labels, and 
as typically topics has predefined metrics set with same const labels, 
registration throws AlreadyRegisteredError. Ignoring this error leads to 
metrics left unregistrated (subsequent metrics record observations but they are 
not collected).
   
   ### Modifications
   
   Attach existing collector to metrics. 
   Prometheus lib also suggests handling this type of error this way: 
https://github.com/prometheus/client_golang/blob/2261d5cda14eb2adc5897b56996248705f9bb840/prometheus/registry.go#L206
   
https://github.com/prometheus/client_golang/blob/2261d5cda14eb2adc5897b56996248705f9bb840/prometheus/examples_test.go#L602
   
   ### Verifying this change
   
   - [ ] Make sure that the change passes the CI checks.
   
   *(Please pick either of the following options)*
   
   This change is a trivial rework / code cleanup without any test coverage.
   
   *(or)*
   
   This change is already covered by existing tests, such as *(please describe 
tests)*.
   
   *(or)*
   
   This change added tests and can be verified as follows:
   
   *(example:)*
     - *Added integration tests for end-to-end deployment with large payloads 
(10MB)*
     - *Extended integration test for recovery after broker failure*
   
   ### Does this pull request potentially affect one of the following parts:
   
   *If `yes` was chosen, please highlight the changes*
   
     - Dependencies (does it add or upgrade a dependency): no
     - The public API: no
     - The schema: no
     - The default values of configurations: no
     - The wire protocol: no
   
   ### Documentation
   
     - Does this pull request introduce a new feature? no
     - If yes, how is the feature documented? not applicable
     - If a feature is not applicable for documentation, explain why? it's bug, 
not feature
     - If a feature is not documented yet in this PR, please create a followup 
issue for adding the documentation
   


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


Reply via email to