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.

AttributeError: module 'opencensus.stats.stats' has no attribute 'Stats'

See original GitHub issue

I’m following the Python example on https://opencensus.io/stats/view/#2

>>> from opencensus.stats import stats
>>> view_manager = stats.Stats().view_manager
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'opencensus.stats.stats' has no attribute 'Stats'

Reading https://github.com/census-instrumentation/opencensus-python/blob/f4d8ec36cada8b385821a16795f27fe322694a1a/opencensus/stats/stats.py#L22,

Stats seems to have been protected as _Stats, what’s the current recommended way to start a view manager, please?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
lzchencommented, Jul 29, 2020

I’m not sure if having multiple instances of Stats/ViewManager would be preferable. Having a global variable and all Views registered through that one instance makes it so that we do not have to have additional configuration api as part of the metrics pipeline. For example, if I have multiple ViewManagers, and I add different views for each of them, how would I know which ones to pull from to export metrics? I would have to “attach” ViewManagers to exporters. With only one ViewManager instance, when I export I will only need to collect metrics from only one source.

0reactions
lzchencommented, Sep 30, 2020

@rpavlov Can you provide an example?

Read more comments on GitHub >

github_iconTop Results From Across the Web

AttributeError: module 'statsmodels' has no attribute 'stats'
I'm running statsmodels 0.13.2 on macOS Monterey v 12.4 with M1 chip. I'm trying to do a z-test with statsmodels.stats.weightstats.ztest.
Read more >
Module 'scipy' has no attribute 'stats' ( Solved )
In this entire tutorial, you will know how to solve the issue of the module 'scipy' having no attribute 'stats'. What is the...
Read more >
opencensus-ext-azure - PyPI
The Azure Monitor Metrics Exporter allows you to export metrics to Azure Monitor. from opencensus.ext.azure import metrics_exporter from opencensus.stats import ...
Read more >
How to use the opencensus.common.utils.to_iso_str function ...
assertRaises(AttributeError): span_data.name = 'child' with self. ... census-instrumentation / opencensus-python / tests / unit / stats / test_view_data.py ...
Read more >
Monitor Python applications with Azure Monitor - Microsoft Learn
Instrument with OpenCensus Python SDK with Azure Monitor exporters ... OpenCensus.stats supports four aggregation methods but provides ...
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