Skip to content

Commit

Permalink
Adds user agent string to grpc headers
Browse files Browse the repository at this point in the history
  • Loading branch information
pridhi-arora committed Nov 1, 2022
1 parent 35ba257 commit 1907312
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#2976](https://github.com/open-telemetry/opentelemetry-python/pull/2976))
- [exporter/opentelemetry-exporter-otlp-proto-http] Add OTLPMetricExporter
([#2891](https://github.com/open-telemetry/opentelemetry-python/pull/2891))
- `exporter-otlp-proto-grpc`: add user agent string

## [1.13.0-0.34b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.13.0) - 2022-09-26

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,6 @@
API
---
"""
from .version import __version__

_OTLP_GRPC_HEADERS = (('User-Agent', 'OTel OTLP Exporter Python/' + __version__))
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
from opentelemetry.sdk.resources import Resource as SDKResource
from opentelemetry.util.re import parse_headers
from opentelemetry.sdk.metrics.export import MetricsData
from opentelemetry.exporter.otlp.proto.grpc import (
_OTLP_GRPC_HEADERS,
)

logger = getLogger(__name__)
SDKDataT = TypeVar("SDKDataT")
Expand Down Expand Up @@ -239,6 +242,7 @@ def __init__(
elif isinstance(self._headers, dict):
self._headers = tuple(self._headers.items())

self._headers = self._headers + _OTLP_GRPC_HEADERS
self._timeout = timeout or int(
environ.get(OTEL_EXPORTER_OTLP_TIMEOUT, 10)
)
Expand Down

0 comments on commit 1907312

Please sign in to comment.