Skip to content

Commit 6592f1d

Browse files
ocelotlaabmass
andcommitted
Adds metrics API (#1887)
* Adds metric prototype Fixes #1835 * Fix docs * Add API metrics doc * Add missing docs * Add files * Adding docs * Refactor to _initialize * Refactor initialize * Add more documentation * Add exporter test * Add process * Fix tests * Try to add aggregator_class argument Tests are failing here * Fix instrument parent classes * Test default aggregator * WIP * Add prototype test * Tests passing again * Use right counters * All tests passing * Rearrange instrument storage * Fix tests * Add HTTP server test * WIP * WIP * Add prototype * WIP * Fail the test * WIP * WIP * WIP * WIP * Add views * Discard instruments via views * Fix tests * WIP * WIP * Fix lint * WIP * Fix test * Fix lint * Fix method * Fix lint * Mypy workaround * Skip if 3.6 * Fix lint * Add reason * Fix 3.6 * Fix run * Fix lint * Remove SDK metrics * Remove SDK docs * Remove metrics * Remove assertnotraises mixin * Revert sdk docs conf * Remove SDK env var changes * Fix unit checking * Define positional-only arguments * Add Metrics plans * Add API tests * WIP * WIP test * WIP * WIP * WIP * Set provider test passing * Use a fixture * Add test for get_provider * Rename tests * WIP * WIP * WIP * WIP * Remove non specific requirement * Add meter requirements * Put all meter provider tests in one file * Add meter tests * Make attributes be passed as a dictionary * Make some interfaces private * Log an error instead * Remove ASCII flag * Add CHANGELOG entry * Add instrument tests * All tests passing * Add test * Add name tests * Add unit tests * Add description tests * Add counter tests * Add more tests * Add Histogram tests * Add observable gauge tests * Add updowncounter tests * Add observableupdowncounter tests * Fix lint * Fix docs * Fix lint * Ignore mypy * Remove useless pylint skip * Remove useless pylint skip * Remove useless pylint skip * Remove useless pylint skip * Remove useless pylint skip * Add locks to meter and meterprovider * Add lock to instruments * Fix fixmes * Fix lint * Add documentation placeholder * Remove blank line as requested. * Do not override Rlock * Remove unecessary super calls * Add missing super calls * Remove plan files * Add missing parameters * Rename observe to callback * Fix lint * Rename to secure_instrument_name * Remove locks * Fix lint * Remove args and kwargs * Remove implementation that gives meters access to meter provider * Allow creating async instruments with either a callback function or generator * add additional test with callback form of observable counter * add a test/example that reads measurements from proc stat * implement cpu time integration test with generator too Co-authored-by: Aaron Abbott <[email protected]>
1 parent 05e9fe1 commit 6592f1d

File tree

15 files changed

+2139
-1
lines changed

15 files changed

+2139
-1
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
([#2207](https://github.com/open-telemetry/opentelemetry-python/pull/2207))
1111
- remove `X-B3-ParentSpanId` for B3 propagator as per OpenTelemetry specification
1212
([#2237](https://github.com/open-telemetry/opentelemetry-python/pull/2237))
13+
- Add metrics API
14+
([#1887](https://github.com/open-telemetry/opentelemetry-python/pull/1887))
1315

1416
## [1.6.2-0.25b2](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.6.2-0.25b2) - 2021-10-19
1517

docs/api/api.rst

+1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ OpenTelemetry Python API
99
baggage
1010
context
1111
trace
12+
metrics
1213
environment_variables

docs/api/metrics.instrument.rst

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
opentelemetry.metrics.instrument
2+
================================
3+
4+
.. automodule:: opentelemetry.metrics.instrument
5+
:members:
6+
:private-members:
7+
:undoc-members:
8+
:show-inheritance:

docs/api/metrics.measurement.rst

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
opentelemetry.metrics.measurement
2+
=================================
3+
4+
.. automodule:: opentelemetry.metrics.measurement
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:

docs/api/metrics.rst

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
opentelemetry.metrics package
2+
=============================
3+
4+
Submodules
5+
----------
6+
7+
.. toctree::
8+
9+
metrics.instrument
10+
metrics.measurement
11+
12+
Module contents
13+
---------------
14+
15+
.. automodule:: opentelemetry.metrics

opentelemetry-api/src/opentelemetry/environment_variables.py

+11
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,14 @@
3636
"""
3737
.. envvar:: OTEL_PYTHON_TRACER_PROVIDER
3838
"""
39+
40+
OTEL_PYTHON_METER_PROVIDER = "OTEL_PYTHON_METER_PROVIDER"
41+
"""
42+
.. envvar:: OTEL_PYTHON_METER_PROVIDER
43+
"""
44+
45+
OTEL_METRICS_EXPORTER = "OTEL_METRICS_EXPORTER"
46+
"""
47+
.. envvar:: OTEL_METRICS_EXPORTER
48+
49+
"""

0 commit comments

Comments
 (0)