Skip to content

Commit 1e14b94

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 a462f55 commit 1e14b94

File tree

15 files changed

+2139
-1
lines changed

15 files changed

+2139
-1
lines changed

Diff for: CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased](https://github.com/open-telemetry/opentelemetry-python/compare/v1.5.0-0.24b0...HEAD)
88

9+
- Add metrics API
10+
([#1887](https://github.com/open-telemetry/opentelemetry-python/pull/1887))
911
- `opentelemetry-semantic-conventions` Update to semantic conventions v1.6.1
1012
([#2077](https://github.com/open-telemetry/opentelemetry-python/pull/2077))
1113
- Do not count invalid attributes for dropped

Diff for: 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

Diff for: 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:

Diff for: 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:

Diff for: 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

Diff for: opentelemetry-api/src/opentelemetry/environment_variables/__init__.py

+11
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,14 @@
4141
"""
4242
.. envvar:: OTEL_PYTHON_TRACER_PROVIDER
4343
"""
44+
45+
OTEL_PYTHON_METER_PROVIDER = "OTEL_PYTHON_METER_PROVIDER"
46+
"""
47+
.. envvar:: OTEL_PYTHON_METER_PROVIDER
48+
"""
49+
50+
OTEL_METRICS_EXPORTER = "OTEL_METRICS_EXPORTER"
51+
"""
52+
.. envvar:: OTEL_METRICS_EXPORTER
53+
54+
"""

0 commit comments

Comments
 (0)