question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Historgam" fails with Python 2.7.6

See original GitHub issue

Hello!

I’m running prometheus_client==0.0.19 with Flask. As far as I understand the source code of the client, this registers every “Metric” in default prometheus_client.core.REGISTRY. So in my app I do the following:

def set_monitoring(self):
    self.server_summary = Histogram('main_flask_server', 'All requests timing', ['instance', 'endpoint'])
    self.server_errors = Histogram('main_flask_server_errors', 'Bad requests', ['instance', 'endpoint'])

...

app. set_monitoring()

...

app.server_summary.labels('i1', key).observe(dt_ms)

...

push_to_gateway(gateway=gateway, job='flask_meme', registry=REGISTRY)

On my local machine (MacOS Sierra, Python 2.7.12) everything is fine and works perfectly. But on the Ubuntu server with Python 2.7.6 I got the exception on startup. Traceback:

unable to load app 0 (mountpoint='') (callable not found or import error)
Traceback (most recent call last):
  File "/home/vladimir/membot/imager/server.py", line 104, in uwsgi_app
    return get_app(conf=conf)
  File "/home/vladimir/membot/imager/server.py", line 95, in get_app
    flask_app.set_monitoring()
  File "/home/vladimir/membot/imager/server.py", line 46, in set_monitoring
    self.server_summary = Histogram('main_flask_server', 'All requests timing', ['instance', 'endpoint'])
  File "/usr/local/lib/python2.7/dist-packages/prometheus_client/core.py", line 556, in init
    registry.register(collector)
  File "/usr/local/lib/python2.7/dist-packages/prometheus_client/core.py", line 54, in register
    'in CollectorRegistry: ' + name)
ValueError: Timeseries already present in CollectorRegistry: main_flask_server_bucket

What am I doing wrong? Why Timeseries is already present in CollectorRegistry?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
patrickleetcommented, Feb 22, 2018

the whole community can benefit from the answers provided.

except those who look on github

0reactions
brian-brazilcommented, Apr 1, 2020

Random github issues are not a good place for support requests, I’m locking this now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot get histogram to show separated bins with vertical lines
I am trying to make a histogram where the bins have the 'bar style' where vertical lines separate each bin but no matter...
Read more >
boost-histogram and hist - CERN Indico
▷ If anyone writes pip install boost-histogram and it fails, we have failed. • Docker ManyLinux1 GCC 8.3: /scikit-hep/manylinuxgcc. Wheels. • ...
Read more >
A Vector Field Histogram implementation in Python 2.7
I'm having a hard time following your code, partly because I don't know Python but I think mostly because I'm not sure I...
Read more >
Python Release Python 2.7.6
This is a 2.7 series bugfix release. Most importantly, it resolves an issue that caused the interactive prompt to crash on OS X...
Read more >
hdrhistogram - PyPI
High Dynamic Range histogram in native python. ... This library provides a solution for the aggregation part of the problem: reuse the HDR...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found