Skip to content

Commit

Permalink
Merge branch 'main' into issue_2656
Browse files Browse the repository at this point in the history
  • Loading branch information
srikanthccv authored May 13, 2022
2 parents eff3792 + 91211b3 commit 362fa9a
Show file tree
Hide file tree
Showing 61 changed files with 3,714 additions and 1,911 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased](https://github.com/open-telemetry/opentelemetry-python/compare/v1.11.1-0.30b1...HEAD)

- Update to semantic conventions v1.11.0
([#2669](https://github.com/open-telemetry/opentelemetry-python/pull/2669))
- Update opentelemetry-proto to v0.17.0
([#2668](https://github.com/open-telemetry/opentelemetry-python/pull/2668))
- Add CallbackOptions to observable instrument callback params
([#2664](https://github.com/open-telemetry/opentelemetry-python/pull/2664))
- Add timeouts to metric SDK
([#2653](https://github.com/open-telemetry/opentelemetry-python/pull/2653))
- Add variadic arguments to metric exporter/reader interfaces
([#2654](https://github.com/open-telemetry/opentelemetry-python/pull/2654))
- Added a `opentelemetry.sdk.resources.ProcessResourceDetector` that adds the
'process.runtime.{name,version,description}' resource attributes when used
with the `opentelemetry.sdk.resources.get_aggregated_resources` API
([#2660](https://github.com/open-telemetry/opentelemetry-python/pull/2660))
- Move Metrics API behind internal package
([#2651](https://github.com/open-telemetry/opentelemetry-python/pull/2651))

Expand Down
8 changes: 8 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,14 @@
# https://github.com/sphinx-doc/sphinx/pull/3744
nitpick_ignore = [
("py:class", "ValueT"),
(
"py:class",
"opentelemetry.sdk._metrics._internal.instrument._Synchronous",
),
(
"py:class",
"opentelemetry.sdk._metrics._internal.instrument._Asynchronous",
),
# Even if wrapt is added to intersphinx_mapping, sphinx keeps failing
# with "class reference target not found: ObjectProxy".
("py:class", "ObjectProxy"),
Expand Down
16 changes: 10 additions & 6 deletions docs/examples/metrics/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
get_meter_provider,
set_meter_provider,
)
from opentelemetry._metrics._internal.instrument import CallbackOptions
from opentelemetry.exporter.otlp.proto.grpc._metric_exporter import (
OTLPMetricExporter,
)
Expand All @@ -17,15 +18,17 @@
set_meter_provider(provider)


def observable_counter_func() -> Iterable[Observation]:
def observable_counter_func(options: CallbackOptions) -> Iterable[Observation]:
yield Observation(1, {})


def observable_up_down_counter_func() -> Iterable[Observation]:
def observable_up_down_counter_func(
options: CallbackOptions,
) -> Iterable[Observation]:
yield Observation(-10, {})


def observable_gauge_func() -> Iterable[Observation]:
def observable_gauge_func(options: CallbackOptions) -> Iterable[Observation]:
yield Observation(9, {})


Expand All @@ -37,7 +40,8 @@ def observable_gauge_func() -> Iterable[Observation]:

# Async Counter
observable_counter = meter.create_observable_counter(
"observable_counter", observable_counter_func
"observable_counter",
[observable_counter_func],
)

# UpDownCounter
Expand All @@ -47,12 +51,12 @@ def observable_gauge_func() -> Iterable[Observation]:

# Async UpDownCounter
observable_updown_counter = meter.create_observable_up_down_counter(
"observable_updown_counter", observable_up_down_counter_func
"observable_updown_counter", [observable_up_down_counter_func]
)

# Histogram
histogram = meter.create_histogram("histogram")
histogram.record(99.9)

# Async Gauge
gauge = meter.create_observable_gauge("gauge", observable_gauge_func)
gauge = meter.create_observable_gauge("gauge", [observable_gauge_func])
15 changes: 9 additions & 6 deletions docs/getting_started/metrics_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from typing import Iterable

from opentelemetry._metrics import (
CallbackOptions,
Observation,
get_meter_provider,
set_meter_provider,
Expand All @@ -34,15 +35,17 @@
set_meter_provider(provider)


def observable_counter_func() -> Iterable[Observation]:
def observable_counter_func(options: CallbackOptions) -> Iterable[Observation]:
yield Observation(1, {})


def observable_up_down_counter_func() -> Iterable[Observation]:
def observable_up_down_counter_func(
options: CallbackOptions,
) -> Iterable[Observation]:
yield Observation(-10, {})


def observable_gauge_func() -> Iterable[Observation]:
def observable_gauge_func(options: CallbackOptions) -> Iterable[Observation]:
yield Observation(9, {})


Expand All @@ -54,7 +57,7 @@ def observable_gauge_func() -> Iterable[Observation]:

# Async Counter
observable_counter = meter.create_observable_counter(
"observable_counter", observable_counter_func
"observable_counter", [observable_counter_func]
)

# UpDownCounter
Expand All @@ -64,12 +67,12 @@ def observable_gauge_func() -> Iterable[Observation]:

# Async UpDownCounter
observable_updown_counter = meter.create_observable_up_down_counter(
"observable_updown_counter", observable_up_down_counter_func
"observable_updown_counter", [observable_up_down_counter_func]
)

# Histogram
histogram = meter.create_histogram("histogram")
histogram.record(99.9)

# Async Gauge
gauge = meter.create_observable_gauge("gauge", observable_gauge_func)
gauge = meter.create_observable_gauge("gauge", [observable_gauge_func])
7 changes: 0 additions & 7 deletions docs/sdk/metrics.aggregation.rst

This file was deleted.

7 changes: 0 additions & 7 deletions docs/sdk/metrics.metric_reader.rst

This file was deleted.

7 changes: 0 additions & 7 deletions docs/sdk/metrics.point.rst

This file was deleted.

5 changes: 1 addition & 4 deletions docs/sdk/metrics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@ Submodules

.. toctree::

metrics.view
metrics.aggregation
metrics.metric_reader
metrics.point
metrics.export
metrics.view

.. automodule:: opentelemetry.sdk._metrics
:members:
Expand Down
2 changes: 1 addition & 1 deletion docs/sdk/metrics.view.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
opentelemetry.sdk._metrics.view
==========================================
===============================

.. automodule:: opentelemetry.sdk._metrics.view
:members:
Expand Down
Loading

0 comments on commit 362fa9a

Please sign in to comment.