-
Notifications
You must be signed in to change notification settings - Fork 648
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
Add a configuration manager #466
Changes from all commits
3a0a966
fd6f4e5
7009e68
10f04fb
32bb9d2
7dd05bd
b05eaa6
41c21eb
e685cb7
00cfd7e
a684297
e2e0bcc
f54234b
342278a
f5df21a
cbc1a03
cfcc34c
5adb183
cfc1a09
aed3398
7703cdd
33c7e1f
0ea8bd5
05944d8
e376833
76bb125
d7ed20e
2920992
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,3 @@ OpenTelemetry Python API | |
context | ||
metrics | ||
trace | ||
util.loader |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,11 +21,10 @@ | |
from opentelemetry.ext.otcollector.metrics_exporter import ( | ||
CollectorMetricsExporter, | ||
) | ||
from opentelemetry.sdk.metrics import Counter, MeterProvider | ||
from opentelemetry.sdk.metrics import Counter | ||
from opentelemetry.sdk.metrics.export.controller import PushController | ||
|
||
# Meter is responsible for creating and recording metrics | ||
metrics.set_preferred_meter_provider_implementation(lambda _: MeterProvider()) | ||
meter = metrics.get_meter(__name__) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This returns an api metrics.set_meter_provider(sdk.metrics.MeterProvider()) Or is it intentional that the examples only use the API types? I think it'd be more helpful to show using the SDK since that's how most users will do it. |
||
# exporter to export metrics to OT Collector | ||
exporter = CollectorMetricsExporter( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,25 +34,11 @@ class TestCollectorMetricsExporter(unittest.TestCase): | |
@classmethod | ||
def setUpClass(cls): | ||
# pylint: disable=protected-access | ||
cls._meter_defaults = ( | ||
metrics._METER_PROVIDER, | ||
metrics._METER_PROVIDER_FACTORY, | ||
) | ||
metrics.set_preferred_meter_provider_implementation( | ||
lambda _: MeterProvider() | ||
) | ||
metrics.set_meter_provider(MeterProvider()) | ||
cls._meter = metrics.get_meter(__name__) | ||
kvp = {"environment": "staging"} | ||
cls._test_label_set = cls._meter.get_label_set(kvp) | ||
|
||
@classmethod | ||
def tearDownClass(cls): | ||
# pylint: disable=protected-access | ||
( | ||
metrics._METER_PROVIDER, | ||
metrics._METER_PROVIDER_FACTORY, | ||
) = cls._meter_defaults | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems like tests that set the meter/tracer provider on setup should still unset it on teardown. Why remove this instead of update it? |
||
|
||
def test_constructor(self): | ||
mock_get_node = mock.Mock() | ||
patch = mock.patch( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be done before L42, otherwise the returned tracer will be de default one. I pushed a fix as a part of a747b61.