Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prometheus Metrics Duplication Error #209

Closed
blink1073 opened this issue Apr 25, 2020 · 2 comments · Fixed by #210
Closed

Prometheus Metrics Duplication Error #209

blink1073 opened this issue Apr 25, 2020 · 2 comments · Fixed by #210

Comments

@blink1073
Copy link
Contributor

blink1073 commented Apr 25, 2020

As it says on the tin, re-defining these metrics results in an error. This bug is preventing the notebook and jupyter_server packages from peacefully co-existing.

In [3]: from notebook import log

In [4]: from jupyter_server import log
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-4-026e191fd69c> in <module>
----> 1 from jupyter_server import log

/tmp/conda_envs/0d2c69b0eca52b083fd9c7e9/lib/python3.8/site-packages/jupyter_server/log.py in <module>
      8 import json
      9 from tornado.log import access_log
---> 10 from .prometheus.log_functions import prometheus_log_method
     11
     12

/tmp/conda_envs/0d2c69b0eca52b083fd9c7e9/lib/python3.8/site-packages/jupyter_server/prometheus/log_functions.py in <module>
----> 1 from .metrics import HTTP_REQUEST_DURATION_SECONDS
      2
      3
      4 def prometheus_log_method(handler):
      5     """

/tmp/conda_envs/0d2c69b0eca52b083fd9c7e9/lib/python3.8/site-packages/jupyter_server/prometheus/metrics.py in <module>
     10
     11
---> 12 HTTP_REQUEST_DURATION_SECONDS = Histogram(
     13     'http_request_duration_seconds',
     14     'duration in seconds for all HTTP requests',

/tmp/conda_envs/0d2c69b0eca52b083fd9c7e9/lib/python3.8/site-packages/prometheus_client/metrics.py in __init__(self, name, documentation, labelnames, namespace, subsystem, unit, registry, labelvalues, buckets)
    489                  ):
    490         self._prepare_buckets(buckets)
--> 491         super(Histogram, self).__init__(
    492             name=name,
    493             documentation=documentation,

/tmp/conda_envs/0d2c69b0eca52b083fd9c7e9/lib/python3.8/site-packages/prometheus_client/metrics.py in __init__(self, name, documentation, labelnames, namespace, subsystem, unit, registry, labelvalues)
    105             # Register the multi-wrapper parent metric, or if a label-less metric, the whole shebang.
    106             if registry:
--> 107                 registry.register(self)
    108
    109     def labels(self, *labelvalues, **labelkwargs):

/tmp/conda_envs/0d2c69b0eca52b083fd9c7e9/lib/python3.8/site-packages/prometheus_client/registry.py in register(self, collector)
     25             duplicates = set(self._names_to_collectors).intersection(names)
     26             if duplicates:
---> 27                 raise ValueError(
     28                     'Duplicated timeseries in CollectorRegistry: {0}'.format(
     29                         duplicates))

ValueError: Duplicated timeseries in CollectorRegistry: {'http_request_duration_seconds_sum', 'http_request_duration_seconds_created', 'http_request_duration_seconds_bucket', 'http_request_duration_seconds_count'}
@blink1073 blink1073 changed the title Prometheus Metrics Import Error Prometheus Metrics Duplication Error Apr 25, 2020
@ivanov
Copy link
Contributor

ivanov commented Apr 25, 2020

There can be only one!

@blink1073
Copy link
Contributor Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants