diff --git a/.codespellrc b/.codespellrc index ab0fb6bb929..f5236d7c1bc 100644 --- a/.codespellrc +++ b/.codespellrc @@ -1,4 +1,4 @@ [codespell] # skipping auto generated folders -skip = ./.tox,./.mypy_cache,./docs/_build,./target,*/LICENSE,./venv +skip = ./.tox,./.mypy_cache,./docs/_build,./target,*/LICENSE,./venv,.git ignore-words-list = ans,ue,ot,hist,ro diff --git a/.flake8 b/.flake8 index cd5fe860b53..292bb01461a 100644 --- a/.flake8 +++ b/.flake8 @@ -1,9 +1,17 @@ [flake8] ignore = - E501 # line too long, defer to black - W503 # allow line breaks before binary ops - W504 # allow line breaks after binary ops - E203 # allow whitespace before ':' (https://github.com/psf/black#slices) + # line too long, defer to black + E501 + + # allow line breaks before binary ops + W503 + + # allow line breaks after binary ops + W504 + + # allow whitespace before ':' (https://github.com/psf/black#slices) + E203 + exclude = .bzr .git diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c4529615261..cda3a2c57d2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -87,7 +87,7 @@ jobs: strategy: fail-fast: false matrix: - tox-environment: [ "docker-tests", "lint", "spellcheck", "docs", "mypy", "mypyinstalled", "tracecontext" ] + tox-environment: [ "docker-tests-proto3", "docker-tests-proto4", "lint", "spellcheck", "docs", "mypy", "mypyinstalled", "tracecontext" ] name: ${{ matrix.tox-environment }} runs-on: ubuntu-20.04 steps: diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bc55e43932..17c23e4fa62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,10 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +- Regenerate opentelemetry-proto to be compatible with protobuf 3 and 4 + ([#3070](https://github.com/open-telemetry/opentelemetry-python/pull/3070)) +- Rename parse_headers to parse_env_headers and improve error message + ([#2376](https://github.com/open-telemetry/opentelemetry-python/pull/2376)) +- Add url decode values from OTEL_RESOURCE_ATTRIBUTES + ([#3046](https://github.com/open-telemetry/opentelemetry-python/pull/3046)) - Fixed circular dependency issue with custom samplers ([#3026](https://github.com/open-telemetry/opentelemetry-python/pull/3026)) - Add missing entry points for OTLP/HTTP exporter ([#3027](https://github.com/open-telemetry/opentelemetry-python/pull/3027)) +- Update logging to include logging api as per specification + ([#3038](https://github.com/open-telemetry/opentelemetry-python/pull/3038)) - Fix: Avoid generator in metrics _ViewInstrumentMatch.collect() ([#3035](https://github.com/open-telemetry/opentelemetry-python/pull/3035) - [exporter-otlp-proto-grpc] add user agent string diff --git a/dev-requirements.txt b/dev-requirements.txt index e3fced6b830..cb17b500407 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -10,9 +10,12 @@ sphinx-autodoc-typehints~=1.12.0 pytest==7.1.3 pytest-cov>=2.8 readme-renderer~=24.0 -grpcio-tools~=1.41.0 +# This version of grpcio-tools ships with protoc 3.19.4 which appears to be compatible with +# both protobuf 3.19.x and 4.x (see https://github.com/protocolbuffers/protobuf/issues/11123). +# Bump this version with caution to preserve compatibility with protobuf 3. +# https://github.com/open-telemetry/opentelemetry-python/blob/main/opentelemetry-proto/pyproject.toml#L28 +grpcio-tools==1.48.1 mypy-protobuf~=3.0.0 -protobuf~=3.18.1 # temporary fix. we should update the jinja, flask deps # See https://github.com/pallets/markupsafe/issues/282 # breaking change introduced in markupsafe causes jinja, flask to break diff --git a/docs-requirements.txt b/docs-requirements.txt index c70cefc8aae..c167ab785d1 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -23,3 +23,7 @@ wrapt>=1.0.0,<2.0.0 # See https://github.com/pallets/markupsafe/issues/282 # breaking change introduced in markupsafe causes jinja, flask to break markupsafe==2.0.1 + +# Jaeger generated protobufs do not currently support protobuf 4.x. This can be removed once +# they're regenerated. +protobuf~=3.19 diff --git a/docs/api/_logs.rst b/docs/api/_logs.rst new file mode 100644 index 00000000000..85ae72dc0d4 --- /dev/null +++ b/docs/api/_logs.rst @@ -0,0 +1,14 @@ +opentelemetry._logs package +============================= + +Submodules +---------- + +.. toctree:: + + _logs.severity + +Module contents +--------------- + +.. automodule:: opentelemetry._logs diff --git a/docs/api/_logs.severity.rst b/docs/api/_logs.severity.rst new file mode 100644 index 00000000000..4e31e70cf88 --- /dev/null +++ b/docs/api/_logs.severity.rst @@ -0,0 +1,4 @@ +opentelemetry._logs.severity +============================ + +.. automodule:: opentelemetry._logs.severity \ No newline at end of file diff --git a/docs/api/index.rst b/docs/api/index.rst index 22d77fc5a08..c1dffd6e75d 100644 --- a/docs/api/index.rst +++ b/docs/api/index.rst @@ -6,6 +6,7 @@ OpenTelemetry Python API .. toctree:: :maxdepth: 1 + _logs baggage context propagate diff --git a/docs/sdk/_logs.rst b/docs/sdk/_logs.rst new file mode 100644 index 00000000000..185e7006e40 --- /dev/null +++ b/docs/sdk/_logs.rst @@ -0,0 +1,7 @@ +opentelemetry.sdk._logs package +=============================== + +.. automodule:: opentelemetry.sdk._logs + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/sdk/index.rst b/docs/sdk/index.rst index 47d49a55503..d5d3688443f 100644 --- a/docs/sdk/index.rst +++ b/docs/sdk/index.rst @@ -6,9 +6,9 @@ OpenTelemetry Python SDK .. toctree:: :maxdepth: 1 + _logs resources trace metrics - logs error_handler environment_variables diff --git a/docs/sdk/logs.export.rst b/docs/sdk/logs.export.rst deleted file mode 100644 index 19a40237424..00000000000 --- a/docs/sdk/logs.export.rst +++ /dev/null @@ -1,7 +0,0 @@ -opentelemetry.sdk._logs.export -============================== - -.. automodule:: opentelemetry.sdk._logs.export - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/sdk/logs.rst b/docs/sdk/logs.rst deleted file mode 100644 index 569ad30b797..00000000000 --- a/docs/sdk/logs.rst +++ /dev/null @@ -1,22 +0,0 @@ -opentelemetry.sdk._logs package -=============================== - -.. warning:: - OpenTelemetry Python logs are in an experimental state. The APIs within - :mod:`opentelemetry.sdk._logs` are subject to change in minor/patch releases and make no - backward compatibility guarantees at this time. - - Once logs become stable, this package will be be renamed to ``opentelemetry.sdk.logs``. - -Submodules ----------- - -.. toctree:: - - logs.export - logs.severity - -.. automodule:: opentelemetry.sdk._logs - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/sdk/logs.severity.rst b/docs/sdk/logs.severity.rst deleted file mode 100644 index 1197e8b44e8..00000000000 --- a/docs/sdk/logs.severity.rst +++ /dev/null @@ -1,7 +0,0 @@ -opentelemetry.sdk._logs.severity -================================ - -.. automodule:: opentelemetry.sdk._logs.severity - :members: - :undoc-members: - :show-inheritance: \ No newline at end of file diff --git a/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/exporter.py b/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/exporter.py index eaa96d796df..30f275bbd76 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/exporter.py +++ b/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/exporter.py @@ -52,11 +52,11 @@ OTEL_EXPORTER_OTLP_TIMEOUT, ) 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, ) +from opentelemetry.util.re import parse_env_headers logger = getLogger(__name__) SDKDataT = TypeVar("SDKDataT") @@ -250,7 +250,7 @@ def __init__( self._headers = headers or environ.get(OTEL_EXPORTER_OTLP_HEADERS) if isinstance(self._headers, str): - temp_headers = parse_headers(self._headers) + temp_headers = parse_env_headers(self._headers) self._headers = tuple(temp_headers.items()) elif isinstance(self._headers, dict): self._headers = tuple(self._headers.items()) diff --git a/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/logs/test_otlp_logs_exporter.py b/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/logs/test_otlp_logs_exporter.py index 17d0d540e46..80814569d11 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/logs/test_otlp_logs_exporter.py +++ b/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/logs/test_otlp_logs_exporter.py @@ -21,6 +21,7 @@ from google.rpc.error_details_pb2 import RetryInfo from grpc import StatusCode, server +from opentelemetry._logs import SeverityNumber from opentelemetry.exporter.otlp.proto.grpc._log_exporter import ( OTLPLogExporter, ) @@ -46,9 +47,6 @@ ) from opentelemetry.sdk._logs import LogData, LogRecord from opentelemetry.sdk._logs.export import LogExportResult -from opentelemetry.sdk._logs.severity import ( - SeverityNumber as SDKSeverityNumber, -) from opentelemetry.sdk.resources import Resource as SDKResource from opentelemetry.sdk.util.instrumentation import InstrumentationScope from opentelemetry.trace import TraceFlags @@ -118,7 +116,7 @@ def setUp(self): span_id=5213367945872657620, trace_flags=TraceFlags(0x01), severity_text="WARNING", - severity_number=SDKSeverityNumber.WARN, + severity_number=SeverityNumber.WARN, body="Zhengzhou, We have a heaviest rains in 1000 years", resource=SDKResource({"key": "value"}), attributes={"a": 1, "b": "c"}, @@ -134,7 +132,7 @@ def setUp(self): span_id=5213367945872657623, trace_flags=TraceFlags(0x01), severity_text="INFO", - severity_number=SDKSeverityNumber.INFO2, + severity_number=SeverityNumber.INFO2, body="Sydney, Opera House is closed", resource=SDKResource({"key": "value"}), attributes={"custom_attr": [1, 2, 3]}, @@ -150,7 +148,7 @@ def setUp(self): span_id=5213367945872657628, trace_flags=TraceFlags(0x01), severity_text="ERROR", - severity_number=SDKSeverityNumber.WARN, + severity_number=SeverityNumber.WARN, body="Mumbai, Boil water before drinking", resource=SDKResource({"service": "myapp"}), ), diff --git a/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/_log_exporter/__init__.py b/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/_log_exporter/__init__.py index 580e084f4f9..49daa29e8ab 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/_log_exporter/__init__.py +++ b/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/_log_exporter/__init__.py @@ -30,10 +30,10 @@ OTEL_EXPORTER_OTLP_HEADERS, OTEL_EXPORTER_OTLP_TIMEOUT, ) +from opentelemetry.sdk._logs import LogData from opentelemetry.sdk._logs.export import ( LogExporter, LogExportResult, - LogData, ) from opentelemetry.exporter.otlp.proto.http import ( _OTLP_HTTP_HEADERS, @@ -42,7 +42,7 @@ from opentelemetry.exporter.otlp.proto.http._log_exporter.encoder import ( _ProtobufEncoder, ) -from opentelemetry.util.re import parse_headers +from opentelemetry.util.re import parse_env_headers _logger = logging.getLogger(__name__) @@ -86,7 +86,7 @@ def __init__( OTEL_EXPORTER_OTLP_CERTIFICATE, True ) headers_string = environ.get(OTEL_EXPORTER_OTLP_HEADERS, "") - self._headers = headers or parse_headers(headers_string) + self._headers = headers or parse_env_headers(headers_string) self._timeout = timeout or int( environ.get(OTEL_EXPORTER_OTLP_TIMEOUT, DEFAULT_TIMEOUT) ) diff --git a/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/_log_exporter/encoder/__init__.py b/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/_log_exporter/encoder/__init__.py index c8f2dd84564..866f8878bba 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/_log_exporter/encoder/__init__.py +++ b/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/_log_exporter/encoder/__init__.py @@ -32,7 +32,7 @@ ) -from opentelemetry.sdk._logs.export import LogData +from opentelemetry.sdk._logs import LogData class _ProtobufEncoder: diff --git a/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/metric_exporter/__init__.py b/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/metric_exporter/__init__.py index c83ca00e06c..c04f5bbbcee 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/metric_exporter/__init__.py +++ b/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/metric_exporter/__init__.py @@ -64,7 +64,7 @@ Sum, ) from opentelemetry.sdk.resources import Resource as SDKResource -from opentelemetry.util.re import parse_headers +from opentelemetry.util.re import parse_env_headers import backoff import requests @@ -119,7 +119,7 @@ def __init__( OTEL_EXPORTER_OTLP_METRICS_HEADERS, environ.get(OTEL_EXPORTER_OTLP_HEADERS, ""), ) - self._headers = headers or parse_headers(headers_string) + self._headers = headers or parse_env_headers(headers_string) self._timeout = timeout or int( environ.get( OTEL_EXPORTER_OTLP_METRICS_TIMEOUT, diff --git a/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/trace_exporter/__init__.py b/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/trace_exporter/__init__.py index 9dc3b65014d..623d7dbf0ae 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/trace_exporter/__init__.py +++ b/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/trace_exporter/__init__.py @@ -43,7 +43,7 @@ from opentelemetry.exporter.otlp.proto.http.trace_exporter.encoder import ( _ProtobufEncoder, ) -from opentelemetry.util.re import parse_headers +from opentelemetry.util.re import parse_env_headers _logger = logging.getLogger(__name__) @@ -94,7 +94,7 @@ def __init__( OTEL_EXPORTER_OTLP_TRACES_HEADERS, environ.get(OTEL_EXPORTER_OTLP_HEADERS, ""), ) - self._headers = headers or parse_headers(headers_string) + self._headers = headers or parse_env_headers(headers_string) self._timeout = timeout or int( environ.get( OTEL_EXPORTER_OTLP_TRACES_TIMEOUT, diff --git a/exporter/opentelemetry-exporter-otlp-proto-http/tests/metrics/test_otlp_metrics_exporter.py b/exporter/opentelemetry-exporter-otlp-proto-http/tests/metrics/test_otlp_metrics_exporter.py index 74ba53b3c59..99f9ea12d31 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-http/tests/metrics/test_otlp_metrics_exporter.py +++ b/exporter/opentelemetry-exporter-otlp-proto-http/tests/metrics/test_otlp_metrics_exporter.py @@ -220,7 +220,11 @@ def test_headers_parse_from_env(self): self.assertEqual( cm.records[0].message, - "Header doesn't match the format: missingValue.", + ( + "Header format invalid! Header values in environment " + "variables must be URL encoded per the OpenTelemetry " + "Protocol Exporter specification: missingValue" + ), ) @patch.object(requests.Session, "post") diff --git a/exporter/opentelemetry-exporter-otlp-proto-http/tests/test_proto_log_exporter.py b/exporter/opentelemetry-exporter-otlp-proto-http/tests/test_proto_log_exporter.py index d94ddfb8f7c..7dcb82030d4 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-http/tests/test_proto_log_exporter.py +++ b/exporter/opentelemetry-exporter-otlp-proto-http/tests/test_proto_log_exporter.py @@ -21,6 +21,7 @@ import requests import responses +from opentelemetry._logs import SeverityNumber from opentelemetry.exporter.otlp.proto.http import Compression from opentelemetry.exporter.otlp.proto.http._log_exporter import ( DEFAULT_COMPRESSION, @@ -54,7 +55,6 @@ ) from opentelemetry.sdk._logs import LogData from opentelemetry.sdk._logs import LogRecord as SDKLogRecord -from opentelemetry.sdk._logs.severity import SeverityNumber from opentelemetry.sdk.environment_variables import ( OTEL_EXPORTER_OTLP_CERTIFICATE, OTEL_EXPORTER_OTLP_COMPRESSION, diff --git a/exporter/opentelemetry-exporter-otlp-proto-http/tests/test_proto_span_exporter.py b/exporter/opentelemetry-exporter-otlp-proto-http/tests/test_proto_span_exporter.py index c7ff9a15dde..73d08e08c8c 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-http/tests/test_proto_span_exporter.py +++ b/exporter/opentelemetry-exporter-otlp-proto-http/tests/test_proto_span_exporter.py @@ -189,7 +189,11 @@ def test_headers_parse_from_env(self): self.assertEqual( cm.records[0].message, - "Header doesn't match the format: missingValue.", + ( + "Header format invalid! Header values in environment " + "variables must be URL encoded per the OpenTelemetry " + "Protocol Exporter specification: missingValue" + ), ) # pylint: disable=no-self-use diff --git a/opentelemetry-api/src/opentelemetry/_logs/__init__.py b/opentelemetry-api/src/opentelemetry/_logs/__init__.py new file mode 100644 index 00000000000..d9677a5f220 --- /dev/null +++ b/opentelemetry-api/src/opentelemetry/_logs/__init__.py @@ -0,0 +1,58 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" +The OpenTelemetry logging API describes the classes used to generate logs and events. + +The :class:`.LoggerProvider` provides users access to the :class:`.Logger` which in +turn is used to create :class:`.Event` and :class:`.Log` objects. + +This module provides abstract (i.e. unimplemented) classes required for +logging, and a concrete no-op implementation :class:`.NoOpLogger` that allows applications +to use the API package alone without a supporting implementation. + +To get a logger, you need to provide the package name from which you are +calling the logging APIs to OpenTelemetry by calling `LoggerProvider.get_logger` +with the calling module name and the version of your package. + +The following code shows how to obtain a logger using the global :class:`.LoggerProvider`:: + + from opentelemetry._logs import get_logger + + logger = get_logger("example-logger") + +.. versionadded:: 1.15.0 +""" + +# pylint: disable=unused-import + +from opentelemetry._logs._internal import ( # noqa: F401 + Logger, + LoggerProvider, + LogRecord, + NoOpLogger, + NoOpLoggerProvider, + get_logger, + get_logger_provider, + set_logger_provider, +) +from opentelemetry._logs.severity import ( # noqa: F401 + SeverityNumber, + std_to_otel, +) + +__all__ = [] +for key, value in globals().copy().items(): # type: ignore + if not key.startswith("_"): + value.__module__ = __name__ # type: ignore + __all__.append(key) diff --git a/opentelemetry-api/src/opentelemetry/_logs/_internal/__init__.py b/opentelemetry-api/src/opentelemetry/_logs/_internal/__init__.py new file mode 100644 index 00000000000..0b844e24d9a --- /dev/null +++ b/opentelemetry-api/src/opentelemetry/_logs/_internal/__init__.py @@ -0,0 +1,227 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" +The OpenTelemetry logging API describes the classes used to generate logs and events. + +The :class:`.LoggerProvider` provides users access to the :class:`.Logger` which in +turn is used to create :class:`.Event` and :class:`.Log` objects. + +This module provides abstract (i.e. unimplemented) classes required for +logging, and a concrete no-op implementation :class:`.NoOpLogger` that allows applications +to use the API package alone without a supporting implementation. + +To get a logger, you need to provide the package name from which you are +calling the logging APIs to OpenTelemetry by calling `LoggerProvider.get_logger` +with the calling module name and the version of your package. + +The following code shows how to obtain a logger using the global :class:`.LoggerProvider`:: + + from opentelemetry._logs import get_logger + + logger = get_logger("example-logger") + +.. versionadded:: 1.15.0 +""" + +from abc import ABC, abstractmethod +from logging import getLogger +from os import environ +from typing import Any, Optional, cast + +from opentelemetry._logs.severity import SeverityNumber +from opentelemetry.environment_variables import _OTEL_PYTHON_LOGGER_PROVIDER +from opentelemetry.trace.span import TraceFlags +from opentelemetry.util._once import Once +from opentelemetry.util._providers import _load_provider +from opentelemetry.util.types import Attributes + +_logger = getLogger(__name__) + + +class LogRecord(ABC): + """A LogRecord instance represents an event being logged. + + LogRecord instances are created and emitted via `Logger` + every time something is logged. They contain all the information + pertinent to the event being logged. + """ + + def __init__( + self, + timestamp: Optional[int] = None, + observed_timestamp: Optional[int] = None, + trace_id: Optional[int] = None, + span_id: Optional[int] = None, + trace_flags: Optional["TraceFlags"] = None, + severity_text: Optional[str] = None, + severity_number: Optional[SeverityNumber] = None, + body: Optional[Any] = None, + attributes: Optional["Attributes"] = None, + ): + self.timestamp = timestamp + self.observed_timestamp = observed_timestamp + self.trace_id = trace_id + self.span_id = span_id + self.trace_flags = trace_flags + self.severity_text = severity_text + self.severity_number = severity_number + self.body = body # type: ignore + self.attributes = attributes + + +class Logger(ABC): + """Handles emitting events and logs via `LogRecord`.""" + + def __init__( + self, + name: str, + version: Optional[str] = None, + schema_url: Optional[str] = None, + ) -> None: + super().__init__() + self._name = name + self._version = version + self._schema_url = schema_url + + @abstractmethod + def emit(self, record: "LogRecord") -> None: + """Emits a :class:`LogRecord` representing a log to the processing pipeline.""" + + +class NoOpLogger(Logger): + """The default Logger used when no Logger implementation is available. + + All operations are no-op. + """ + + def emit(self, record: "LogRecord") -> None: + pass + + +class LoggerProvider(ABC): + """ + LoggerProvider is the entry point of the API. It provides access to Logger instances. + """ + + @abstractmethod + def get_logger( + self, + name: str, + version: Optional[str] = None, + schema_url: Optional[str] = None, + ) -> Logger: + """Returns a `Logger` for use by the given instrumentation library. + + For any two calls it is undefined whether the same or different + `Logger` instances are returned, even for different library names. + + This function may return different `Logger` types (e.g. a no-op logger + vs. a functional logger). + + Args: + name: The name of the instrumenting module. + ``__name__`` may not be used as this can result in + different logger names if the loggers are in different files. + It is better to use a fixed string that can be imported where + needed and used consistently as the name of the logger. + + This should *not* be the name of the module that is + instrumented but the name of the module doing the instrumentation. + E.g., instead of ``"requests"``, use + ``"opentelemetry.instrumentation.requests"``. + + version: Optional. The version string of the + instrumenting library. Usually this should be the same as + ``pkg_resources.get_distribution(instrumenting_library_name).version``. + + schema_url: Optional. Specifies the Schema URL of the emitted telemetry. + """ + + +class NoOpLoggerProvider(LoggerProvider): + """The default LoggerProvider used when no LoggerProvider implementation is available.""" + + def get_logger( + self, + name: str, + version: Optional[str] = None, + schema_url: Optional[str] = None, + ) -> Logger: + """Returns a NoOpLogger.""" + super().get_logger(name, version=version, schema_url=schema_url) + return NoOpLogger(name, version=version, schema_url=schema_url) + + +# TODO: ProxyLoggerProvider + + +_LOGGER_PROVIDER_SET_ONCE = Once() +_LOGGER_PROVIDER = None + + +def get_logger_provider() -> LoggerProvider: + """Gets the current global :class:`~.LoggerProvider` object.""" + global _LOGGER_PROVIDER # pylint: disable=global-statement + if _LOGGER_PROVIDER is None: + if _OTEL_PYTHON_LOGGER_PROVIDER not in environ.keys(): + # TODO: return proxy + _LOGGER_PROVIDER = NoOpLoggerProvider() + return _LOGGER_PROVIDER + + logger_provider: LoggerProvider = _load_provider( # type: ignore + _OTEL_PYTHON_LOGGER_PROVIDER, "logger_provider" + ) + _set_logger_provider(logger_provider, log=False) + + # _LOGGER_PROVIDER will have been set by one thread + return cast("LoggerProvider", _LOGGER_PROVIDER) + + +def _set_logger_provider(logger_provider: LoggerProvider, log: bool) -> None: + def set_lp() -> None: + global _LOGGER_PROVIDER # pylint: disable=global-statement + _LOGGER_PROVIDER = logger_provider # type: ignore + + did_set = _LOGGER_PROVIDER_SET_ONCE.do_once(set_lp) + + if log and not did_set: + _logger.warning("Overriding of current LoggerProvider is not allowed") + + +def set_logger_provider(meter_provider: LoggerProvider) -> None: + """Sets the current global :class:`~.LoggerProvider` object. + + This can only be done once, a warning will be logged if any further attempt + is made. + """ + _set_logger_provider(meter_provider, log=True) + + +def get_logger( + instrumenting_module_name: str, + instrumenting_library_version: str = "", + logger_provider: Optional[LoggerProvider] = None, +) -> "Logger": + """Returns a `Logger` for use within a python process. + + This function is a convenience wrapper for + opentelemetry.sdk._logs.LoggerProvider.get_logger. + + If logger_provider param is omitted the current configured one is used. + """ + if logger_provider is None: + logger_provider = get_logger_provider() + return logger_provider.get_logger( + instrumenting_module_name, instrumenting_library_version + ) diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/_logs/severity.py b/opentelemetry-api/src/opentelemetry/_logs/severity/__init__.py similarity index 91% rename from opentelemetry-sdk/src/opentelemetry/sdk/_logs/severity.py rename to opentelemetry-api/src/opentelemetry/_logs/severity/__init__.py index 25703759909..1daaa19f44c 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/_logs/severity.py +++ b/opentelemetry-api/src/opentelemetry/_logs/severity/__init__.py @@ -55,7 +55,7 @@ class SeverityNumber(enum.Enum): FATAL4 = 24 -_STD_TO_OTLP = { +_STD_TO_OTEL = { 10: SeverityNumber.DEBUG, 11: SeverityNumber.DEBUG2, 12: SeverityNumber.DEBUG3, @@ -103,13 +103,13 @@ class SeverityNumber(enum.Enum): } -def std_to_otlp(levelno: int) -> SeverityNumber: +def std_to_otel(levelno: int) -> SeverityNumber: """ Map python log levelno as defined in https://docs.python.org/3/library/logging.html#logging-levels - to OTLP log severity number. + to OTel log severity number as defined here: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/data-model.md#field-severitynumber """ if levelno < 10: return SeverityNumber.UNSPECIFIED if levelno > 53: return SeverityNumber.FATAL4 - return _STD_TO_OTLP[levelno] + return _STD_TO_OTEL[levelno] diff --git a/opentelemetry-api/src/opentelemetry/environment_variables.py b/opentelemetry-api/src/opentelemetry/environment_variables.py index 5c5a9b3c4aa..c54b13c6da0 100644 --- a/opentelemetry-api/src/opentelemetry/environment_variables.py +++ b/opentelemetry-api/src/opentelemetry/environment_variables.py @@ -53,3 +53,8 @@ """ .. envvar:: OTEL_PYTHON_METER_PROVIDER """ + +_OTEL_PYTHON_LOGGER_PROVIDER = "OTEL_PYTHON_LOGGER_PROVIDER" +""" +.. envvar:: OTEL_PYTHON_LOGGER_PROVIDER +""" diff --git a/opentelemetry-api/src/opentelemetry/util/re.py b/opentelemetry-api/src/opentelemetry/util/re.py index 3dcbfe08b7c..5f19521d04a 100644 --- a/opentelemetry-api/src/opentelemetry/util/re.py +++ b/opentelemetry-api/src/opentelemetry/util/re.py @@ -12,23 +12,29 @@ # See the License for the specific language governing permissions and # limitations under the License. -import logging +from logging import getLogger from re import compile, split from typing import Dict, List, Mapping from urllib.parse import unquote -_logger = logging.getLogger(__name__) +from deprecated import deprecated +_logger = getLogger(__name__) -# https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#specifying-headers-via-environment-variables +# The following regexes reference this spec: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#specifying-headers-via-environment-variables + +# Optional whitespace _OWS = r"[ \t]*" -# A key contains one or more US-ASCII character except CTLs or separators. +# A key contains printable US-ASCII characters except: SP and "(),/:;<=>?@[\]{} _KEY_FORMAT = ( r"[\x21\x23-\x27\x2a\x2b\x2d\x2e\x30-\x39\x41-\x5a\x5e-\x7a\x7c\x7e]+" ) -# A value contains a URL encoded UTF-8 string. +# A value contains a URL-encoded UTF-8 string. The encoded form can contain any +# printable US-ASCII characters (0x20-0x7f) other than SP, DEL, and ",;/ _VALUE_FORMAT = r"[\x21\x23-\x2b\x2d-\x3a\x3c-\x5b\x5d-\x7e]*" +# A key-value is key=value, with optional whitespace surrounding key and value _KEY_VALUE_FORMAT = rf"{_OWS}{_KEY_FORMAT}{_OWS}={_OWS}{_VALUE_FORMAT}{_OWS}" + _HEADER_PATTERN = compile(_KEY_VALUE_FORMAT) _DELIMITER_PATTERN = compile(r"[ \t]*,[ \t]*") @@ -36,10 +42,18 @@ # pylint: disable=invalid-name + + +@deprecated(version="1.15.0", reason="You should use parse_env_headers") # type: ignore def parse_headers(s: str) -> Mapping[str, str]: + return parse_env_headers(s) + + +def parse_env_headers(s: str) -> Mapping[str, str]: """ - Parse ``s`` (a ``str`` instance containing HTTP headers). Uses W3C Baggage - HTTP header format https://www.w3.org/TR/baggage/#baggage-http-header-format, except that + Parse ``s``, which is a ``str`` instance containing HTTP headers encoded + for use in ENV variables per the W3C Baggage HTTP header format at + https://www.w3.org/TR/baggage/#baggage-http-header-format, except that additional semi-colon delimited metadata is not supported. """ headers: Dict[str, str] = {} @@ -49,7 +63,11 @@ def parse_headers(s: str) -> Mapping[str, str]: continue match = _HEADER_PATTERN.fullmatch(header.strip()) if not match: - _logger.warning("Header doesn't match the format: %s.", header) + _logger.warning( + "Header format invalid! Header values in environment variables must be " + "URL encoded per the OpenTelemetry Protocol Exporter specification: %s", + header, + ) continue # value may contain any number of `=` name, value = match.string.split("=", 1) diff --git a/opentelemetry-api/tests/logs/test_logger_provider.py b/opentelemetry-api/tests/logs/test_logger_provider.py new file mode 100644 index 00000000000..5943924bd8e --- /dev/null +++ b/opentelemetry-api/tests/logs/test_logger_provider.py @@ -0,0 +1,62 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# type:ignore +import unittest +from unittest.mock import Mock, patch + +import opentelemetry._logs._internal as logs_internal +from opentelemetry._logs import get_logger_provider, set_logger_provider +from opentelemetry.environment_variables import _OTEL_PYTHON_LOGGER_PROVIDER +from opentelemetry.test.globals_test import reset_logging_globals + + +class TestGlobals(unittest.TestCase): + def setUp(self): + super().tearDown() + reset_logging_globals() + + def tearDown(self): + super().tearDown() + reset_logging_globals() + + def test_set_logger_provider(self): + lp_mock = Mock() + # pylint: disable=protected-access + assert logs_internal._LOGGER_PROVIDER is None + set_logger_provider(lp_mock) + assert logs_internal._LOGGER_PROVIDER is lp_mock + assert get_logger_provider() is lp_mock + + def test_get_logger_provider(self): + # pylint: disable=protected-access + assert logs_internal._LOGGER_PROVIDER is None + + assert isinstance( + get_logger_provider(), logs_internal.NoOpLoggerProvider + ) + + logs_internal._LOGGER_PROVIDER = None + + with patch.dict( + "os.environ", + {_OTEL_PYTHON_LOGGER_PROVIDER: "test_logger_provider"}, + ): + + with patch("opentelemetry._logs._internal._load_provider", Mock()): + with patch( + "opentelemetry._logs._internal.cast", + Mock(**{"return_value": "test_logger_provider"}), + ): + assert get_logger_provider() == "test_logger_provider" diff --git a/opentelemetry-api/tests/util/test_re.py b/opentelemetry-api/tests/util/test_re.py index e7834ac15ad..99d79ba9d24 100644 --- a/opentelemetry-api/tests/util/test_re.py +++ b/opentelemetry-api/tests/util/test_re.py @@ -16,11 +16,11 @@ import unittest -from opentelemetry.util.re import parse_headers +from opentelemetry.util.re import parse_env_headers class TestParseHeaders(unittest.TestCase): - def test_parse_headers(self): + def test_parse_env_headers(self): inp = [ # invalid header name ("=value", [], True), @@ -63,10 +63,12 @@ def test_parse_headers(self): s, expected, warn = case if warn: with self.assertLogs(level="WARNING") as cm: - self.assertEqual(parse_headers(s), dict(expected)) + self.assertEqual(parse_env_headers(s), dict(expected)) self.assertTrue( - "Header doesn't match the format:" + "Header format invalid! Header values in environment " + "variables must be URL encoded per the OpenTelemetry " + "Protocol Exporter specification:" in cm.records[0].message, ) else: - self.assertEqual(parse_headers(s), dict(expected)) + self.assertEqual(parse_env_headers(s), dict(expected)) diff --git a/opentelemetry-proto/pyproject.toml b/opentelemetry-proto/pyproject.toml index 3b7875dcd5b..b44b61b50e2 100644 --- a/opentelemetry-proto/pyproject.toml +++ b/opentelemetry-proto/pyproject.toml @@ -25,7 +25,7 @@ classifiers = [ "Programming Language :: Python :: 3.11", ] dependencies = [ - "protobuf~=3.13", + "protobuf>=3.19, < 5.0", ] [project.optional-dependencies] diff --git a/opentelemetry-proto/src/opentelemetry/proto/collector/logs/v1/logs_service_pb2.py b/opentelemetry-proto/src/opentelemetry/proto/collector/logs/v1/logs_service_pb2.py index d439d077b32..aef16718300 100644 --- a/opentelemetry-proto/src/opentelemetry/proto/collector/logs/v1/logs_service_pb2.py +++ b/opentelemetry-proto/src/opentelemetry/proto/collector/logs/v1/logs_service_pb2.py @@ -3,6 +3,7 @@ # source: opentelemetry/proto/collector/logs/v1/logs_service.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database @@ -14,80 +15,12 @@ from opentelemetry.proto.logs.v1 import logs_pb2 as opentelemetry_dot_proto_dot_logs_dot_v1_dot_logs__pb2 -DESCRIPTOR = _descriptor.FileDescriptor( - name='opentelemetry/proto/collector/logs/v1/logs_service.proto', - package='opentelemetry.proto.collector.logs.v1', - syntax='proto3', - serialized_options=b'\n(io.opentelemetry.proto.collector.logs.v1B\020LogsServiceProtoP\001Z0go.opentelemetry.io/proto/otlp/collector/logs/v1', - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n8opentelemetry/proto/collector/logs/v1/logs_service.proto\x12%opentelemetry.proto.collector.logs.v1\x1a&opentelemetry/proto/logs/v1/logs.proto\"\\\n\x18\x45xportLogsServiceRequest\x12@\n\rresource_logs\x18\x01 \x03(\x0b\x32).opentelemetry.proto.logs.v1.ResourceLogs\"\x1b\n\x19\x45xportLogsServiceResponse2\x9d\x01\n\x0bLogsService\x12\x8d\x01\n\x06\x45xport\x12?.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest\x1a@.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse\"\x00\x42p\n(io.opentelemetry.proto.collector.logs.v1B\x10LogsServiceProtoP\x01Z0go.opentelemetry.io/proto/otlp/collector/logs/v1b\x06proto3' - , - dependencies=[opentelemetry_dot_proto_dot_logs_dot_v1_dot_logs__pb2.DESCRIPTOR,]) +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n8opentelemetry/proto/collector/logs/v1/logs_service.proto\x12%opentelemetry.proto.collector.logs.v1\x1a&opentelemetry/proto/logs/v1/logs.proto\"\\\n\x18\x45xportLogsServiceRequest\x12@\n\rresource_logs\x18\x01 \x03(\x0b\x32).opentelemetry.proto.logs.v1.ResourceLogs\"\x1b\n\x19\x45xportLogsServiceResponse2\x9d\x01\n\x0bLogsService\x12\x8d\x01\n\x06\x45xport\x12?.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest\x1a@.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse\"\x00\x42p\n(io.opentelemetry.proto.collector.logs.v1B\x10LogsServiceProtoP\x01Z0go.opentelemetry.io/proto/otlp/collector/logs/v1b\x06proto3') - -_EXPORTLOGSSERVICEREQUEST = _descriptor.Descriptor( - name='ExportLogsServiceRequest', - full_name='opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='resource_logs', full_name='opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest.resource_logs', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=139, - serialized_end=231, -) - - -_EXPORTLOGSSERVICERESPONSE = _descriptor.Descriptor( - name='ExportLogsServiceResponse', - full_name='opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=233, - serialized_end=260, -) - -_EXPORTLOGSSERVICEREQUEST.fields_by_name['resource_logs'].message_type = opentelemetry_dot_proto_dot_logs_dot_v1_dot_logs__pb2._RESOURCELOGS -DESCRIPTOR.message_types_by_name['ExportLogsServiceRequest'] = _EXPORTLOGSSERVICEREQUEST -DESCRIPTOR.message_types_by_name['ExportLogsServiceResponse'] = _EXPORTLOGSSERVICERESPONSE -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - +_EXPORTLOGSSERVICEREQUEST = DESCRIPTOR.message_types_by_name['ExportLogsServiceRequest'] +_EXPORTLOGSSERVICERESPONSE = DESCRIPTOR.message_types_by_name['ExportLogsServiceResponse'] ExportLogsServiceRequest = _reflection.GeneratedProtocolMessageType('ExportLogsServiceRequest', (_message.Message,), { 'DESCRIPTOR' : _EXPORTLOGSSERVICEREQUEST, '__module__' : 'opentelemetry.proto.collector.logs.v1.logs_service_pb2' @@ -102,32 +35,15 @@ }) _sym_db.RegisterMessage(ExportLogsServiceResponse) - -DESCRIPTOR._options = None - -_LOGSSERVICE = _descriptor.ServiceDescriptor( - name='LogsService', - full_name='opentelemetry.proto.collector.logs.v1.LogsService', - file=DESCRIPTOR, - index=0, - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_start=263, - serialized_end=420, - methods=[ - _descriptor.MethodDescriptor( - name='Export', - full_name='opentelemetry.proto.collector.logs.v1.LogsService.Export', - index=0, - containing_service=None, - input_type=_EXPORTLOGSSERVICEREQUEST, - output_type=_EXPORTLOGSSERVICERESPONSE, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), -]) -_sym_db.RegisterServiceDescriptor(_LOGSSERVICE) - -DESCRIPTOR.services_by_name['LogsService'] = _LOGSSERVICE - +_LOGSSERVICE = DESCRIPTOR.services_by_name['LogsService'] +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n(io.opentelemetry.proto.collector.logs.v1B\020LogsServiceProtoP\001Z0go.opentelemetry.io/proto/otlp/collector/logs/v1' + _EXPORTLOGSSERVICEREQUEST._serialized_start=139 + _EXPORTLOGSSERVICEREQUEST._serialized_end=231 + _EXPORTLOGSSERVICERESPONSE._serialized_start=233 + _EXPORTLOGSSERVICERESPONSE._serialized_end=260 + _LOGSSERVICE._serialized_start=263 + _LOGSSERVICE._serialized_end=420 # @@protoc_insertion_point(module_scope) diff --git a/opentelemetry-proto/src/opentelemetry/proto/collector/metrics/v1/metrics_service_pb2.py b/opentelemetry-proto/src/opentelemetry/proto/collector/metrics/v1/metrics_service_pb2.py index 2fb3bf86dec..ca026163b19 100644 --- a/opentelemetry-proto/src/opentelemetry/proto/collector/metrics/v1/metrics_service_pb2.py +++ b/opentelemetry-proto/src/opentelemetry/proto/collector/metrics/v1/metrics_service_pb2.py @@ -3,6 +3,7 @@ # source: opentelemetry/proto/collector/metrics/v1/metrics_service.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database @@ -14,80 +15,12 @@ from opentelemetry.proto.metrics.v1 import metrics_pb2 as opentelemetry_dot_proto_dot_metrics_dot_v1_dot_metrics__pb2 -DESCRIPTOR = _descriptor.FileDescriptor( - name='opentelemetry/proto/collector/metrics/v1/metrics_service.proto', - package='opentelemetry.proto.collector.metrics.v1', - syntax='proto3', - serialized_options=b'\n+io.opentelemetry.proto.collector.metrics.v1B\023MetricsServiceProtoP\001Z3go.opentelemetry.io/proto/otlp/collector/metrics/v1', - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n>opentelemetry/proto/collector/metrics/v1/metrics_service.proto\x12(opentelemetry.proto.collector.metrics.v1\x1a,opentelemetry/proto/metrics/v1/metrics.proto\"h\n\x1b\x45xportMetricsServiceRequest\x12I\n\x10resource_metrics\x18\x01 \x03(\x0b\x32/.opentelemetry.proto.metrics.v1.ResourceMetrics\"\x1e\n\x1c\x45xportMetricsServiceResponse2\xac\x01\n\x0eMetricsService\x12\x99\x01\n\x06\x45xport\x12\x45.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest\x1a\x46.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse\"\x00\x42y\n+io.opentelemetry.proto.collector.metrics.v1B\x13MetricsServiceProtoP\x01Z3go.opentelemetry.io/proto/otlp/collector/metrics/v1b\x06proto3' - , - dependencies=[opentelemetry_dot_proto_dot_metrics_dot_v1_dot_metrics__pb2.DESCRIPTOR,]) +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n>opentelemetry/proto/collector/metrics/v1/metrics_service.proto\x12(opentelemetry.proto.collector.metrics.v1\x1a,opentelemetry/proto/metrics/v1/metrics.proto\"h\n\x1b\x45xportMetricsServiceRequest\x12I\n\x10resource_metrics\x18\x01 \x03(\x0b\x32/.opentelemetry.proto.metrics.v1.ResourceMetrics\"\x1e\n\x1c\x45xportMetricsServiceResponse2\xac\x01\n\x0eMetricsService\x12\x99\x01\n\x06\x45xport\x12\x45.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest\x1a\x46.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse\"\x00\x42y\n+io.opentelemetry.proto.collector.metrics.v1B\x13MetricsServiceProtoP\x01Z3go.opentelemetry.io/proto/otlp/collector/metrics/v1b\x06proto3') - -_EXPORTMETRICSSERVICEREQUEST = _descriptor.Descriptor( - name='ExportMetricsServiceRequest', - full_name='opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='resource_metrics', full_name='opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest.resource_metrics', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=154, - serialized_end=258, -) - - -_EXPORTMETRICSSERVICERESPONSE = _descriptor.Descriptor( - name='ExportMetricsServiceResponse', - full_name='opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=260, - serialized_end=290, -) - -_EXPORTMETRICSSERVICEREQUEST.fields_by_name['resource_metrics'].message_type = opentelemetry_dot_proto_dot_metrics_dot_v1_dot_metrics__pb2._RESOURCEMETRICS -DESCRIPTOR.message_types_by_name['ExportMetricsServiceRequest'] = _EXPORTMETRICSSERVICEREQUEST -DESCRIPTOR.message_types_by_name['ExportMetricsServiceResponse'] = _EXPORTMETRICSSERVICERESPONSE -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - +_EXPORTMETRICSSERVICEREQUEST = DESCRIPTOR.message_types_by_name['ExportMetricsServiceRequest'] +_EXPORTMETRICSSERVICERESPONSE = DESCRIPTOR.message_types_by_name['ExportMetricsServiceResponse'] ExportMetricsServiceRequest = _reflection.GeneratedProtocolMessageType('ExportMetricsServiceRequest', (_message.Message,), { 'DESCRIPTOR' : _EXPORTMETRICSSERVICEREQUEST, '__module__' : 'opentelemetry.proto.collector.metrics.v1.metrics_service_pb2' @@ -102,32 +35,15 @@ }) _sym_db.RegisterMessage(ExportMetricsServiceResponse) - -DESCRIPTOR._options = None - -_METRICSSERVICE = _descriptor.ServiceDescriptor( - name='MetricsService', - full_name='opentelemetry.proto.collector.metrics.v1.MetricsService', - file=DESCRIPTOR, - index=0, - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_start=293, - serialized_end=465, - methods=[ - _descriptor.MethodDescriptor( - name='Export', - full_name='opentelemetry.proto.collector.metrics.v1.MetricsService.Export', - index=0, - containing_service=None, - input_type=_EXPORTMETRICSSERVICEREQUEST, - output_type=_EXPORTMETRICSSERVICERESPONSE, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), -]) -_sym_db.RegisterServiceDescriptor(_METRICSSERVICE) - -DESCRIPTOR.services_by_name['MetricsService'] = _METRICSSERVICE - +_METRICSSERVICE = DESCRIPTOR.services_by_name['MetricsService'] +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n+io.opentelemetry.proto.collector.metrics.v1B\023MetricsServiceProtoP\001Z3go.opentelemetry.io/proto/otlp/collector/metrics/v1' + _EXPORTMETRICSSERVICEREQUEST._serialized_start=154 + _EXPORTMETRICSSERVICEREQUEST._serialized_end=258 + _EXPORTMETRICSSERVICERESPONSE._serialized_start=260 + _EXPORTMETRICSSERVICERESPONSE._serialized_end=290 + _METRICSSERVICE._serialized_start=293 + _METRICSSERVICE._serialized_end=465 # @@protoc_insertion_point(module_scope) diff --git a/opentelemetry-proto/src/opentelemetry/proto/collector/trace/v1/trace_service_pb2.py b/opentelemetry-proto/src/opentelemetry/proto/collector/trace/v1/trace_service_pb2.py index 7d988f1117b..d32dc619335 100644 --- a/opentelemetry-proto/src/opentelemetry/proto/collector/trace/v1/trace_service_pb2.py +++ b/opentelemetry-proto/src/opentelemetry/proto/collector/trace/v1/trace_service_pb2.py @@ -3,6 +3,7 @@ # source: opentelemetry/proto/collector/trace/v1/trace_service.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database @@ -14,80 +15,12 @@ from opentelemetry.proto.trace.v1 import trace_pb2 as opentelemetry_dot_proto_dot_trace_dot_v1_dot_trace__pb2 -DESCRIPTOR = _descriptor.FileDescriptor( - name='opentelemetry/proto/collector/trace/v1/trace_service.proto', - package='opentelemetry.proto.collector.trace.v1', - syntax='proto3', - serialized_options=b'\n)io.opentelemetry.proto.collector.trace.v1B\021TraceServiceProtoP\001Z1go.opentelemetry.io/proto/otlp/collector/trace/v1', - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n:opentelemetry/proto/collector/trace/v1/trace_service.proto\x12&opentelemetry.proto.collector.trace.v1\x1a(opentelemetry/proto/trace/v1/trace.proto\"`\n\x19\x45xportTraceServiceRequest\x12\x43\n\x0eresource_spans\x18\x01 \x03(\x0b\x32+.opentelemetry.proto.trace.v1.ResourceSpans\"\x1c\n\x1a\x45xportTraceServiceResponse2\xa2\x01\n\x0cTraceService\x12\x91\x01\n\x06\x45xport\x12\x41.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest\x1a\x42.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse\"\x00\x42s\n)io.opentelemetry.proto.collector.trace.v1B\x11TraceServiceProtoP\x01Z1go.opentelemetry.io/proto/otlp/collector/trace/v1b\x06proto3' - , - dependencies=[opentelemetry_dot_proto_dot_trace_dot_v1_dot_trace__pb2.DESCRIPTOR,]) +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n:opentelemetry/proto/collector/trace/v1/trace_service.proto\x12&opentelemetry.proto.collector.trace.v1\x1a(opentelemetry/proto/trace/v1/trace.proto\"`\n\x19\x45xportTraceServiceRequest\x12\x43\n\x0eresource_spans\x18\x01 \x03(\x0b\x32+.opentelemetry.proto.trace.v1.ResourceSpans\"\x1c\n\x1a\x45xportTraceServiceResponse2\xa2\x01\n\x0cTraceService\x12\x91\x01\n\x06\x45xport\x12\x41.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest\x1a\x42.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse\"\x00\x42s\n)io.opentelemetry.proto.collector.trace.v1B\x11TraceServiceProtoP\x01Z1go.opentelemetry.io/proto/otlp/collector/trace/v1b\x06proto3') - -_EXPORTTRACESERVICEREQUEST = _descriptor.Descriptor( - name='ExportTraceServiceRequest', - full_name='opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='resource_spans', full_name='opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest.resource_spans', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=144, - serialized_end=240, -) - - -_EXPORTTRACESERVICERESPONSE = _descriptor.Descriptor( - name='ExportTraceServiceResponse', - full_name='opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=242, - serialized_end=270, -) - -_EXPORTTRACESERVICEREQUEST.fields_by_name['resource_spans'].message_type = opentelemetry_dot_proto_dot_trace_dot_v1_dot_trace__pb2._RESOURCESPANS -DESCRIPTOR.message_types_by_name['ExportTraceServiceRequest'] = _EXPORTTRACESERVICEREQUEST -DESCRIPTOR.message_types_by_name['ExportTraceServiceResponse'] = _EXPORTTRACESERVICERESPONSE -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - +_EXPORTTRACESERVICEREQUEST = DESCRIPTOR.message_types_by_name['ExportTraceServiceRequest'] +_EXPORTTRACESERVICERESPONSE = DESCRIPTOR.message_types_by_name['ExportTraceServiceResponse'] ExportTraceServiceRequest = _reflection.GeneratedProtocolMessageType('ExportTraceServiceRequest', (_message.Message,), { 'DESCRIPTOR' : _EXPORTTRACESERVICEREQUEST, '__module__' : 'opentelemetry.proto.collector.trace.v1.trace_service_pb2' @@ -102,32 +35,15 @@ }) _sym_db.RegisterMessage(ExportTraceServiceResponse) - -DESCRIPTOR._options = None - -_TRACESERVICE = _descriptor.ServiceDescriptor( - name='TraceService', - full_name='opentelemetry.proto.collector.trace.v1.TraceService', - file=DESCRIPTOR, - index=0, - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_start=273, - serialized_end=435, - methods=[ - _descriptor.MethodDescriptor( - name='Export', - full_name='opentelemetry.proto.collector.trace.v1.TraceService.Export', - index=0, - containing_service=None, - input_type=_EXPORTTRACESERVICEREQUEST, - output_type=_EXPORTTRACESERVICERESPONSE, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), -]) -_sym_db.RegisterServiceDescriptor(_TRACESERVICE) - -DESCRIPTOR.services_by_name['TraceService'] = _TRACESERVICE - +_TRACESERVICE = DESCRIPTOR.services_by_name['TraceService'] +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n)io.opentelemetry.proto.collector.trace.v1B\021TraceServiceProtoP\001Z1go.opentelemetry.io/proto/otlp/collector/trace/v1' + _EXPORTTRACESERVICEREQUEST._serialized_start=144 + _EXPORTTRACESERVICEREQUEST._serialized_end=240 + _EXPORTTRACESERVICERESPONSE._serialized_start=242 + _EXPORTTRACESERVICERESPONSE._serialized_end=270 + _TRACESERVICE._serialized_start=273 + _TRACESERVICE._serialized_end=435 # @@protoc_insertion_point(module_scope) diff --git a/opentelemetry-proto/src/opentelemetry/proto/common/v1/common_pb2.py b/opentelemetry-proto/src/opentelemetry/proto/common/v1/common_pb2.py index ba7d33ef61f..a38431a589b 100644 --- a/opentelemetry-proto/src/opentelemetry/proto/common/v1/common_pb2.py +++ b/opentelemetry-proto/src/opentelemetry/proto/common/v1/common_pb2.py @@ -3,6 +3,7 @@ # source: opentelemetry/proto/common/v1/common.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database @@ -13,311 +14,16 @@ -DESCRIPTOR = _descriptor.FileDescriptor( - name='opentelemetry/proto/common/v1/common.proto', - package='opentelemetry.proto.common.v1', - syntax='proto3', - serialized_options=b'\n io.opentelemetry.proto.common.v1B\013CommonProtoP\001Z(go.opentelemetry.io/proto/otlp/common/v1', - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n*opentelemetry/proto/common/v1/common.proto\x12\x1dopentelemetry.proto.common.v1\"\x8c\x02\n\x08\x41nyValue\x12\x16\n\x0cstring_value\x18\x01 \x01(\tH\x00\x12\x14\n\nbool_value\x18\x02 \x01(\x08H\x00\x12\x13\n\tint_value\x18\x03 \x01(\x03H\x00\x12\x16\n\x0c\x64ouble_value\x18\x04 \x01(\x01H\x00\x12@\n\x0b\x61rray_value\x18\x05 \x01(\x0b\x32).opentelemetry.proto.common.v1.ArrayValueH\x00\x12\x43\n\x0ckvlist_value\x18\x06 \x01(\x0b\x32+.opentelemetry.proto.common.v1.KeyValueListH\x00\x12\x15\n\x0b\x62ytes_value\x18\x07 \x01(\x0cH\x00\x42\x07\n\x05value\"E\n\nArrayValue\x12\x37\n\x06values\x18\x01 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.AnyValue\"G\n\x0cKeyValueList\x12\x37\n\x06values\x18\x01 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\"O\n\x08KeyValue\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x36\n\x05value\x18\x02 \x01(\x0b\x32\'.opentelemetry.proto.common.v1.AnyValue\";\n\x16InstrumentationLibrary\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0f\n\x07version\x18\x02 \x01(\t:\x02\x18\x01\"5\n\x14InstrumentationScope\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0f\n\x07version\x18\x02 \x01(\tB[\n io.opentelemetry.proto.common.v1B\x0b\x43ommonProtoP\x01Z(go.opentelemetry.io/proto/otlp/common/v1b\x06proto3' -) +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n*opentelemetry/proto/common/v1/common.proto\x12\x1dopentelemetry.proto.common.v1\"\x8c\x02\n\x08\x41nyValue\x12\x16\n\x0cstring_value\x18\x01 \x01(\tH\x00\x12\x14\n\nbool_value\x18\x02 \x01(\x08H\x00\x12\x13\n\tint_value\x18\x03 \x01(\x03H\x00\x12\x16\n\x0c\x64ouble_value\x18\x04 \x01(\x01H\x00\x12@\n\x0b\x61rray_value\x18\x05 \x01(\x0b\x32).opentelemetry.proto.common.v1.ArrayValueH\x00\x12\x43\n\x0ckvlist_value\x18\x06 \x01(\x0b\x32+.opentelemetry.proto.common.v1.KeyValueListH\x00\x12\x15\n\x0b\x62ytes_value\x18\x07 \x01(\x0cH\x00\x42\x07\n\x05value\"E\n\nArrayValue\x12\x37\n\x06values\x18\x01 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.AnyValue\"G\n\x0cKeyValueList\x12\x37\n\x06values\x18\x01 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\"O\n\x08KeyValue\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x36\n\x05value\x18\x02 \x01(\x0b\x32\'.opentelemetry.proto.common.v1.AnyValue\";\n\x16InstrumentationLibrary\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0f\n\x07version\x18\x02 \x01(\t:\x02\x18\x01\"5\n\x14InstrumentationScope\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0f\n\x07version\x18\x02 \x01(\tB[\n io.opentelemetry.proto.common.v1B\x0b\x43ommonProtoP\x01Z(go.opentelemetry.io/proto/otlp/common/v1b\x06proto3') - -_ANYVALUE = _descriptor.Descriptor( - name='AnyValue', - full_name='opentelemetry.proto.common.v1.AnyValue', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='string_value', full_name='opentelemetry.proto.common.v1.AnyValue.string_value', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='bool_value', full_name='opentelemetry.proto.common.v1.AnyValue.bool_value', index=1, - number=2, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='int_value', full_name='opentelemetry.proto.common.v1.AnyValue.int_value', index=2, - number=3, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='double_value', full_name='opentelemetry.proto.common.v1.AnyValue.double_value', index=3, - number=4, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=float(0), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='array_value', full_name='opentelemetry.proto.common.v1.AnyValue.array_value', index=4, - number=5, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='kvlist_value', full_name='opentelemetry.proto.common.v1.AnyValue.kvlist_value', index=5, - number=6, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='bytes_value', full_name='opentelemetry.proto.common.v1.AnyValue.bytes_value', index=6, - number=7, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name='value', full_name='opentelemetry.proto.common.v1.AnyValue.value', - index=0, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), - ], - serialized_start=78, - serialized_end=346, -) - - -_ARRAYVALUE = _descriptor.Descriptor( - name='ArrayValue', - full_name='opentelemetry.proto.common.v1.ArrayValue', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='values', full_name='opentelemetry.proto.common.v1.ArrayValue.values', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=348, - serialized_end=417, -) - - -_KEYVALUELIST = _descriptor.Descriptor( - name='KeyValueList', - full_name='opentelemetry.proto.common.v1.KeyValueList', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='values', full_name='opentelemetry.proto.common.v1.KeyValueList.values', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=419, - serialized_end=490, -) - - -_KEYVALUE = _descriptor.Descriptor( - name='KeyValue', - full_name='opentelemetry.proto.common.v1.KeyValue', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='key', full_name='opentelemetry.proto.common.v1.KeyValue.key', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='value', full_name='opentelemetry.proto.common.v1.KeyValue.value', index=1, - number=2, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=492, - serialized_end=571, -) - - -_INSTRUMENTATIONLIBRARY = _descriptor.Descriptor( - name='InstrumentationLibrary', - full_name='opentelemetry.proto.common.v1.InstrumentationLibrary', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='name', full_name='opentelemetry.proto.common.v1.InstrumentationLibrary.name', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='version', full_name='opentelemetry.proto.common.v1.InstrumentationLibrary.version', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=b'\030\001', - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=573, - serialized_end=632, -) - - -_INSTRUMENTATIONSCOPE = _descriptor.Descriptor( - name='InstrumentationScope', - full_name='opentelemetry.proto.common.v1.InstrumentationScope', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='name', full_name='opentelemetry.proto.common.v1.InstrumentationScope.name', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='version', full_name='opentelemetry.proto.common.v1.InstrumentationScope.version', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=634, - serialized_end=687, -) - -_ANYVALUE.fields_by_name['array_value'].message_type = _ARRAYVALUE -_ANYVALUE.fields_by_name['kvlist_value'].message_type = _KEYVALUELIST -_ANYVALUE.oneofs_by_name['value'].fields.append( - _ANYVALUE.fields_by_name['string_value']) -_ANYVALUE.fields_by_name['string_value'].containing_oneof = _ANYVALUE.oneofs_by_name['value'] -_ANYVALUE.oneofs_by_name['value'].fields.append( - _ANYVALUE.fields_by_name['bool_value']) -_ANYVALUE.fields_by_name['bool_value'].containing_oneof = _ANYVALUE.oneofs_by_name['value'] -_ANYVALUE.oneofs_by_name['value'].fields.append( - _ANYVALUE.fields_by_name['int_value']) -_ANYVALUE.fields_by_name['int_value'].containing_oneof = _ANYVALUE.oneofs_by_name['value'] -_ANYVALUE.oneofs_by_name['value'].fields.append( - _ANYVALUE.fields_by_name['double_value']) -_ANYVALUE.fields_by_name['double_value'].containing_oneof = _ANYVALUE.oneofs_by_name['value'] -_ANYVALUE.oneofs_by_name['value'].fields.append( - _ANYVALUE.fields_by_name['array_value']) -_ANYVALUE.fields_by_name['array_value'].containing_oneof = _ANYVALUE.oneofs_by_name['value'] -_ANYVALUE.oneofs_by_name['value'].fields.append( - _ANYVALUE.fields_by_name['kvlist_value']) -_ANYVALUE.fields_by_name['kvlist_value'].containing_oneof = _ANYVALUE.oneofs_by_name['value'] -_ANYVALUE.oneofs_by_name['value'].fields.append( - _ANYVALUE.fields_by_name['bytes_value']) -_ANYVALUE.fields_by_name['bytes_value'].containing_oneof = _ANYVALUE.oneofs_by_name['value'] -_ARRAYVALUE.fields_by_name['values'].message_type = _ANYVALUE -_KEYVALUELIST.fields_by_name['values'].message_type = _KEYVALUE -_KEYVALUE.fields_by_name['value'].message_type = _ANYVALUE -DESCRIPTOR.message_types_by_name['AnyValue'] = _ANYVALUE -DESCRIPTOR.message_types_by_name['ArrayValue'] = _ARRAYVALUE -DESCRIPTOR.message_types_by_name['KeyValueList'] = _KEYVALUELIST -DESCRIPTOR.message_types_by_name['KeyValue'] = _KEYVALUE -DESCRIPTOR.message_types_by_name['InstrumentationLibrary'] = _INSTRUMENTATIONLIBRARY -DESCRIPTOR.message_types_by_name['InstrumentationScope'] = _INSTRUMENTATIONSCOPE -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - +_ANYVALUE = DESCRIPTOR.message_types_by_name['AnyValue'] +_ARRAYVALUE = DESCRIPTOR.message_types_by_name['ArrayValue'] +_KEYVALUELIST = DESCRIPTOR.message_types_by_name['KeyValueList'] +_KEYVALUE = DESCRIPTOR.message_types_by_name['KeyValue'] +_INSTRUMENTATIONLIBRARY = DESCRIPTOR.message_types_by_name['InstrumentationLibrary'] +_INSTRUMENTATIONSCOPE = DESCRIPTOR.message_types_by_name['InstrumentationScope'] AnyValue = _reflection.GeneratedProtocolMessageType('AnyValue', (_message.Message,), { 'DESCRIPTOR' : _ANYVALUE, '__module__' : 'opentelemetry.proto.common.v1.common_pb2' @@ -360,7 +66,22 @@ }) _sym_db.RegisterMessage(InstrumentationScope) - -DESCRIPTOR._options = None -_INSTRUMENTATIONLIBRARY._options = None +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n io.opentelemetry.proto.common.v1B\013CommonProtoP\001Z(go.opentelemetry.io/proto/otlp/common/v1' + _INSTRUMENTATIONLIBRARY._options = None + _INSTRUMENTATIONLIBRARY._serialized_options = b'\030\001' + _ANYVALUE._serialized_start=78 + _ANYVALUE._serialized_end=346 + _ARRAYVALUE._serialized_start=348 + _ARRAYVALUE._serialized_end=417 + _KEYVALUELIST._serialized_start=419 + _KEYVALUELIST._serialized_end=490 + _KEYVALUE._serialized_start=492 + _KEYVALUE._serialized_end=571 + _INSTRUMENTATIONLIBRARY._serialized_start=573 + _INSTRUMENTATIONLIBRARY._serialized_end=632 + _INSTRUMENTATIONSCOPE._serialized_start=634 + _INSTRUMENTATIONSCOPE._serialized_end=687 # @@protoc_insertion_point(module_scope) diff --git a/opentelemetry-proto/src/opentelemetry/proto/logs/v1/logs_pb2.py b/opentelemetry-proto/src/opentelemetry/proto/logs/v1/logs_pb2.py index f9e74eb67eb..3967fa967b9 100644 --- a/opentelemetry-proto/src/opentelemetry/proto/logs/v1/logs_pb2.py +++ b/opentelemetry-proto/src/opentelemetry/proto/logs/v1/logs_pb2.py @@ -4,6 +4,7 @@ """Generated protocol buffer code.""" from google.protobuf.internal import enum_type_wrapper from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database @@ -16,182 +17,11 @@ from opentelemetry.proto.resource.v1 import resource_pb2 as opentelemetry_dot_proto_dot_resource_dot_v1_dot_resource__pb2 -DESCRIPTOR = _descriptor.FileDescriptor( - name='opentelemetry/proto/logs/v1/logs.proto', - package='opentelemetry.proto.logs.v1', - syntax='proto3', - serialized_options=b'\n\036io.opentelemetry.proto.logs.v1B\tLogsProtoP\001Z&go.opentelemetry.io/proto/otlp/logs/v1', - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n&opentelemetry/proto/logs/v1/logs.proto\x12\x1bopentelemetry.proto.logs.v1\x1a*opentelemetry/proto/common/v1/common.proto\x1a.opentelemetry/proto/resource/v1/resource.proto\"L\n\x08LogsData\x12@\n\rresource_logs\x18\x01 \x03(\x0b\x32).opentelemetry.proto.logs.v1.ResourceLogs\"\xff\x01\n\x0cResourceLogs\x12;\n\x08resource\x18\x01 \x01(\x0b\x32).opentelemetry.proto.resource.v1.Resource\x12:\n\nscope_logs\x18\x02 \x03(\x0b\x32&.opentelemetry.proto.logs.v1.ScopeLogs\x12\x62\n\x1cinstrumentation_library_logs\x18\xe8\x07 \x03(\x0b\x32\x37.opentelemetry.proto.logs.v1.InstrumentationLibraryLogsB\x02\x18\x01\x12\x12\n\nschema_url\x18\x03 \x01(\t\"\xa0\x01\n\tScopeLogs\x12\x42\n\x05scope\x18\x01 \x01(\x0b\x32\x33.opentelemetry.proto.common.v1.InstrumentationScope\x12;\n\x0blog_records\x18\x02 \x03(\x0b\x32&.opentelemetry.proto.logs.v1.LogRecord\x12\x12\n\nschema_url\x18\x03 \x01(\t\"\xc9\x01\n\x1aInstrumentationLibraryLogs\x12V\n\x17instrumentation_library\x18\x01 \x01(\x0b\x32\x35.opentelemetry.proto.common.v1.InstrumentationLibrary\x12;\n\x0blog_records\x18\x02 \x03(\x0b\x32&.opentelemetry.proto.logs.v1.LogRecord\x12\x12\n\nschema_url\x18\x03 \x01(\t:\x02\x18\x01\"\xef\x02\n\tLogRecord\x12\x16\n\x0etime_unix_nano\x18\x01 \x01(\x06\x12\x1f\n\x17observed_time_unix_nano\x18\x0b \x01(\x06\x12\x44\n\x0fseverity_number\x18\x02 \x01(\x0e\x32+.opentelemetry.proto.logs.v1.SeverityNumber\x12\x15\n\rseverity_text\x18\x03 \x01(\t\x12\x35\n\x04\x62ody\x18\x05 \x01(\x0b\x32\'.opentelemetry.proto.common.v1.AnyValue\x12;\n\nattributes\x18\x06 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12 \n\x18\x64ropped_attributes_count\x18\x07 \x01(\r\x12\r\n\x05\x66lags\x18\x08 \x01(\x07\x12\x10\n\x08trace_id\x18\t \x01(\x0c\x12\x0f\n\x07span_id\x18\n \x01(\x0cJ\x04\x08\x04\x10\x05*\xc3\x05\n\x0eSeverityNumber\x12\x1f\n\x1bSEVERITY_NUMBER_UNSPECIFIED\x10\x00\x12\x19\n\x15SEVERITY_NUMBER_TRACE\x10\x01\x12\x1a\n\x16SEVERITY_NUMBER_TRACE2\x10\x02\x12\x1a\n\x16SEVERITY_NUMBER_TRACE3\x10\x03\x12\x1a\n\x16SEVERITY_NUMBER_TRACE4\x10\x04\x12\x19\n\x15SEVERITY_NUMBER_DEBUG\x10\x05\x12\x1a\n\x16SEVERITY_NUMBER_DEBUG2\x10\x06\x12\x1a\n\x16SEVERITY_NUMBER_DEBUG3\x10\x07\x12\x1a\n\x16SEVERITY_NUMBER_DEBUG4\x10\x08\x12\x18\n\x14SEVERITY_NUMBER_INFO\x10\t\x12\x19\n\x15SEVERITY_NUMBER_INFO2\x10\n\x12\x19\n\x15SEVERITY_NUMBER_INFO3\x10\x0b\x12\x19\n\x15SEVERITY_NUMBER_INFO4\x10\x0c\x12\x18\n\x14SEVERITY_NUMBER_WARN\x10\r\x12\x19\n\x15SEVERITY_NUMBER_WARN2\x10\x0e\x12\x19\n\x15SEVERITY_NUMBER_WARN3\x10\x0f\x12\x19\n\x15SEVERITY_NUMBER_WARN4\x10\x10\x12\x19\n\x15SEVERITY_NUMBER_ERROR\x10\x11\x12\x1a\n\x16SEVERITY_NUMBER_ERROR2\x10\x12\x12\x1a\n\x16SEVERITY_NUMBER_ERROR3\x10\x13\x12\x1a\n\x16SEVERITY_NUMBER_ERROR4\x10\x14\x12\x19\n\x15SEVERITY_NUMBER_FATAL\x10\x15\x12\x1a\n\x16SEVERITY_NUMBER_FATAL2\x10\x16\x12\x1a\n\x16SEVERITY_NUMBER_FATAL3\x10\x17\x12\x1a\n\x16SEVERITY_NUMBER_FATAL4\x10\x18*X\n\x0eLogRecordFlags\x12\x1f\n\x1bLOG_RECORD_FLAG_UNSPECIFIED\x10\x00\x12%\n LOG_RECORD_FLAG_TRACE_FLAGS_MASK\x10\xff\x01\x42U\n\x1eio.opentelemetry.proto.logs.v1B\tLogsProtoP\x01Z&go.opentelemetry.io/proto/otlp/logs/v1b\x06proto3' - , - dependencies=[opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2.DESCRIPTOR,opentelemetry_dot_proto_dot_resource_dot_v1_dot_resource__pb2.DESCRIPTOR,]) - -_SEVERITYNUMBER = _descriptor.EnumDescriptor( - name='SeverityNumber', - full_name='opentelemetry.proto.logs.v1.SeverityNumber', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_UNSPECIFIED', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_TRACE', index=1, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_TRACE2', index=2, number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_TRACE3', index=3, number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_TRACE4', index=4, number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_DEBUG', index=5, number=5, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_DEBUG2', index=6, number=6, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_DEBUG3', index=7, number=7, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_DEBUG4', index=8, number=8, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_INFO', index=9, number=9, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_INFO2', index=10, number=10, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_INFO3', index=11, number=11, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_INFO4', index=12, number=12, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_WARN', index=13, number=13, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_WARN2', index=14, number=14, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_WARN3', index=15, number=15, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_WARN4', index=16, number=16, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_ERROR', index=17, number=17, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_ERROR2', index=18, number=18, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_ERROR3', index=19, number=19, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_ERROR4', index=20, number=20, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_FATAL', index=21, number=21, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_FATAL2', index=22, number=22, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_FATAL3', index=23, number=23, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SEVERITY_NUMBER_FATAL4', index=24, number=24, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - serialized_start=1237, - serialized_end=1944, -) -_sym_db.RegisterEnumDescriptor(_SEVERITYNUMBER) +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n&opentelemetry/proto/logs/v1/logs.proto\x12\x1bopentelemetry.proto.logs.v1\x1a*opentelemetry/proto/common/v1/common.proto\x1a.opentelemetry/proto/resource/v1/resource.proto\"L\n\x08LogsData\x12@\n\rresource_logs\x18\x01 \x03(\x0b\x32).opentelemetry.proto.logs.v1.ResourceLogs\"\xff\x01\n\x0cResourceLogs\x12;\n\x08resource\x18\x01 \x01(\x0b\x32).opentelemetry.proto.resource.v1.Resource\x12:\n\nscope_logs\x18\x02 \x03(\x0b\x32&.opentelemetry.proto.logs.v1.ScopeLogs\x12\x62\n\x1cinstrumentation_library_logs\x18\xe8\x07 \x03(\x0b\x32\x37.opentelemetry.proto.logs.v1.InstrumentationLibraryLogsB\x02\x18\x01\x12\x12\n\nschema_url\x18\x03 \x01(\t\"\xa0\x01\n\tScopeLogs\x12\x42\n\x05scope\x18\x01 \x01(\x0b\x32\x33.opentelemetry.proto.common.v1.InstrumentationScope\x12;\n\x0blog_records\x18\x02 \x03(\x0b\x32&.opentelemetry.proto.logs.v1.LogRecord\x12\x12\n\nschema_url\x18\x03 \x01(\t\"\xc9\x01\n\x1aInstrumentationLibraryLogs\x12V\n\x17instrumentation_library\x18\x01 \x01(\x0b\x32\x35.opentelemetry.proto.common.v1.InstrumentationLibrary\x12;\n\x0blog_records\x18\x02 \x03(\x0b\x32&.opentelemetry.proto.logs.v1.LogRecord\x12\x12\n\nschema_url\x18\x03 \x01(\t:\x02\x18\x01\"\xef\x02\n\tLogRecord\x12\x16\n\x0etime_unix_nano\x18\x01 \x01(\x06\x12\x1f\n\x17observed_time_unix_nano\x18\x0b \x01(\x06\x12\x44\n\x0fseverity_number\x18\x02 \x01(\x0e\x32+.opentelemetry.proto.logs.v1.SeverityNumber\x12\x15\n\rseverity_text\x18\x03 \x01(\t\x12\x35\n\x04\x62ody\x18\x05 \x01(\x0b\x32\'.opentelemetry.proto.common.v1.AnyValue\x12;\n\nattributes\x18\x06 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12 \n\x18\x64ropped_attributes_count\x18\x07 \x01(\r\x12\r\n\x05\x66lags\x18\x08 \x01(\x07\x12\x10\n\x08trace_id\x18\t \x01(\x0c\x12\x0f\n\x07span_id\x18\n \x01(\x0cJ\x04\x08\x04\x10\x05*\xc3\x05\n\x0eSeverityNumber\x12\x1f\n\x1bSEVERITY_NUMBER_UNSPECIFIED\x10\x00\x12\x19\n\x15SEVERITY_NUMBER_TRACE\x10\x01\x12\x1a\n\x16SEVERITY_NUMBER_TRACE2\x10\x02\x12\x1a\n\x16SEVERITY_NUMBER_TRACE3\x10\x03\x12\x1a\n\x16SEVERITY_NUMBER_TRACE4\x10\x04\x12\x19\n\x15SEVERITY_NUMBER_DEBUG\x10\x05\x12\x1a\n\x16SEVERITY_NUMBER_DEBUG2\x10\x06\x12\x1a\n\x16SEVERITY_NUMBER_DEBUG3\x10\x07\x12\x1a\n\x16SEVERITY_NUMBER_DEBUG4\x10\x08\x12\x18\n\x14SEVERITY_NUMBER_INFO\x10\t\x12\x19\n\x15SEVERITY_NUMBER_INFO2\x10\n\x12\x19\n\x15SEVERITY_NUMBER_INFO3\x10\x0b\x12\x19\n\x15SEVERITY_NUMBER_INFO4\x10\x0c\x12\x18\n\x14SEVERITY_NUMBER_WARN\x10\r\x12\x19\n\x15SEVERITY_NUMBER_WARN2\x10\x0e\x12\x19\n\x15SEVERITY_NUMBER_WARN3\x10\x0f\x12\x19\n\x15SEVERITY_NUMBER_WARN4\x10\x10\x12\x19\n\x15SEVERITY_NUMBER_ERROR\x10\x11\x12\x1a\n\x16SEVERITY_NUMBER_ERROR2\x10\x12\x12\x1a\n\x16SEVERITY_NUMBER_ERROR3\x10\x13\x12\x1a\n\x16SEVERITY_NUMBER_ERROR4\x10\x14\x12\x19\n\x15SEVERITY_NUMBER_FATAL\x10\x15\x12\x1a\n\x16SEVERITY_NUMBER_FATAL2\x10\x16\x12\x1a\n\x16SEVERITY_NUMBER_FATAL3\x10\x17\x12\x1a\n\x16SEVERITY_NUMBER_FATAL4\x10\x18*X\n\x0eLogRecordFlags\x12\x1f\n\x1bLOG_RECORD_FLAG_UNSPECIFIED\x10\x00\x12%\n LOG_RECORD_FLAG_TRACE_FLAGS_MASK\x10\xff\x01\x42U\n\x1eio.opentelemetry.proto.logs.v1B\tLogsProtoP\x01Z&go.opentelemetry.io/proto/otlp/logs/v1b\x06proto3') +_SEVERITYNUMBER = DESCRIPTOR.enum_types_by_name['SeverityNumber'] SeverityNumber = enum_type_wrapper.EnumTypeWrapper(_SEVERITYNUMBER) -_LOGRECORDFLAGS = _descriptor.EnumDescriptor( - name='LogRecordFlags', - full_name='opentelemetry.proto.logs.v1.LogRecordFlags', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='LOG_RECORD_FLAG_UNSPECIFIED', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='LOG_RECORD_FLAG_TRACE_FLAGS_MASK', index=1, number=255, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - serialized_start=1946, - serialized_end=2034, -) -_sym_db.RegisterEnumDescriptor(_LOGRECORDFLAGS) - +_LOGRECORDFLAGS = DESCRIPTOR.enum_types_by_name['LogRecordFlags'] LogRecordFlags = enum_type_wrapper.EnumTypeWrapper(_LOGRECORDFLAGS) SEVERITY_NUMBER_UNSPECIFIED = 0 SEVERITY_NUMBER_TRACE = 1 @@ -222,298 +52,11 @@ LOG_RECORD_FLAG_TRACE_FLAGS_MASK = 255 - -_LOGSDATA = _descriptor.Descriptor( - name='LogsData', - full_name='opentelemetry.proto.logs.v1.LogsData', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='resource_logs', full_name='opentelemetry.proto.logs.v1.LogsData.resource_logs', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=163, - serialized_end=239, -) - - -_RESOURCELOGS = _descriptor.Descriptor( - name='ResourceLogs', - full_name='opentelemetry.proto.logs.v1.ResourceLogs', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='resource', full_name='opentelemetry.proto.logs.v1.ResourceLogs.resource', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='scope_logs', full_name='opentelemetry.proto.logs.v1.ResourceLogs.scope_logs', index=1, - number=2, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='instrumentation_library_logs', full_name='opentelemetry.proto.logs.v1.ResourceLogs.instrumentation_library_logs', index=2, - number=1000, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=b'\030\001', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='schema_url', full_name='opentelemetry.proto.logs.v1.ResourceLogs.schema_url', index=3, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=242, - serialized_end=497, -) - - -_SCOPELOGS = _descriptor.Descriptor( - name='ScopeLogs', - full_name='opentelemetry.proto.logs.v1.ScopeLogs', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='scope', full_name='opentelemetry.proto.logs.v1.ScopeLogs.scope', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='log_records', full_name='opentelemetry.proto.logs.v1.ScopeLogs.log_records', index=1, - number=2, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='schema_url', full_name='opentelemetry.proto.logs.v1.ScopeLogs.schema_url', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=500, - serialized_end=660, -) - - -_INSTRUMENTATIONLIBRARYLOGS = _descriptor.Descriptor( - name='InstrumentationLibraryLogs', - full_name='opentelemetry.proto.logs.v1.InstrumentationLibraryLogs', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='instrumentation_library', full_name='opentelemetry.proto.logs.v1.InstrumentationLibraryLogs.instrumentation_library', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='log_records', full_name='opentelemetry.proto.logs.v1.InstrumentationLibraryLogs.log_records', index=1, - number=2, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='schema_url', full_name='opentelemetry.proto.logs.v1.InstrumentationLibraryLogs.schema_url', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=b'\030\001', - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=663, - serialized_end=864, -) - - -_LOGRECORD = _descriptor.Descriptor( - name='LogRecord', - full_name='opentelemetry.proto.logs.v1.LogRecord', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='time_unix_nano', full_name='opentelemetry.proto.logs.v1.LogRecord.time_unix_nano', index=0, - number=1, type=6, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='observed_time_unix_nano', full_name='opentelemetry.proto.logs.v1.LogRecord.observed_time_unix_nano', index=1, - number=11, type=6, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='severity_number', full_name='opentelemetry.proto.logs.v1.LogRecord.severity_number', index=2, - number=2, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='severity_text', full_name='opentelemetry.proto.logs.v1.LogRecord.severity_text', index=3, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='body', full_name='opentelemetry.proto.logs.v1.LogRecord.body', index=4, - number=5, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='attributes', full_name='opentelemetry.proto.logs.v1.LogRecord.attributes', index=5, - number=6, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='dropped_attributes_count', full_name='opentelemetry.proto.logs.v1.LogRecord.dropped_attributes_count', index=6, - number=7, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='flags', full_name='opentelemetry.proto.logs.v1.LogRecord.flags', index=7, - number=8, type=7, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='trace_id', full_name='opentelemetry.proto.logs.v1.LogRecord.trace_id', index=8, - number=9, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='span_id', full_name='opentelemetry.proto.logs.v1.LogRecord.span_id', index=9, - number=10, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=867, - serialized_end=1234, -) - -_LOGSDATA.fields_by_name['resource_logs'].message_type = _RESOURCELOGS -_RESOURCELOGS.fields_by_name['resource'].message_type = opentelemetry_dot_proto_dot_resource_dot_v1_dot_resource__pb2._RESOURCE -_RESOURCELOGS.fields_by_name['scope_logs'].message_type = _SCOPELOGS -_RESOURCELOGS.fields_by_name['instrumentation_library_logs'].message_type = _INSTRUMENTATIONLIBRARYLOGS -_SCOPELOGS.fields_by_name['scope'].message_type = opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2._INSTRUMENTATIONSCOPE -_SCOPELOGS.fields_by_name['log_records'].message_type = _LOGRECORD -_INSTRUMENTATIONLIBRARYLOGS.fields_by_name['instrumentation_library'].message_type = opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2._INSTRUMENTATIONLIBRARY -_INSTRUMENTATIONLIBRARYLOGS.fields_by_name['log_records'].message_type = _LOGRECORD -_LOGRECORD.fields_by_name['severity_number'].enum_type = _SEVERITYNUMBER -_LOGRECORD.fields_by_name['body'].message_type = opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2._ANYVALUE -_LOGRECORD.fields_by_name['attributes'].message_type = opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2._KEYVALUE -DESCRIPTOR.message_types_by_name['LogsData'] = _LOGSDATA -DESCRIPTOR.message_types_by_name['ResourceLogs'] = _RESOURCELOGS -DESCRIPTOR.message_types_by_name['ScopeLogs'] = _SCOPELOGS -DESCRIPTOR.message_types_by_name['InstrumentationLibraryLogs'] = _INSTRUMENTATIONLIBRARYLOGS -DESCRIPTOR.message_types_by_name['LogRecord'] = _LOGRECORD -DESCRIPTOR.enum_types_by_name['SeverityNumber'] = _SEVERITYNUMBER -DESCRIPTOR.enum_types_by_name['LogRecordFlags'] = _LOGRECORDFLAGS -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - +_LOGSDATA = DESCRIPTOR.message_types_by_name['LogsData'] +_RESOURCELOGS = DESCRIPTOR.message_types_by_name['ResourceLogs'] +_SCOPELOGS = DESCRIPTOR.message_types_by_name['ScopeLogs'] +_INSTRUMENTATIONLIBRARYLOGS = DESCRIPTOR.message_types_by_name['InstrumentationLibraryLogs'] +_LOGRECORD = DESCRIPTOR.message_types_by_name['LogRecord'] LogsData = _reflection.GeneratedProtocolMessageType('LogsData', (_message.Message,), { 'DESCRIPTOR' : _LOGSDATA, '__module__' : 'opentelemetry.proto.logs.v1.logs_pb2' @@ -549,8 +92,26 @@ }) _sym_db.RegisterMessage(LogRecord) - -DESCRIPTOR._options = None -_RESOURCELOGS.fields_by_name['instrumentation_library_logs']._options = None -_INSTRUMENTATIONLIBRARYLOGS._options = None +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\036io.opentelemetry.proto.logs.v1B\tLogsProtoP\001Z&go.opentelemetry.io/proto/otlp/logs/v1' + _RESOURCELOGS.fields_by_name['instrumentation_library_logs']._options = None + _RESOURCELOGS.fields_by_name['instrumentation_library_logs']._serialized_options = b'\030\001' + _INSTRUMENTATIONLIBRARYLOGS._options = None + _INSTRUMENTATIONLIBRARYLOGS._serialized_options = b'\030\001' + _SEVERITYNUMBER._serialized_start=1237 + _SEVERITYNUMBER._serialized_end=1944 + _LOGRECORDFLAGS._serialized_start=1946 + _LOGRECORDFLAGS._serialized_end=2034 + _LOGSDATA._serialized_start=163 + _LOGSDATA._serialized_end=239 + _RESOURCELOGS._serialized_start=242 + _RESOURCELOGS._serialized_end=497 + _SCOPELOGS._serialized_start=500 + _SCOPELOGS._serialized_end=660 + _INSTRUMENTATIONLIBRARYLOGS._serialized_start=663 + _INSTRUMENTATIONLIBRARYLOGS._serialized_end=864 + _LOGRECORD._serialized_start=867 + _LOGRECORD._serialized_end=1234 # @@protoc_insertion_point(module_scope) diff --git a/opentelemetry-proto/src/opentelemetry/proto/metrics/experimental/metrics_config_service_pb2.py b/opentelemetry-proto/src/opentelemetry/proto/metrics/experimental/metrics_config_service_pb2.py deleted file mode 100644 index 212840ca032..00000000000 --- a/opentelemetry-proto/src/opentelemetry/proto/metrics/experimental/metrics_config_service_pb2.py +++ /dev/null @@ -1,276 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: opentelemetry/proto/metrics/experimental/metrics_config_service.proto -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from opentelemetry.proto.resource.v1 import resource_pb2 as opentelemetry_dot_proto_dot_resource_dot_v1_dot_resource__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name='opentelemetry/proto/metrics/experimental/metrics_config_service.proto', - package='opentelemetry.proto.metrics.experimental', - syntax='proto3', - serialized_options=b'\n+io.opentelemetry.proto.metrics.experimentalB\030MetricConfigServiceProtoP\001ZIgithub.com/open-telemetry/opentelemetry-proto/gen/go/metrics/experimental', - create_key=_descriptor._internal_create_key, - serialized_pb=b'\nEopentelemetry/proto/metrics/experimental/metrics_config_service.proto\x12(opentelemetry.proto.metrics.experimental\x1a.opentelemetry/proto/resource/v1/resource.proto\"r\n\x13MetricConfigRequest\x12;\n\x08resource\x18\x01 \x01(\x0b\x32).opentelemetry.proto.resource.v1.Resource\x12\x1e\n\x16last_known_fingerprint\x18\x02 \x01(\x0c\"\xe0\x03\n\x14MetricConfigResponse\x12\x13\n\x0b\x66ingerprint\x18\x01 \x01(\x0c\x12Z\n\tschedules\x18\x02 \x03(\x0b\x32G.opentelemetry.proto.metrics.experimental.MetricConfigResponse.Schedule\x12\x1f\n\x17suggested_wait_time_sec\x18\x03 \x01(\x05\x1a\xb5\x02\n\x08Schedule\x12k\n\x12\x65xclusion_patterns\x18\x01 \x03(\x0b\x32O.opentelemetry.proto.metrics.experimental.MetricConfigResponse.Schedule.Pattern\x12k\n\x12inclusion_patterns\x18\x02 \x03(\x0b\x32O.opentelemetry.proto.metrics.experimental.MetricConfigResponse.Schedule.Pattern\x12\x12\n\nperiod_sec\x18\x03 \x01(\x05\x1a;\n\x07Pattern\x12\x10\n\x06\x65quals\x18\x01 \x01(\tH\x00\x12\x15\n\x0bstarts_with\x18\x02 \x01(\tH\x00\x42\x07\n\x05match2\xa1\x01\n\x0cMetricConfig\x12\x90\x01\n\x0fGetMetricConfig\x12=.opentelemetry.proto.metrics.experimental.MetricConfigRequest\x1a>.opentelemetry.proto.metrics.experimental.MetricConfigResponseB\x94\x01\n+io.opentelemetry.proto.metrics.experimentalB\x18MetricConfigServiceProtoP\x01ZIgithub.com/open-telemetry/opentelemetry-proto/gen/go/metrics/experimentalb\x06proto3' - , - dependencies=[opentelemetry_dot_proto_dot_resource_dot_v1_dot_resource__pb2.DESCRIPTOR,]) - - - - -_METRICCONFIGREQUEST = _descriptor.Descriptor( - name='MetricConfigRequest', - full_name='opentelemetry.proto.metrics.experimental.MetricConfigRequest', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='resource', full_name='opentelemetry.proto.metrics.experimental.MetricConfigRequest.resource', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='last_known_fingerprint', full_name='opentelemetry.proto.metrics.experimental.MetricConfigRequest.last_known_fingerprint', index=1, - number=2, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=163, - serialized_end=277, -) - - -_METRICCONFIGRESPONSE_SCHEDULE_PATTERN = _descriptor.Descriptor( - name='Pattern', - full_name='opentelemetry.proto.metrics.experimental.MetricConfigResponse.Schedule.Pattern', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='equals', full_name='opentelemetry.proto.metrics.experimental.MetricConfigResponse.Schedule.Pattern.equals', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='starts_with', full_name='opentelemetry.proto.metrics.experimental.MetricConfigResponse.Schedule.Pattern.starts_with', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name='match', full_name='opentelemetry.proto.metrics.experimental.MetricConfigResponse.Schedule.Pattern.match', - index=0, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), - ], - serialized_start=701, - serialized_end=760, -) - -_METRICCONFIGRESPONSE_SCHEDULE = _descriptor.Descriptor( - name='Schedule', - full_name='opentelemetry.proto.metrics.experimental.MetricConfigResponse.Schedule', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='exclusion_patterns', full_name='opentelemetry.proto.metrics.experimental.MetricConfigResponse.Schedule.exclusion_patterns', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='inclusion_patterns', full_name='opentelemetry.proto.metrics.experimental.MetricConfigResponse.Schedule.inclusion_patterns', index=1, - number=2, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='period_sec', full_name='opentelemetry.proto.metrics.experimental.MetricConfigResponse.Schedule.period_sec', index=2, - number=3, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[_METRICCONFIGRESPONSE_SCHEDULE_PATTERN, ], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=451, - serialized_end=760, -) - -_METRICCONFIGRESPONSE = _descriptor.Descriptor( - name='MetricConfigResponse', - full_name='opentelemetry.proto.metrics.experimental.MetricConfigResponse', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='fingerprint', full_name='opentelemetry.proto.metrics.experimental.MetricConfigResponse.fingerprint', index=0, - number=1, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='schedules', full_name='opentelemetry.proto.metrics.experimental.MetricConfigResponse.schedules', index=1, - number=2, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='suggested_wait_time_sec', full_name='opentelemetry.proto.metrics.experimental.MetricConfigResponse.suggested_wait_time_sec', index=2, - number=3, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[_METRICCONFIGRESPONSE_SCHEDULE, ], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=280, - serialized_end=760, -) - -_METRICCONFIGREQUEST.fields_by_name['resource'].message_type = opentelemetry_dot_proto_dot_resource_dot_v1_dot_resource__pb2._RESOURCE -_METRICCONFIGRESPONSE_SCHEDULE_PATTERN.containing_type = _METRICCONFIGRESPONSE_SCHEDULE -_METRICCONFIGRESPONSE_SCHEDULE_PATTERN.oneofs_by_name['match'].fields.append( - _METRICCONFIGRESPONSE_SCHEDULE_PATTERN.fields_by_name['equals']) -_METRICCONFIGRESPONSE_SCHEDULE_PATTERN.fields_by_name['equals'].containing_oneof = _METRICCONFIGRESPONSE_SCHEDULE_PATTERN.oneofs_by_name['match'] -_METRICCONFIGRESPONSE_SCHEDULE_PATTERN.oneofs_by_name['match'].fields.append( - _METRICCONFIGRESPONSE_SCHEDULE_PATTERN.fields_by_name['starts_with']) -_METRICCONFIGRESPONSE_SCHEDULE_PATTERN.fields_by_name['starts_with'].containing_oneof = _METRICCONFIGRESPONSE_SCHEDULE_PATTERN.oneofs_by_name['match'] -_METRICCONFIGRESPONSE_SCHEDULE.fields_by_name['exclusion_patterns'].message_type = _METRICCONFIGRESPONSE_SCHEDULE_PATTERN -_METRICCONFIGRESPONSE_SCHEDULE.fields_by_name['inclusion_patterns'].message_type = _METRICCONFIGRESPONSE_SCHEDULE_PATTERN -_METRICCONFIGRESPONSE_SCHEDULE.containing_type = _METRICCONFIGRESPONSE -_METRICCONFIGRESPONSE.fields_by_name['schedules'].message_type = _METRICCONFIGRESPONSE_SCHEDULE -DESCRIPTOR.message_types_by_name['MetricConfigRequest'] = _METRICCONFIGREQUEST -DESCRIPTOR.message_types_by_name['MetricConfigResponse'] = _METRICCONFIGRESPONSE -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -MetricConfigRequest = _reflection.GeneratedProtocolMessageType('MetricConfigRequest', (_message.Message,), { - 'DESCRIPTOR' : _METRICCONFIGREQUEST, - '__module__' : 'opentelemetry.proto.metrics.experimental.metrics_config_service_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.metrics.experimental.MetricConfigRequest) - }) -_sym_db.RegisterMessage(MetricConfigRequest) - -MetricConfigResponse = _reflection.GeneratedProtocolMessageType('MetricConfigResponse', (_message.Message,), { - - 'Schedule' : _reflection.GeneratedProtocolMessageType('Schedule', (_message.Message,), { - - 'Pattern' : _reflection.GeneratedProtocolMessageType('Pattern', (_message.Message,), { - 'DESCRIPTOR' : _METRICCONFIGRESPONSE_SCHEDULE_PATTERN, - '__module__' : 'opentelemetry.proto.metrics.experimental.metrics_config_service_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.metrics.experimental.MetricConfigResponse.Schedule.Pattern) - }) - , - 'DESCRIPTOR' : _METRICCONFIGRESPONSE_SCHEDULE, - '__module__' : 'opentelemetry.proto.metrics.experimental.metrics_config_service_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.metrics.experimental.MetricConfigResponse.Schedule) - }) - , - 'DESCRIPTOR' : _METRICCONFIGRESPONSE, - '__module__' : 'opentelemetry.proto.metrics.experimental.metrics_config_service_pb2' - # @@protoc_insertion_point(class_scope:opentelemetry.proto.metrics.experimental.MetricConfigResponse) - }) -_sym_db.RegisterMessage(MetricConfigResponse) -_sym_db.RegisterMessage(MetricConfigResponse.Schedule) -_sym_db.RegisterMessage(MetricConfigResponse.Schedule.Pattern) - - -DESCRIPTOR._options = None - -_METRICCONFIG = _descriptor.ServiceDescriptor( - name='MetricConfig', - full_name='opentelemetry.proto.metrics.experimental.MetricConfig', - file=DESCRIPTOR, - index=0, - serialized_options=None, - create_key=_descriptor._internal_create_key, - serialized_start=763, - serialized_end=924, - methods=[ - _descriptor.MethodDescriptor( - name='GetMetricConfig', - full_name='opentelemetry.proto.metrics.experimental.MetricConfig.GetMetricConfig', - index=0, - containing_service=None, - input_type=_METRICCONFIGREQUEST, - output_type=_METRICCONFIGRESPONSE, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), -]) -_sym_db.RegisterServiceDescriptor(_METRICCONFIG) - -DESCRIPTOR.services_by_name['MetricConfig'] = _METRICCONFIG - -# @@protoc_insertion_point(module_scope) diff --git a/opentelemetry-proto/src/opentelemetry/proto/metrics/experimental/metrics_config_service_pb2.pyi b/opentelemetry-proto/src/opentelemetry/proto/metrics/experimental/metrics_config_service_pb2.pyi deleted file mode 100644 index ee8050802b1..00000000000 --- a/opentelemetry-proto/src/opentelemetry/proto/metrics/experimental/metrics_config_service_pb2.pyi +++ /dev/null @@ -1,136 +0,0 @@ -""" -@generated by mypy-protobuf. Do not edit manually! -isort:skip_file -""" -import builtins -import google.protobuf.descriptor -import google.protobuf.internal.containers -import google.protobuf.message -import opentelemetry.proto.resource.v1.resource_pb2 -import typing -import typing_extensions - -DESCRIPTOR: google.protobuf.descriptor.FileDescriptor = ... - -class MetricConfigRequest(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - RESOURCE_FIELD_NUMBER: builtins.int - LAST_KNOWN_FINGERPRINT_FIELD_NUMBER: builtins.int - @property - def resource(self) -> opentelemetry.proto.resource.v1.resource_pb2.Resource: - """Required. The resource for which configuration should be returned.""" - pass - last_known_fingerprint: builtins.bytes = ... - """Optional. The value of MetricConfigResponse.fingerprint for the last - configuration that the caller received and successfully applied. - """ - - def __init__(self, - *, - resource : typing.Optional[opentelemetry.proto.resource.v1.resource_pb2.Resource] = ..., - last_known_fingerprint : builtins.bytes = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["resource",b"resource"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["last_known_fingerprint",b"last_known_fingerprint","resource",b"resource"]) -> None: ... -global___MetricConfigRequest = MetricConfigRequest - -class MetricConfigResponse(google.protobuf.message.Message): - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - class Schedule(google.protobuf.message.Message): - """A Schedule is used to apply a particular scheduling configuration to - a metric. If a metric name matches a schedule's patterns, then the metric - adopts the configuration specified by the schedule. - """ - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - class Pattern(google.protobuf.message.Message): - """A light-weight pattern that can match 1 or more - metrics, for which this schedule will apply. The string is used to - match against metric names. It should not exceed 100k characters. - """ - DESCRIPTOR: google.protobuf.descriptor.Descriptor = ... - EQUALS_FIELD_NUMBER: builtins.int - STARTS_WITH_FIELD_NUMBER: builtins.int - equals: typing.Text = ... - """matches the metric name exactly""" - - starts_with: typing.Text = ... - """prefix-matches the metric name""" - - def __init__(self, - *, - equals : typing.Text = ..., - starts_with : typing.Text = ..., - ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["equals",b"equals","match",b"match","starts_with",b"starts_with"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["equals",b"equals","match",b"match","starts_with",b"starts_with"]) -> None: ... - def WhichOneof(self, oneof_group: typing_extensions.Literal["match",b"match"]) -> typing.Optional[typing_extensions.Literal["equals","starts_with"]]: ... - - EXCLUSION_PATTERNS_FIELD_NUMBER: builtins.int - INCLUSION_PATTERNS_FIELD_NUMBER: builtins.int - PERIOD_SEC_FIELD_NUMBER: builtins.int - @property - def exclusion_patterns(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___MetricConfigResponse.Schedule.Pattern]: - """Metrics with names that match a rule in the inclusion_patterns are - targeted by this schedule. Metrics that match the exclusion_patterns - are not targeted for this schedule, even if they match an inclusion - pattern. - """ - pass - @property - def inclusion_patterns(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___MetricConfigResponse.Schedule.Pattern]: ... - period_sec: builtins.int = ... - """Describes the collection period for each metric in seconds. - A period of 0 means to not export. - """ - - def __init__(self, - *, - exclusion_patterns : typing.Optional[typing.Iterable[global___MetricConfigResponse.Schedule.Pattern]] = ..., - inclusion_patterns : typing.Optional[typing.Iterable[global___MetricConfigResponse.Schedule.Pattern]] = ..., - period_sec : builtins.int = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["exclusion_patterns",b"exclusion_patterns","inclusion_patterns",b"inclusion_patterns","period_sec",b"period_sec"]) -> None: ... - - FINGERPRINT_FIELD_NUMBER: builtins.int - SCHEDULES_FIELD_NUMBER: builtins.int - SUGGESTED_WAIT_TIME_SEC_FIELD_NUMBER: builtins.int - fingerprint: builtins.bytes = ... - """Optional. The fingerprint associated with this MetricConfigResponse. Each - change in configs yields a different fingerprint. The resource SHOULD copy - this value to MetricConfigRequest.last_known_fingerprint for the next - configuration request. If there are no changes between fingerprint and - MetricConfigRequest.last_known_fingerprint, then all other fields besides - fingerprint in the response are optional, or the same as the last update if - present. - - The exact mechanics of generating the fingerprint is up to the - implementation. However, a fingerprint must be deterministically determined - by the configurations -- the same configuration will generate the same - fingerprint on any instance of an implementation. Hence using a timestamp is - unacceptable, but a deterministic hash is fine. - """ - - @property - def schedules(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___MetricConfigResponse.Schedule]: - """A single metric may match multiple schedules. In such cases, the schedule - that specifies the smallest period is applied. - - Note, for optimization purposes, it is recommended to use as few schedules - as possible to capture all required metric updates. Where you can be - conservative, do take full advantage of the inclusion/exclusion patterns to - capture as much of your targeted metrics. - """ - pass - suggested_wait_time_sec: builtins.int = ... - """Optional. The client is suggested to wait this long (in seconds) before - pinging the configuration service again. - """ - - def __init__(self, - *, - fingerprint : builtins.bytes = ..., - schedules : typing.Optional[typing.Iterable[global___MetricConfigResponse.Schedule]] = ..., - suggested_wait_time_sec : builtins.int = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["fingerprint",b"fingerprint","schedules",b"schedules","suggested_wait_time_sec",b"suggested_wait_time_sec"]) -> None: ... -global___MetricConfigResponse = MetricConfigResponse diff --git a/opentelemetry-proto/src/opentelemetry/proto/metrics/experimental/metrics_config_service_pb2_grpc.py b/opentelemetry-proto/src/opentelemetry/proto/metrics/experimental/metrics_config_service_pb2_grpc.py deleted file mode 100644 index 409ddfa2614..00000000000 --- a/opentelemetry-proto/src/opentelemetry/proto/metrics/experimental/metrics_config_service_pb2_grpc.py +++ /dev/null @@ -1,84 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc - -from opentelemetry.proto.metrics.experimental import metrics_config_service_pb2 as opentelemetry_dot_proto_dot_metrics_dot_experimental_dot_metrics__config__service__pb2 - - -class MetricConfigStub(object): - """MetricConfig is a service that enables updating metric schedules, trace - parameters, and other configurations on the SDK without having to restart the - instrumented application. The collector can also serve as the configuration - service, acting as a bridge between third-party configuration services and - the SDK, piping updated configs from a third-party source to an instrumented - application. - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.GetMetricConfig = channel.unary_unary( - '/opentelemetry.proto.metrics.experimental.MetricConfig/GetMetricConfig', - request_serializer=opentelemetry_dot_proto_dot_metrics_dot_experimental_dot_metrics__config__service__pb2.MetricConfigRequest.SerializeToString, - response_deserializer=opentelemetry_dot_proto_dot_metrics_dot_experimental_dot_metrics__config__service__pb2.MetricConfigResponse.FromString, - ) - - -class MetricConfigServicer(object): - """MetricConfig is a service that enables updating metric schedules, trace - parameters, and other configurations on the SDK without having to restart the - instrumented application. The collector can also serve as the configuration - service, acting as a bridge between third-party configuration services and - the SDK, piping updated configs from a third-party source to an instrumented - application. - """ - - def GetMetricConfig(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - -def add_MetricConfigServicer_to_server(servicer, server): - rpc_method_handlers = { - 'GetMetricConfig': grpc.unary_unary_rpc_method_handler( - servicer.GetMetricConfig, - request_deserializer=opentelemetry_dot_proto_dot_metrics_dot_experimental_dot_metrics__config__service__pb2.MetricConfigRequest.FromString, - response_serializer=opentelemetry_dot_proto_dot_metrics_dot_experimental_dot_metrics__config__service__pb2.MetricConfigResponse.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - 'opentelemetry.proto.metrics.experimental.MetricConfig', rpc_method_handlers) - server.add_generic_rpc_handlers((generic_handler,)) - - - # This class is part of an EXPERIMENTAL API. -class MetricConfig(object): - """MetricConfig is a service that enables updating metric schedules, trace - parameters, and other configurations on the SDK without having to restart the - instrumented application. The collector can also serve as the configuration - service, acting as a bridge between third-party configuration services and - the SDK, piping updated configs from a third-party source to an instrumented - application. - """ - - @staticmethod - def GetMetricConfig(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/opentelemetry.proto.metrics.experimental.MetricConfig/GetMetricConfig', - opentelemetry_dot_proto_dot_metrics_dot_experimental_dot_metrics__config__service__pb2.MetricConfigRequest.SerializeToString, - opentelemetry_dot_proto_dot_metrics_dot_experimental_dot_metrics__config__service__pb2.MetricConfigResponse.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/opentelemetry-proto/src/opentelemetry/proto/metrics/v1/metrics_pb2.py b/opentelemetry-proto/src/opentelemetry/proto/metrics/v1/metrics_pb2.py index a64e29d6738..e94d087a454 100644 --- a/opentelemetry-proto/src/opentelemetry/proto/metrics/v1/metrics_pb2.py +++ b/opentelemetry-proto/src/opentelemetry/proto/metrics/v1/metrics_pb2.py @@ -4,6 +4,7 @@ """Generated protocol buffer code.""" from google.protobuf.internal import enum_type_wrapper from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database @@ -16,72 +17,11 @@ from opentelemetry.proto.resource.v1 import resource_pb2 as opentelemetry_dot_proto_dot_resource_dot_v1_dot_resource__pb2 -DESCRIPTOR = _descriptor.FileDescriptor( - name='opentelemetry/proto/metrics/v1/metrics.proto', - package='opentelemetry.proto.metrics.v1', - syntax='proto3', - serialized_options=b'\n!io.opentelemetry.proto.metrics.v1B\014MetricsProtoP\001Z)go.opentelemetry.io/proto/otlp/metrics/v1', - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n,opentelemetry/proto/metrics/v1/metrics.proto\x12\x1eopentelemetry.proto.metrics.v1\x1a*opentelemetry/proto/common/v1/common.proto\x1a.opentelemetry/proto/resource/v1/resource.proto\"X\n\x0bMetricsData\x12I\n\x10resource_metrics\x18\x01 \x03(\x0b\x32/.opentelemetry.proto.metrics.v1.ResourceMetrics\"\x94\x02\n\x0fResourceMetrics\x12;\n\x08resource\x18\x01 \x01(\x0b\x32).opentelemetry.proto.resource.v1.Resource\x12\x43\n\rscope_metrics\x18\x02 \x03(\x0b\x32,.opentelemetry.proto.metrics.v1.ScopeMetrics\x12k\n\x1finstrumentation_library_metrics\x18\xe8\x07 \x03(\x0b\x32=.opentelemetry.proto.metrics.v1.InstrumentationLibraryMetricsB\x02\x18\x01\x12\x12\n\nschema_url\x18\x03 \x01(\t\"\x9f\x01\n\x0cScopeMetrics\x12\x42\n\x05scope\x18\x01 \x01(\x0b\x32\x33.opentelemetry.proto.common.v1.InstrumentationScope\x12\x37\n\x07metrics\x18\x02 \x03(\x0b\x32&.opentelemetry.proto.metrics.v1.Metric\x12\x12\n\nschema_url\x18\x03 \x01(\t\"\xc8\x01\n\x1dInstrumentationLibraryMetrics\x12V\n\x17instrumentation_library\x18\x01 \x01(\x0b\x32\x35.opentelemetry.proto.common.v1.InstrumentationLibrary\x12\x37\n\x07metrics\x18\x02 \x03(\x0b\x32&.opentelemetry.proto.metrics.v1.Metric\x12\x12\n\nschema_url\x18\x03 \x01(\t:\x02\x18\x01\"\x92\x03\n\x06Metric\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12\x0c\n\x04unit\x18\x03 \x01(\t\x12\x36\n\x05gauge\x18\x05 \x01(\x0b\x32%.opentelemetry.proto.metrics.v1.GaugeH\x00\x12\x32\n\x03sum\x18\x07 \x01(\x0b\x32#.opentelemetry.proto.metrics.v1.SumH\x00\x12>\n\thistogram\x18\t \x01(\x0b\x32).opentelemetry.proto.metrics.v1.HistogramH\x00\x12U\n\x15\x65xponential_histogram\x18\n \x01(\x0b\x32\x34.opentelemetry.proto.metrics.v1.ExponentialHistogramH\x00\x12:\n\x07summary\x18\x0b \x01(\x0b\x32\'.opentelemetry.proto.metrics.v1.SummaryH\x00\x42\x06\n\x04\x64\x61taJ\x04\x08\x04\x10\x05J\x04\x08\x06\x10\x07J\x04\x08\x08\x10\t\"M\n\x05Gauge\x12\x44\n\x0b\x64\x61ta_points\x18\x01 \x03(\x0b\x32/.opentelemetry.proto.metrics.v1.NumberDataPoint\"\xba\x01\n\x03Sum\x12\x44\n\x0b\x64\x61ta_points\x18\x01 \x03(\x0b\x32/.opentelemetry.proto.metrics.v1.NumberDataPoint\x12W\n\x17\x61ggregation_temporality\x18\x02 \x01(\x0e\x32\x36.opentelemetry.proto.metrics.v1.AggregationTemporality\x12\x14\n\x0cis_monotonic\x18\x03 \x01(\x08\"\xad\x01\n\tHistogram\x12G\n\x0b\x64\x61ta_points\x18\x01 \x03(\x0b\x32\x32.opentelemetry.proto.metrics.v1.HistogramDataPoint\x12W\n\x17\x61ggregation_temporality\x18\x02 \x01(\x0e\x32\x36.opentelemetry.proto.metrics.v1.AggregationTemporality\"\xc3\x01\n\x14\x45xponentialHistogram\x12R\n\x0b\x64\x61ta_points\x18\x01 \x03(\x0b\x32=.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint\x12W\n\x17\x61ggregation_temporality\x18\x02 \x01(\x0e\x32\x36.opentelemetry.proto.metrics.v1.AggregationTemporality\"P\n\x07Summary\x12\x45\n\x0b\x64\x61ta_points\x18\x01 \x03(\x0b\x32\x30.opentelemetry.proto.metrics.v1.SummaryDataPoint\"\x86\x02\n\x0fNumberDataPoint\x12;\n\nattributes\x18\x07 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12\x1c\n\x14start_time_unix_nano\x18\x02 \x01(\x06\x12\x16\n\x0etime_unix_nano\x18\x03 \x01(\x06\x12\x13\n\tas_double\x18\x04 \x01(\x01H\x00\x12\x10\n\x06\x61s_int\x18\x06 \x01(\x10H\x00\x12;\n\texemplars\x18\x05 \x03(\x0b\x32(.opentelemetry.proto.metrics.v1.Exemplar\x12\r\n\x05\x66lags\x18\x08 \x01(\rB\x07\n\x05valueJ\x04\x08\x01\x10\x02\"\xe6\x02\n\x12HistogramDataPoint\x12;\n\nattributes\x18\t \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12\x1c\n\x14start_time_unix_nano\x18\x02 \x01(\x06\x12\x16\n\x0etime_unix_nano\x18\x03 \x01(\x06\x12\r\n\x05\x63ount\x18\x04 \x01(\x06\x12\x10\n\x03sum\x18\x05 \x01(\x01H\x00\x88\x01\x01\x12\x15\n\rbucket_counts\x18\x06 \x03(\x06\x12\x17\n\x0f\x65xplicit_bounds\x18\x07 \x03(\x01\x12;\n\texemplars\x18\x08 \x03(\x0b\x32(.opentelemetry.proto.metrics.v1.Exemplar\x12\r\n\x05\x66lags\x18\n \x01(\r\x12\x10\n\x03min\x18\x0b \x01(\x01H\x01\x88\x01\x01\x12\x10\n\x03max\x18\x0c \x01(\x01H\x02\x88\x01\x01\x42\x06\n\x04_sumB\x06\n\x04_minB\x06\n\x04_maxJ\x04\x08\x01\x10\x02\"\xb5\x04\n\x1d\x45xponentialHistogramDataPoint\x12;\n\nattributes\x18\x01 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12\x1c\n\x14start_time_unix_nano\x18\x02 \x01(\x06\x12\x16\n\x0etime_unix_nano\x18\x03 \x01(\x06\x12\r\n\x05\x63ount\x18\x04 \x01(\x06\x12\x0b\n\x03sum\x18\x05 \x01(\x01\x12\r\n\x05scale\x18\x06 \x01(\x11\x12\x12\n\nzero_count\x18\x07 \x01(\x06\x12W\n\x08positive\x18\x08 \x01(\x0b\x32\x45.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets\x12W\n\x08negative\x18\t \x01(\x0b\x32\x45.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets\x12\r\n\x05\x66lags\x18\n \x01(\r\x12;\n\texemplars\x18\x0b \x03(\x0b\x32(.opentelemetry.proto.metrics.v1.Exemplar\x12\x10\n\x03min\x18\x0c \x01(\x01H\x00\x88\x01\x01\x12\x10\n\x03max\x18\r \x01(\x01H\x01\x88\x01\x01\x1a\x30\n\x07\x42uckets\x12\x0e\n\x06offset\x18\x01 \x01(\x11\x12\x15\n\rbucket_counts\x18\x02 \x03(\x04\x42\x06\n\x04_minB\x06\n\x04_max\"\xc5\x02\n\x10SummaryDataPoint\x12;\n\nattributes\x18\x07 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12\x1c\n\x14start_time_unix_nano\x18\x02 \x01(\x06\x12\x16\n\x0etime_unix_nano\x18\x03 \x01(\x06\x12\r\n\x05\x63ount\x18\x04 \x01(\x06\x12\x0b\n\x03sum\x18\x05 \x01(\x01\x12Y\n\x0fquantile_values\x18\x06 \x03(\x0b\x32@.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile\x12\r\n\x05\x66lags\x18\x08 \x01(\r\x1a\x32\n\x0fValueAtQuantile\x12\x10\n\x08quantile\x18\x01 \x01(\x01\x12\r\n\x05value\x18\x02 \x01(\x01J\x04\x08\x01\x10\x02\"\xc1\x01\n\x08\x45xemplar\x12\x44\n\x13\x66iltered_attributes\x18\x07 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12\x16\n\x0etime_unix_nano\x18\x02 \x01(\x06\x12\x13\n\tas_double\x18\x03 \x01(\x01H\x00\x12\x10\n\x06\x61s_int\x18\x06 \x01(\x10H\x00\x12\x0f\n\x07span_id\x18\x04 \x01(\x0c\x12\x10\n\x08trace_id\x18\x05 \x01(\x0c\x42\x07\n\x05valueJ\x04\x08\x01\x10\x02*\x8c\x01\n\x16\x41ggregationTemporality\x12\'\n#AGGREGATION_TEMPORALITY_UNSPECIFIED\x10\x00\x12!\n\x1d\x41GGREGATION_TEMPORALITY_DELTA\x10\x01\x12&\n\"AGGREGATION_TEMPORALITY_CUMULATIVE\x10\x02*;\n\x0e\x44\x61taPointFlags\x12\r\n\tFLAG_NONE\x10\x00\x12\x1a\n\x16\x46LAG_NO_RECORDED_VALUE\x10\x01\x42^\n!io.opentelemetry.proto.metrics.v1B\x0cMetricsProtoP\x01Z)go.opentelemetry.io/proto/otlp/metrics/v1b\x06proto3' - , - dependencies=[opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2.DESCRIPTOR,opentelemetry_dot_proto_dot_resource_dot_v1_dot_resource__pb2.DESCRIPTOR,]) - -_AGGREGATIONTEMPORALITY = _descriptor.EnumDescriptor( - name='AggregationTemporality', - full_name='opentelemetry.proto.metrics.v1.AggregationTemporality', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='AGGREGATION_TEMPORALITY_UNSPECIFIED', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='AGGREGATION_TEMPORALITY_DELTA', index=1, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='AGGREGATION_TEMPORALITY_CUMULATIVE', index=2, number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - serialized_start=3754, - serialized_end=3894, -) -_sym_db.RegisterEnumDescriptor(_AGGREGATIONTEMPORALITY) +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n,opentelemetry/proto/metrics/v1/metrics.proto\x12\x1eopentelemetry.proto.metrics.v1\x1a*opentelemetry/proto/common/v1/common.proto\x1a.opentelemetry/proto/resource/v1/resource.proto\"X\n\x0bMetricsData\x12I\n\x10resource_metrics\x18\x01 \x03(\x0b\x32/.opentelemetry.proto.metrics.v1.ResourceMetrics\"\x94\x02\n\x0fResourceMetrics\x12;\n\x08resource\x18\x01 \x01(\x0b\x32).opentelemetry.proto.resource.v1.Resource\x12\x43\n\rscope_metrics\x18\x02 \x03(\x0b\x32,.opentelemetry.proto.metrics.v1.ScopeMetrics\x12k\n\x1finstrumentation_library_metrics\x18\xe8\x07 \x03(\x0b\x32=.opentelemetry.proto.metrics.v1.InstrumentationLibraryMetricsB\x02\x18\x01\x12\x12\n\nschema_url\x18\x03 \x01(\t\"\x9f\x01\n\x0cScopeMetrics\x12\x42\n\x05scope\x18\x01 \x01(\x0b\x32\x33.opentelemetry.proto.common.v1.InstrumentationScope\x12\x37\n\x07metrics\x18\x02 \x03(\x0b\x32&.opentelemetry.proto.metrics.v1.Metric\x12\x12\n\nschema_url\x18\x03 \x01(\t\"\xc8\x01\n\x1dInstrumentationLibraryMetrics\x12V\n\x17instrumentation_library\x18\x01 \x01(\x0b\x32\x35.opentelemetry.proto.common.v1.InstrumentationLibrary\x12\x37\n\x07metrics\x18\x02 \x03(\x0b\x32&.opentelemetry.proto.metrics.v1.Metric\x12\x12\n\nschema_url\x18\x03 \x01(\t:\x02\x18\x01\"\x92\x03\n\x06Metric\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12\x0c\n\x04unit\x18\x03 \x01(\t\x12\x36\n\x05gauge\x18\x05 \x01(\x0b\x32%.opentelemetry.proto.metrics.v1.GaugeH\x00\x12\x32\n\x03sum\x18\x07 \x01(\x0b\x32#.opentelemetry.proto.metrics.v1.SumH\x00\x12>\n\thistogram\x18\t \x01(\x0b\x32).opentelemetry.proto.metrics.v1.HistogramH\x00\x12U\n\x15\x65xponential_histogram\x18\n \x01(\x0b\x32\x34.opentelemetry.proto.metrics.v1.ExponentialHistogramH\x00\x12:\n\x07summary\x18\x0b \x01(\x0b\x32\'.opentelemetry.proto.metrics.v1.SummaryH\x00\x42\x06\n\x04\x64\x61taJ\x04\x08\x04\x10\x05J\x04\x08\x06\x10\x07J\x04\x08\x08\x10\t\"M\n\x05Gauge\x12\x44\n\x0b\x64\x61ta_points\x18\x01 \x03(\x0b\x32/.opentelemetry.proto.metrics.v1.NumberDataPoint\"\xba\x01\n\x03Sum\x12\x44\n\x0b\x64\x61ta_points\x18\x01 \x03(\x0b\x32/.opentelemetry.proto.metrics.v1.NumberDataPoint\x12W\n\x17\x61ggregation_temporality\x18\x02 \x01(\x0e\x32\x36.opentelemetry.proto.metrics.v1.AggregationTemporality\x12\x14\n\x0cis_monotonic\x18\x03 \x01(\x08\"\xad\x01\n\tHistogram\x12G\n\x0b\x64\x61ta_points\x18\x01 \x03(\x0b\x32\x32.opentelemetry.proto.metrics.v1.HistogramDataPoint\x12W\n\x17\x61ggregation_temporality\x18\x02 \x01(\x0e\x32\x36.opentelemetry.proto.metrics.v1.AggregationTemporality\"\xc3\x01\n\x14\x45xponentialHistogram\x12R\n\x0b\x64\x61ta_points\x18\x01 \x03(\x0b\x32=.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint\x12W\n\x17\x61ggregation_temporality\x18\x02 \x01(\x0e\x32\x36.opentelemetry.proto.metrics.v1.AggregationTemporality\"P\n\x07Summary\x12\x45\n\x0b\x64\x61ta_points\x18\x01 \x03(\x0b\x32\x30.opentelemetry.proto.metrics.v1.SummaryDataPoint\"\x86\x02\n\x0fNumberDataPoint\x12;\n\nattributes\x18\x07 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12\x1c\n\x14start_time_unix_nano\x18\x02 \x01(\x06\x12\x16\n\x0etime_unix_nano\x18\x03 \x01(\x06\x12\x13\n\tas_double\x18\x04 \x01(\x01H\x00\x12\x10\n\x06\x61s_int\x18\x06 \x01(\x10H\x00\x12;\n\texemplars\x18\x05 \x03(\x0b\x32(.opentelemetry.proto.metrics.v1.Exemplar\x12\r\n\x05\x66lags\x18\x08 \x01(\rB\x07\n\x05valueJ\x04\x08\x01\x10\x02\"\xe6\x02\n\x12HistogramDataPoint\x12;\n\nattributes\x18\t \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12\x1c\n\x14start_time_unix_nano\x18\x02 \x01(\x06\x12\x16\n\x0etime_unix_nano\x18\x03 \x01(\x06\x12\r\n\x05\x63ount\x18\x04 \x01(\x06\x12\x10\n\x03sum\x18\x05 \x01(\x01H\x00\x88\x01\x01\x12\x15\n\rbucket_counts\x18\x06 \x03(\x06\x12\x17\n\x0f\x65xplicit_bounds\x18\x07 \x03(\x01\x12;\n\texemplars\x18\x08 \x03(\x0b\x32(.opentelemetry.proto.metrics.v1.Exemplar\x12\r\n\x05\x66lags\x18\n \x01(\r\x12\x10\n\x03min\x18\x0b \x01(\x01H\x01\x88\x01\x01\x12\x10\n\x03max\x18\x0c \x01(\x01H\x02\x88\x01\x01\x42\x06\n\x04_sumB\x06\n\x04_minB\x06\n\x04_maxJ\x04\x08\x01\x10\x02\"\xb5\x04\n\x1d\x45xponentialHistogramDataPoint\x12;\n\nattributes\x18\x01 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12\x1c\n\x14start_time_unix_nano\x18\x02 \x01(\x06\x12\x16\n\x0etime_unix_nano\x18\x03 \x01(\x06\x12\r\n\x05\x63ount\x18\x04 \x01(\x06\x12\x0b\n\x03sum\x18\x05 \x01(\x01\x12\r\n\x05scale\x18\x06 \x01(\x11\x12\x12\n\nzero_count\x18\x07 \x01(\x06\x12W\n\x08positive\x18\x08 \x01(\x0b\x32\x45.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets\x12W\n\x08negative\x18\t \x01(\x0b\x32\x45.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets\x12\r\n\x05\x66lags\x18\n \x01(\r\x12;\n\texemplars\x18\x0b \x03(\x0b\x32(.opentelemetry.proto.metrics.v1.Exemplar\x12\x10\n\x03min\x18\x0c \x01(\x01H\x00\x88\x01\x01\x12\x10\n\x03max\x18\r \x01(\x01H\x01\x88\x01\x01\x1a\x30\n\x07\x42uckets\x12\x0e\n\x06offset\x18\x01 \x01(\x11\x12\x15\n\rbucket_counts\x18\x02 \x03(\x04\x42\x06\n\x04_minB\x06\n\x04_max\"\xc5\x02\n\x10SummaryDataPoint\x12;\n\nattributes\x18\x07 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12\x1c\n\x14start_time_unix_nano\x18\x02 \x01(\x06\x12\x16\n\x0etime_unix_nano\x18\x03 \x01(\x06\x12\r\n\x05\x63ount\x18\x04 \x01(\x06\x12\x0b\n\x03sum\x18\x05 \x01(\x01\x12Y\n\x0fquantile_values\x18\x06 \x03(\x0b\x32@.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile\x12\r\n\x05\x66lags\x18\x08 \x01(\r\x1a\x32\n\x0fValueAtQuantile\x12\x10\n\x08quantile\x18\x01 \x01(\x01\x12\r\n\x05value\x18\x02 \x01(\x01J\x04\x08\x01\x10\x02\"\xc1\x01\n\x08\x45xemplar\x12\x44\n\x13\x66iltered_attributes\x18\x07 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12\x16\n\x0etime_unix_nano\x18\x02 \x01(\x06\x12\x13\n\tas_double\x18\x03 \x01(\x01H\x00\x12\x10\n\x06\x61s_int\x18\x06 \x01(\x10H\x00\x12\x0f\n\x07span_id\x18\x04 \x01(\x0c\x12\x10\n\x08trace_id\x18\x05 \x01(\x0c\x42\x07\n\x05valueJ\x04\x08\x01\x10\x02*\x8c\x01\n\x16\x41ggregationTemporality\x12\'\n#AGGREGATION_TEMPORALITY_UNSPECIFIED\x10\x00\x12!\n\x1d\x41GGREGATION_TEMPORALITY_DELTA\x10\x01\x12&\n\"AGGREGATION_TEMPORALITY_CUMULATIVE\x10\x02*;\n\x0e\x44\x61taPointFlags\x12\r\n\tFLAG_NONE\x10\x00\x12\x1a\n\x16\x46LAG_NO_RECORDED_VALUE\x10\x01\x42^\n!io.opentelemetry.proto.metrics.v1B\x0cMetricsProtoP\x01Z)go.opentelemetry.io/proto/otlp/metrics/v1b\x06proto3') +_AGGREGATIONTEMPORALITY = DESCRIPTOR.enum_types_by_name['AggregationTemporality'] AggregationTemporality = enum_type_wrapper.EnumTypeWrapper(_AGGREGATIONTEMPORALITY) -_DATAPOINTFLAGS = _descriptor.EnumDescriptor( - name='DataPointFlags', - full_name='opentelemetry.proto.metrics.v1.DataPointFlags', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='FLAG_NONE', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='FLAG_NO_RECORDED_VALUE', index=1, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - serialized_start=3896, - serialized_end=3955, -) -_sym_db.RegisterEnumDescriptor(_DATAPOINTFLAGS) - +_DATAPOINTFLAGS = DESCRIPTOR.enum_types_by_name['DataPointFlags'] DataPointFlags = enum_type_wrapper.EnumTypeWrapper(_DATAPOINTFLAGS) AGGREGATION_TEMPORALITY_UNSPECIFIED = 0 AGGREGATION_TEMPORALITY_DELTA = 1 @@ -90,1096 +30,23 @@ FLAG_NO_RECORDED_VALUE = 1 - -_METRICSDATA = _descriptor.Descriptor( - name='MetricsData', - full_name='opentelemetry.proto.metrics.v1.MetricsData', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='resource_metrics', full_name='opentelemetry.proto.metrics.v1.MetricsData.resource_metrics', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=172, - serialized_end=260, -) - - -_RESOURCEMETRICS = _descriptor.Descriptor( - name='ResourceMetrics', - full_name='opentelemetry.proto.metrics.v1.ResourceMetrics', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='resource', full_name='opentelemetry.proto.metrics.v1.ResourceMetrics.resource', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='scope_metrics', full_name='opentelemetry.proto.metrics.v1.ResourceMetrics.scope_metrics', index=1, - number=2, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='instrumentation_library_metrics', full_name='opentelemetry.proto.metrics.v1.ResourceMetrics.instrumentation_library_metrics', index=2, - number=1000, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=b'\030\001', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='schema_url', full_name='opentelemetry.proto.metrics.v1.ResourceMetrics.schema_url', index=3, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=263, - serialized_end=539, -) - - -_SCOPEMETRICS = _descriptor.Descriptor( - name='ScopeMetrics', - full_name='opentelemetry.proto.metrics.v1.ScopeMetrics', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='scope', full_name='opentelemetry.proto.metrics.v1.ScopeMetrics.scope', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='metrics', full_name='opentelemetry.proto.metrics.v1.ScopeMetrics.metrics', index=1, - number=2, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='schema_url', full_name='opentelemetry.proto.metrics.v1.ScopeMetrics.schema_url', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=542, - serialized_end=701, -) - - -_INSTRUMENTATIONLIBRARYMETRICS = _descriptor.Descriptor( - name='InstrumentationLibraryMetrics', - full_name='opentelemetry.proto.metrics.v1.InstrumentationLibraryMetrics', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='instrumentation_library', full_name='opentelemetry.proto.metrics.v1.InstrumentationLibraryMetrics.instrumentation_library', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='metrics', full_name='opentelemetry.proto.metrics.v1.InstrumentationLibraryMetrics.metrics', index=1, - number=2, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='schema_url', full_name='opentelemetry.proto.metrics.v1.InstrumentationLibraryMetrics.schema_url', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=b'\030\001', - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=704, - serialized_end=904, -) - - -_METRIC = _descriptor.Descriptor( - name='Metric', - full_name='opentelemetry.proto.metrics.v1.Metric', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='name', full_name='opentelemetry.proto.metrics.v1.Metric.name', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='description', full_name='opentelemetry.proto.metrics.v1.Metric.description', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='unit', full_name='opentelemetry.proto.metrics.v1.Metric.unit', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='gauge', full_name='opentelemetry.proto.metrics.v1.Metric.gauge', index=3, - number=5, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='sum', full_name='opentelemetry.proto.metrics.v1.Metric.sum', index=4, - number=7, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='histogram', full_name='opentelemetry.proto.metrics.v1.Metric.histogram', index=5, - number=9, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='exponential_histogram', full_name='opentelemetry.proto.metrics.v1.Metric.exponential_histogram', index=6, - number=10, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='summary', full_name='opentelemetry.proto.metrics.v1.Metric.summary', index=7, - number=11, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name='data', full_name='opentelemetry.proto.metrics.v1.Metric.data', - index=0, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), - ], - serialized_start=907, - serialized_end=1309, -) - - -_GAUGE = _descriptor.Descriptor( - name='Gauge', - full_name='opentelemetry.proto.metrics.v1.Gauge', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='data_points', full_name='opentelemetry.proto.metrics.v1.Gauge.data_points', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1311, - serialized_end=1388, -) - - -_SUM = _descriptor.Descriptor( - name='Sum', - full_name='opentelemetry.proto.metrics.v1.Sum', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='data_points', full_name='opentelemetry.proto.metrics.v1.Sum.data_points', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='aggregation_temporality', full_name='opentelemetry.proto.metrics.v1.Sum.aggregation_temporality', index=1, - number=2, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='is_monotonic', full_name='opentelemetry.proto.metrics.v1.Sum.is_monotonic', index=2, - number=3, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1391, - serialized_end=1577, -) - - -_HISTOGRAM = _descriptor.Descriptor( - name='Histogram', - full_name='opentelemetry.proto.metrics.v1.Histogram', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='data_points', full_name='opentelemetry.proto.metrics.v1.Histogram.data_points', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='aggregation_temporality', full_name='opentelemetry.proto.metrics.v1.Histogram.aggregation_temporality', index=1, - number=2, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1580, - serialized_end=1753, -) - - -_EXPONENTIALHISTOGRAM = _descriptor.Descriptor( - name='ExponentialHistogram', - full_name='opentelemetry.proto.metrics.v1.ExponentialHistogram', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='data_points', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogram.data_points', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='aggregation_temporality', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogram.aggregation_temporality', index=1, - number=2, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1756, - serialized_end=1951, -) - - -_SUMMARY = _descriptor.Descriptor( - name='Summary', - full_name='opentelemetry.proto.metrics.v1.Summary', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='data_points', full_name='opentelemetry.proto.metrics.v1.Summary.data_points', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1953, - serialized_end=2033, -) - - -_NUMBERDATAPOINT = _descriptor.Descriptor( - name='NumberDataPoint', - full_name='opentelemetry.proto.metrics.v1.NumberDataPoint', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='attributes', full_name='opentelemetry.proto.metrics.v1.NumberDataPoint.attributes', index=0, - number=7, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='start_time_unix_nano', full_name='opentelemetry.proto.metrics.v1.NumberDataPoint.start_time_unix_nano', index=1, - number=2, type=6, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='time_unix_nano', full_name='opentelemetry.proto.metrics.v1.NumberDataPoint.time_unix_nano', index=2, - number=3, type=6, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='as_double', full_name='opentelemetry.proto.metrics.v1.NumberDataPoint.as_double', index=3, - number=4, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=float(0), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='as_int', full_name='opentelemetry.proto.metrics.v1.NumberDataPoint.as_int', index=4, - number=6, type=16, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='exemplars', full_name='opentelemetry.proto.metrics.v1.NumberDataPoint.exemplars', index=5, - number=5, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='flags', full_name='opentelemetry.proto.metrics.v1.NumberDataPoint.flags', index=6, - number=8, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name='value', full_name='opentelemetry.proto.metrics.v1.NumberDataPoint.value', - index=0, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), - ], - serialized_start=2036, - serialized_end=2298, -) - - -_HISTOGRAMDATAPOINT = _descriptor.Descriptor( - name='HistogramDataPoint', - full_name='opentelemetry.proto.metrics.v1.HistogramDataPoint', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='attributes', full_name='opentelemetry.proto.metrics.v1.HistogramDataPoint.attributes', index=0, - number=9, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='start_time_unix_nano', full_name='opentelemetry.proto.metrics.v1.HistogramDataPoint.start_time_unix_nano', index=1, - number=2, type=6, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='time_unix_nano', full_name='opentelemetry.proto.metrics.v1.HistogramDataPoint.time_unix_nano', index=2, - number=3, type=6, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='count', full_name='opentelemetry.proto.metrics.v1.HistogramDataPoint.count', index=3, - number=4, type=6, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='sum', full_name='opentelemetry.proto.metrics.v1.HistogramDataPoint.sum', index=4, - number=5, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=float(0), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='bucket_counts', full_name='opentelemetry.proto.metrics.v1.HistogramDataPoint.bucket_counts', index=5, - number=6, type=6, cpp_type=4, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='explicit_bounds', full_name='opentelemetry.proto.metrics.v1.HistogramDataPoint.explicit_bounds', index=6, - number=7, type=1, cpp_type=5, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='exemplars', full_name='opentelemetry.proto.metrics.v1.HistogramDataPoint.exemplars', index=7, - number=8, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='flags', full_name='opentelemetry.proto.metrics.v1.HistogramDataPoint.flags', index=8, - number=10, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='min', full_name='opentelemetry.proto.metrics.v1.HistogramDataPoint.min', index=9, - number=11, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=float(0), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='max', full_name='opentelemetry.proto.metrics.v1.HistogramDataPoint.max', index=10, - number=12, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=float(0), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name='_sum', full_name='opentelemetry.proto.metrics.v1.HistogramDataPoint._sum', - index=0, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), - _descriptor.OneofDescriptor( - name='_min', full_name='opentelemetry.proto.metrics.v1.HistogramDataPoint._min', - index=1, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), - _descriptor.OneofDescriptor( - name='_max', full_name='opentelemetry.proto.metrics.v1.HistogramDataPoint._max', - index=2, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), - ], - serialized_start=2301, - serialized_end=2659, -) - - -_EXPONENTIALHISTOGRAMDATAPOINT_BUCKETS = _descriptor.Descriptor( - name='Buckets', - full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='offset', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.offset', index=0, - number=1, type=17, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='bucket_counts', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.bucket_counts', index=1, - number=2, type=4, cpp_type=4, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=3163, - serialized_end=3211, -) - -_EXPONENTIALHISTOGRAMDATAPOINT = _descriptor.Descriptor( - name='ExponentialHistogramDataPoint', - full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='attributes', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.attributes', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='start_time_unix_nano', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.start_time_unix_nano', index=1, - number=2, type=6, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='time_unix_nano', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.time_unix_nano', index=2, - number=3, type=6, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='count', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.count', index=3, - number=4, type=6, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='sum', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.sum', index=4, - number=5, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=float(0), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='scale', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.scale', index=5, - number=6, type=17, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='zero_count', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.zero_count', index=6, - number=7, type=6, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='positive', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.positive', index=7, - number=8, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='negative', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.negative', index=8, - number=9, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='flags', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.flags', index=9, - number=10, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='exemplars', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.exemplars', index=10, - number=11, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='min', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.min', index=11, - number=12, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=float(0), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='max', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.max', index=12, - number=13, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=float(0), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[_EXPONENTIALHISTOGRAMDATAPOINT_BUCKETS, ], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name='_min', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint._min', - index=0, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), - _descriptor.OneofDescriptor( - name='_max', full_name='opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint._max', - index=1, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), - ], - serialized_start=2662, - serialized_end=3227, -) - - -_SUMMARYDATAPOINT_VALUEATQUANTILE = _descriptor.Descriptor( - name='ValueAtQuantile', - full_name='opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='quantile', full_name='opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.quantile', index=0, - number=1, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=float(0), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='value', full_name='opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.value', index=1, - number=2, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=float(0), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=3499, - serialized_end=3549, -) - -_SUMMARYDATAPOINT = _descriptor.Descriptor( - name='SummaryDataPoint', - full_name='opentelemetry.proto.metrics.v1.SummaryDataPoint', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='attributes', full_name='opentelemetry.proto.metrics.v1.SummaryDataPoint.attributes', index=0, - number=7, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='start_time_unix_nano', full_name='opentelemetry.proto.metrics.v1.SummaryDataPoint.start_time_unix_nano', index=1, - number=2, type=6, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='time_unix_nano', full_name='opentelemetry.proto.metrics.v1.SummaryDataPoint.time_unix_nano', index=2, - number=3, type=6, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='count', full_name='opentelemetry.proto.metrics.v1.SummaryDataPoint.count', index=3, - number=4, type=6, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='sum', full_name='opentelemetry.proto.metrics.v1.SummaryDataPoint.sum', index=4, - number=5, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=float(0), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='quantile_values', full_name='opentelemetry.proto.metrics.v1.SummaryDataPoint.quantile_values', index=5, - number=6, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='flags', full_name='opentelemetry.proto.metrics.v1.SummaryDataPoint.flags', index=6, - number=8, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[_SUMMARYDATAPOINT_VALUEATQUANTILE, ], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=3230, - serialized_end=3555, -) - - -_EXEMPLAR = _descriptor.Descriptor( - name='Exemplar', - full_name='opentelemetry.proto.metrics.v1.Exemplar', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='filtered_attributes', full_name='opentelemetry.proto.metrics.v1.Exemplar.filtered_attributes', index=0, - number=7, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='time_unix_nano', full_name='opentelemetry.proto.metrics.v1.Exemplar.time_unix_nano', index=1, - number=2, type=6, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='as_double', full_name='opentelemetry.proto.metrics.v1.Exemplar.as_double', index=2, - number=3, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=float(0), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='as_int', full_name='opentelemetry.proto.metrics.v1.Exemplar.as_int', index=3, - number=6, type=16, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='span_id', full_name='opentelemetry.proto.metrics.v1.Exemplar.span_id', index=4, - number=4, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='trace_id', full_name='opentelemetry.proto.metrics.v1.Exemplar.trace_id', index=5, - number=5, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name='value', full_name='opentelemetry.proto.metrics.v1.Exemplar.value', - index=0, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), - ], - serialized_start=3558, - serialized_end=3751, -) - -_METRICSDATA.fields_by_name['resource_metrics'].message_type = _RESOURCEMETRICS -_RESOURCEMETRICS.fields_by_name['resource'].message_type = opentelemetry_dot_proto_dot_resource_dot_v1_dot_resource__pb2._RESOURCE -_RESOURCEMETRICS.fields_by_name['scope_metrics'].message_type = _SCOPEMETRICS -_RESOURCEMETRICS.fields_by_name['instrumentation_library_metrics'].message_type = _INSTRUMENTATIONLIBRARYMETRICS -_SCOPEMETRICS.fields_by_name['scope'].message_type = opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2._INSTRUMENTATIONSCOPE -_SCOPEMETRICS.fields_by_name['metrics'].message_type = _METRIC -_INSTRUMENTATIONLIBRARYMETRICS.fields_by_name['instrumentation_library'].message_type = opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2._INSTRUMENTATIONLIBRARY -_INSTRUMENTATIONLIBRARYMETRICS.fields_by_name['metrics'].message_type = _METRIC -_METRIC.fields_by_name['gauge'].message_type = _GAUGE -_METRIC.fields_by_name['sum'].message_type = _SUM -_METRIC.fields_by_name['histogram'].message_type = _HISTOGRAM -_METRIC.fields_by_name['exponential_histogram'].message_type = _EXPONENTIALHISTOGRAM -_METRIC.fields_by_name['summary'].message_type = _SUMMARY -_METRIC.oneofs_by_name['data'].fields.append( - _METRIC.fields_by_name['gauge']) -_METRIC.fields_by_name['gauge'].containing_oneof = _METRIC.oneofs_by_name['data'] -_METRIC.oneofs_by_name['data'].fields.append( - _METRIC.fields_by_name['sum']) -_METRIC.fields_by_name['sum'].containing_oneof = _METRIC.oneofs_by_name['data'] -_METRIC.oneofs_by_name['data'].fields.append( - _METRIC.fields_by_name['histogram']) -_METRIC.fields_by_name['histogram'].containing_oneof = _METRIC.oneofs_by_name['data'] -_METRIC.oneofs_by_name['data'].fields.append( - _METRIC.fields_by_name['exponential_histogram']) -_METRIC.fields_by_name['exponential_histogram'].containing_oneof = _METRIC.oneofs_by_name['data'] -_METRIC.oneofs_by_name['data'].fields.append( - _METRIC.fields_by_name['summary']) -_METRIC.fields_by_name['summary'].containing_oneof = _METRIC.oneofs_by_name['data'] -_GAUGE.fields_by_name['data_points'].message_type = _NUMBERDATAPOINT -_SUM.fields_by_name['data_points'].message_type = _NUMBERDATAPOINT -_SUM.fields_by_name['aggregation_temporality'].enum_type = _AGGREGATIONTEMPORALITY -_HISTOGRAM.fields_by_name['data_points'].message_type = _HISTOGRAMDATAPOINT -_HISTOGRAM.fields_by_name['aggregation_temporality'].enum_type = _AGGREGATIONTEMPORALITY -_EXPONENTIALHISTOGRAM.fields_by_name['data_points'].message_type = _EXPONENTIALHISTOGRAMDATAPOINT -_EXPONENTIALHISTOGRAM.fields_by_name['aggregation_temporality'].enum_type = _AGGREGATIONTEMPORALITY -_SUMMARY.fields_by_name['data_points'].message_type = _SUMMARYDATAPOINT -_NUMBERDATAPOINT.fields_by_name['attributes'].message_type = opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2._KEYVALUE -_NUMBERDATAPOINT.fields_by_name['exemplars'].message_type = _EXEMPLAR -_NUMBERDATAPOINT.oneofs_by_name['value'].fields.append( - _NUMBERDATAPOINT.fields_by_name['as_double']) -_NUMBERDATAPOINT.fields_by_name['as_double'].containing_oneof = _NUMBERDATAPOINT.oneofs_by_name['value'] -_NUMBERDATAPOINT.oneofs_by_name['value'].fields.append( - _NUMBERDATAPOINT.fields_by_name['as_int']) -_NUMBERDATAPOINT.fields_by_name['as_int'].containing_oneof = _NUMBERDATAPOINT.oneofs_by_name['value'] -_HISTOGRAMDATAPOINT.fields_by_name['attributes'].message_type = opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2._KEYVALUE -_HISTOGRAMDATAPOINT.fields_by_name['exemplars'].message_type = _EXEMPLAR -_HISTOGRAMDATAPOINT.oneofs_by_name['_sum'].fields.append( - _HISTOGRAMDATAPOINT.fields_by_name['sum']) -_HISTOGRAMDATAPOINT.fields_by_name['sum'].containing_oneof = _HISTOGRAMDATAPOINT.oneofs_by_name['_sum'] -_HISTOGRAMDATAPOINT.oneofs_by_name['_min'].fields.append( - _HISTOGRAMDATAPOINT.fields_by_name['min']) -_HISTOGRAMDATAPOINT.fields_by_name['min'].containing_oneof = _HISTOGRAMDATAPOINT.oneofs_by_name['_min'] -_HISTOGRAMDATAPOINT.oneofs_by_name['_max'].fields.append( - _HISTOGRAMDATAPOINT.fields_by_name['max']) -_HISTOGRAMDATAPOINT.fields_by_name['max'].containing_oneof = _HISTOGRAMDATAPOINT.oneofs_by_name['_max'] -_EXPONENTIALHISTOGRAMDATAPOINT_BUCKETS.containing_type = _EXPONENTIALHISTOGRAMDATAPOINT -_EXPONENTIALHISTOGRAMDATAPOINT.fields_by_name['attributes'].message_type = opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2._KEYVALUE -_EXPONENTIALHISTOGRAMDATAPOINT.fields_by_name['positive'].message_type = _EXPONENTIALHISTOGRAMDATAPOINT_BUCKETS -_EXPONENTIALHISTOGRAMDATAPOINT.fields_by_name['negative'].message_type = _EXPONENTIALHISTOGRAMDATAPOINT_BUCKETS -_EXPONENTIALHISTOGRAMDATAPOINT.fields_by_name['exemplars'].message_type = _EXEMPLAR -_EXPONENTIALHISTOGRAMDATAPOINT.oneofs_by_name['_min'].fields.append( - _EXPONENTIALHISTOGRAMDATAPOINT.fields_by_name['min']) -_EXPONENTIALHISTOGRAMDATAPOINT.fields_by_name['min'].containing_oneof = _EXPONENTIALHISTOGRAMDATAPOINT.oneofs_by_name['_min'] -_EXPONENTIALHISTOGRAMDATAPOINT.oneofs_by_name['_max'].fields.append( - _EXPONENTIALHISTOGRAMDATAPOINT.fields_by_name['max']) -_EXPONENTIALHISTOGRAMDATAPOINT.fields_by_name['max'].containing_oneof = _EXPONENTIALHISTOGRAMDATAPOINT.oneofs_by_name['_max'] -_SUMMARYDATAPOINT_VALUEATQUANTILE.containing_type = _SUMMARYDATAPOINT -_SUMMARYDATAPOINT.fields_by_name['attributes'].message_type = opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2._KEYVALUE -_SUMMARYDATAPOINT.fields_by_name['quantile_values'].message_type = _SUMMARYDATAPOINT_VALUEATQUANTILE -_EXEMPLAR.fields_by_name['filtered_attributes'].message_type = opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2._KEYVALUE -_EXEMPLAR.oneofs_by_name['value'].fields.append( - _EXEMPLAR.fields_by_name['as_double']) -_EXEMPLAR.fields_by_name['as_double'].containing_oneof = _EXEMPLAR.oneofs_by_name['value'] -_EXEMPLAR.oneofs_by_name['value'].fields.append( - _EXEMPLAR.fields_by_name['as_int']) -_EXEMPLAR.fields_by_name['as_int'].containing_oneof = _EXEMPLAR.oneofs_by_name['value'] -DESCRIPTOR.message_types_by_name['MetricsData'] = _METRICSDATA -DESCRIPTOR.message_types_by_name['ResourceMetrics'] = _RESOURCEMETRICS -DESCRIPTOR.message_types_by_name['ScopeMetrics'] = _SCOPEMETRICS -DESCRIPTOR.message_types_by_name['InstrumentationLibraryMetrics'] = _INSTRUMENTATIONLIBRARYMETRICS -DESCRIPTOR.message_types_by_name['Metric'] = _METRIC -DESCRIPTOR.message_types_by_name['Gauge'] = _GAUGE -DESCRIPTOR.message_types_by_name['Sum'] = _SUM -DESCRIPTOR.message_types_by_name['Histogram'] = _HISTOGRAM -DESCRIPTOR.message_types_by_name['ExponentialHistogram'] = _EXPONENTIALHISTOGRAM -DESCRIPTOR.message_types_by_name['Summary'] = _SUMMARY -DESCRIPTOR.message_types_by_name['NumberDataPoint'] = _NUMBERDATAPOINT -DESCRIPTOR.message_types_by_name['HistogramDataPoint'] = _HISTOGRAMDATAPOINT -DESCRIPTOR.message_types_by_name['ExponentialHistogramDataPoint'] = _EXPONENTIALHISTOGRAMDATAPOINT -DESCRIPTOR.message_types_by_name['SummaryDataPoint'] = _SUMMARYDATAPOINT -DESCRIPTOR.message_types_by_name['Exemplar'] = _EXEMPLAR -DESCRIPTOR.enum_types_by_name['AggregationTemporality'] = _AGGREGATIONTEMPORALITY -DESCRIPTOR.enum_types_by_name['DataPointFlags'] = _DATAPOINTFLAGS -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - +_METRICSDATA = DESCRIPTOR.message_types_by_name['MetricsData'] +_RESOURCEMETRICS = DESCRIPTOR.message_types_by_name['ResourceMetrics'] +_SCOPEMETRICS = DESCRIPTOR.message_types_by_name['ScopeMetrics'] +_INSTRUMENTATIONLIBRARYMETRICS = DESCRIPTOR.message_types_by_name['InstrumentationLibraryMetrics'] +_METRIC = DESCRIPTOR.message_types_by_name['Metric'] +_GAUGE = DESCRIPTOR.message_types_by_name['Gauge'] +_SUM = DESCRIPTOR.message_types_by_name['Sum'] +_HISTOGRAM = DESCRIPTOR.message_types_by_name['Histogram'] +_EXPONENTIALHISTOGRAM = DESCRIPTOR.message_types_by_name['ExponentialHistogram'] +_SUMMARY = DESCRIPTOR.message_types_by_name['Summary'] +_NUMBERDATAPOINT = DESCRIPTOR.message_types_by_name['NumberDataPoint'] +_HISTOGRAMDATAPOINT = DESCRIPTOR.message_types_by_name['HistogramDataPoint'] +_EXPONENTIALHISTOGRAMDATAPOINT = DESCRIPTOR.message_types_by_name['ExponentialHistogramDataPoint'] +_EXPONENTIALHISTOGRAMDATAPOINT_BUCKETS = _EXPONENTIALHISTOGRAMDATAPOINT.nested_types_by_name['Buckets'] +_SUMMARYDATAPOINT = DESCRIPTOR.message_types_by_name['SummaryDataPoint'] +_SUMMARYDATAPOINT_VALUEATQUANTILE = _SUMMARYDATAPOINT.nested_types_by_name['ValueAtQuantile'] +_EXEMPLAR = DESCRIPTOR.message_types_by_name['Exemplar'] MetricsData = _reflection.GeneratedProtocolMessageType('MetricsData', (_message.Message,), { 'DESCRIPTOR' : _METRICSDATA, '__module__' : 'opentelemetry.proto.metrics.v1.metrics_pb2' @@ -1301,8 +168,50 @@ }) _sym_db.RegisterMessage(Exemplar) - -DESCRIPTOR._options = None -_RESOURCEMETRICS.fields_by_name['instrumentation_library_metrics']._options = None -_INSTRUMENTATIONLIBRARYMETRICS._options = None +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n!io.opentelemetry.proto.metrics.v1B\014MetricsProtoP\001Z)go.opentelemetry.io/proto/otlp/metrics/v1' + _RESOURCEMETRICS.fields_by_name['instrumentation_library_metrics']._options = None + _RESOURCEMETRICS.fields_by_name['instrumentation_library_metrics']._serialized_options = b'\030\001' + _INSTRUMENTATIONLIBRARYMETRICS._options = None + _INSTRUMENTATIONLIBRARYMETRICS._serialized_options = b'\030\001' + _AGGREGATIONTEMPORALITY._serialized_start=3754 + _AGGREGATIONTEMPORALITY._serialized_end=3894 + _DATAPOINTFLAGS._serialized_start=3896 + _DATAPOINTFLAGS._serialized_end=3955 + _METRICSDATA._serialized_start=172 + _METRICSDATA._serialized_end=260 + _RESOURCEMETRICS._serialized_start=263 + _RESOURCEMETRICS._serialized_end=539 + _SCOPEMETRICS._serialized_start=542 + _SCOPEMETRICS._serialized_end=701 + _INSTRUMENTATIONLIBRARYMETRICS._serialized_start=704 + _INSTRUMENTATIONLIBRARYMETRICS._serialized_end=904 + _METRIC._serialized_start=907 + _METRIC._serialized_end=1309 + _GAUGE._serialized_start=1311 + _GAUGE._serialized_end=1388 + _SUM._serialized_start=1391 + _SUM._serialized_end=1577 + _HISTOGRAM._serialized_start=1580 + _HISTOGRAM._serialized_end=1753 + _EXPONENTIALHISTOGRAM._serialized_start=1756 + _EXPONENTIALHISTOGRAM._serialized_end=1951 + _SUMMARY._serialized_start=1953 + _SUMMARY._serialized_end=2033 + _NUMBERDATAPOINT._serialized_start=2036 + _NUMBERDATAPOINT._serialized_end=2298 + _HISTOGRAMDATAPOINT._serialized_start=2301 + _HISTOGRAMDATAPOINT._serialized_end=2659 + _EXPONENTIALHISTOGRAMDATAPOINT._serialized_start=2662 + _EXPONENTIALHISTOGRAMDATAPOINT._serialized_end=3227 + _EXPONENTIALHISTOGRAMDATAPOINT_BUCKETS._serialized_start=3163 + _EXPONENTIALHISTOGRAMDATAPOINT_BUCKETS._serialized_end=3211 + _SUMMARYDATAPOINT._serialized_start=3230 + _SUMMARYDATAPOINT._serialized_end=3555 + _SUMMARYDATAPOINT_VALUEATQUANTILE._serialized_start=3499 + _SUMMARYDATAPOINT_VALUEATQUANTILE._serialized_end=3549 + _EXEMPLAR._serialized_start=3558 + _EXEMPLAR._serialized_end=3751 # @@protoc_insertion_point(module_scope) diff --git a/opentelemetry-proto/src/opentelemetry/proto/resource/v1/resource_pb2.py b/opentelemetry-proto/src/opentelemetry/proto/resource/v1/resource_pb2.py index 553053c28a8..2c31f9a3fad 100644 --- a/opentelemetry-proto/src/opentelemetry/proto/resource/v1/resource_pb2.py +++ b/opentelemetry-proto/src/opentelemetry/proto/resource/v1/resource_pb2.py @@ -3,6 +3,7 @@ # source: opentelemetry/proto/resource/v1/resource.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database @@ -14,61 +15,11 @@ from opentelemetry.proto.common.v1 import common_pb2 as opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2 -DESCRIPTOR = _descriptor.FileDescriptor( - name='opentelemetry/proto/resource/v1/resource.proto', - package='opentelemetry.proto.resource.v1', - syntax='proto3', - serialized_options=b'\n\"io.opentelemetry.proto.resource.v1B\rResourceProtoP\001Z*go.opentelemetry.io/proto/otlp/resource/v1', - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n.opentelemetry/proto/resource/v1/resource.proto\x12\x1fopentelemetry.proto.resource.v1\x1a*opentelemetry/proto/common/v1/common.proto\"i\n\x08Resource\x12;\n\nattributes\x18\x01 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12 \n\x18\x64ropped_attributes_count\x18\x02 \x01(\rBa\n\"io.opentelemetry.proto.resource.v1B\rResourceProtoP\x01Z*go.opentelemetry.io/proto/otlp/resource/v1b\x06proto3' - , - dependencies=[opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2.DESCRIPTOR,]) +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n.opentelemetry/proto/resource/v1/resource.proto\x12\x1fopentelemetry.proto.resource.v1\x1a*opentelemetry/proto/common/v1/common.proto\"i\n\x08Resource\x12;\n\nattributes\x18\x01 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12 \n\x18\x64ropped_attributes_count\x18\x02 \x01(\rBa\n\"io.opentelemetry.proto.resource.v1B\rResourceProtoP\x01Z*go.opentelemetry.io/proto/otlp/resource/v1b\x06proto3') - -_RESOURCE = _descriptor.Descriptor( - name='Resource', - full_name='opentelemetry.proto.resource.v1.Resource', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='attributes', full_name='opentelemetry.proto.resource.v1.Resource.attributes', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='dropped_attributes_count', full_name='opentelemetry.proto.resource.v1.Resource.dropped_attributes_count', index=1, - number=2, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=127, - serialized_end=232, -) - -_RESOURCE.fields_by_name['attributes'].message_type = opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2._KEYVALUE -DESCRIPTOR.message_types_by_name['Resource'] = _RESOURCE -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - +_RESOURCE = DESCRIPTOR.message_types_by_name['Resource'] Resource = _reflection.GeneratedProtocolMessageType('Resource', (_message.Message,), { 'DESCRIPTOR' : _RESOURCE, '__module__' : 'opentelemetry.proto.resource.v1.resource_pb2' @@ -76,6 +27,10 @@ }) _sym_db.RegisterMessage(Resource) +if _descriptor._USE_C_DESCRIPTORS == False: -DESCRIPTOR._options = None + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\"io.opentelemetry.proto.resource.v1B\rResourceProtoP\001Z*go.opentelemetry.io/proto/otlp/resource/v1' + _RESOURCE._serialized_start=127 + _RESOURCE._serialized_end=232 # @@protoc_insertion_point(module_scope) diff --git a/opentelemetry-proto/src/opentelemetry/proto/trace/v1/trace_config_pb2.py b/opentelemetry-proto/src/opentelemetry/proto/trace/v1/trace_config_pb2.py index 4b7cc3a69b8..a54a2b68d03 100644 --- a/opentelemetry-proto/src/opentelemetry/proto/trace/v1/trace_config_pb2.py +++ b/opentelemetry-proto/src/opentelemetry/proto/trace/v1/trace_config_pb2.py @@ -3,6 +3,7 @@ # source: opentelemetry/proto/trace/v1/trace_config.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database @@ -13,250 +14,15 @@ -DESCRIPTOR = _descriptor.FileDescriptor( - name='opentelemetry/proto/trace/v1/trace_config.proto', - package='opentelemetry.proto.trace.v1', - syntax='proto3', - serialized_options=b'\n\037io.opentelemetry.proto.trace.v1B\020TraceConfigProtoP\001Z1go.opentelemetry.io/proto/otlp/collector/trace/v1', - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n/opentelemetry/proto/trace/v1/trace_config.proto\x12\x1copentelemetry.proto.trace.v1\"\xc8\x03\n\x0bTraceConfig\x12I\n\x10\x63onstant_sampler\x18\x01 \x01(\x0b\x32-.opentelemetry.proto.trace.v1.ConstantSamplerH\x00\x12O\n\x14trace_id_ratio_based\x18\x02 \x01(\x0b\x32/.opentelemetry.proto.trace.v1.TraceIdRatioBasedH\x00\x12R\n\x15rate_limiting_sampler\x18\x03 \x01(\x0b\x32\x31.opentelemetry.proto.trace.v1.RateLimitingSamplerH\x00\x12 \n\x18max_number_of_attributes\x18\x04 \x01(\x03\x12\"\n\x1amax_number_of_timed_events\x18\x05 \x01(\x03\x12\x30\n(max_number_of_attributes_per_timed_event\x18\x06 \x01(\x03\x12\x1b\n\x13max_number_of_links\x18\x07 \x01(\x03\x12)\n!max_number_of_attributes_per_link\x18\x08 \x01(\x03\x42\t\n\x07sampler\"\xa9\x01\n\x0f\x43onstantSampler\x12P\n\x08\x64\x65\x63ision\x18\x01 \x01(\x0e\x32>.opentelemetry.proto.trace.v1.ConstantSampler.ConstantDecision\"D\n\x10\x43onstantDecision\x12\x0e\n\nALWAYS_OFF\x10\x00\x12\r\n\tALWAYS_ON\x10\x01\x12\x11\n\rALWAYS_PARENT\x10\x02\"*\n\x11TraceIdRatioBased\x12\x15\n\rsamplingRatio\x18\x01 \x01(\x01\"\"\n\x13RateLimitingSampler\x12\x0b\n\x03qps\x18\x01 \x01(\x03\x42h\n\x1fio.opentelemetry.proto.trace.v1B\x10TraceConfigProtoP\x01Z1go.opentelemetry.io/proto/otlp/collector/trace/v1b\x06proto3' -) +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n/opentelemetry/proto/trace/v1/trace_config.proto\x12\x1copentelemetry.proto.trace.v1\"\xc8\x03\n\x0bTraceConfig\x12I\n\x10\x63onstant_sampler\x18\x01 \x01(\x0b\x32-.opentelemetry.proto.trace.v1.ConstantSamplerH\x00\x12O\n\x14trace_id_ratio_based\x18\x02 \x01(\x0b\x32/.opentelemetry.proto.trace.v1.TraceIdRatioBasedH\x00\x12R\n\x15rate_limiting_sampler\x18\x03 \x01(\x0b\x32\x31.opentelemetry.proto.trace.v1.RateLimitingSamplerH\x00\x12 \n\x18max_number_of_attributes\x18\x04 \x01(\x03\x12\"\n\x1amax_number_of_timed_events\x18\x05 \x01(\x03\x12\x30\n(max_number_of_attributes_per_timed_event\x18\x06 \x01(\x03\x12\x1b\n\x13max_number_of_links\x18\x07 \x01(\x03\x12)\n!max_number_of_attributes_per_link\x18\x08 \x01(\x03\x42\t\n\x07sampler\"\xa9\x01\n\x0f\x43onstantSampler\x12P\n\x08\x64\x65\x63ision\x18\x01 \x01(\x0e\x32>.opentelemetry.proto.trace.v1.ConstantSampler.ConstantDecision\"D\n\x10\x43onstantDecision\x12\x0e\n\nALWAYS_OFF\x10\x00\x12\r\n\tALWAYS_ON\x10\x01\x12\x11\n\rALWAYS_PARENT\x10\x02\"*\n\x11TraceIdRatioBased\x12\x15\n\rsamplingRatio\x18\x01 \x01(\x01\"\"\n\x13RateLimitingSampler\x12\x0b\n\x03qps\x18\x01 \x01(\x03\x42h\n\x1fio.opentelemetry.proto.trace.v1B\x10TraceConfigProtoP\x01Z1go.opentelemetry.io/proto/otlp/collector/trace/v1b\x06proto3') -_CONSTANTSAMPLER_CONSTANTDECISION = _descriptor.EnumDescriptor( - name='ConstantDecision', - full_name='opentelemetry.proto.trace.v1.ConstantSampler.ConstantDecision', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='ALWAYS_OFF', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='ALWAYS_ON', index=1, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='ALWAYS_PARENT', index=2, number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - serialized_start=642, - serialized_end=710, -) -_sym_db.RegisterEnumDescriptor(_CONSTANTSAMPLER_CONSTANTDECISION) - - -_TRACECONFIG = _descriptor.Descriptor( - name='TraceConfig', - full_name='opentelemetry.proto.trace.v1.TraceConfig', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='constant_sampler', full_name='opentelemetry.proto.trace.v1.TraceConfig.constant_sampler', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='trace_id_ratio_based', full_name='opentelemetry.proto.trace.v1.TraceConfig.trace_id_ratio_based', index=1, - number=2, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='rate_limiting_sampler', full_name='opentelemetry.proto.trace.v1.TraceConfig.rate_limiting_sampler', index=2, - number=3, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='max_number_of_attributes', full_name='opentelemetry.proto.trace.v1.TraceConfig.max_number_of_attributes', index=3, - number=4, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='max_number_of_timed_events', full_name='opentelemetry.proto.trace.v1.TraceConfig.max_number_of_timed_events', index=4, - number=5, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='max_number_of_attributes_per_timed_event', full_name='opentelemetry.proto.trace.v1.TraceConfig.max_number_of_attributes_per_timed_event', index=5, - number=6, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='max_number_of_links', full_name='opentelemetry.proto.trace.v1.TraceConfig.max_number_of_links', index=6, - number=7, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='max_number_of_attributes_per_link', full_name='opentelemetry.proto.trace.v1.TraceConfig.max_number_of_attributes_per_link', index=7, - number=8, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name='sampler', full_name='opentelemetry.proto.trace.v1.TraceConfig.sampler', - index=0, containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[]), - ], - serialized_start=82, - serialized_end=538, -) - - -_CONSTANTSAMPLER = _descriptor.Descriptor( - name='ConstantSampler', - full_name='opentelemetry.proto.trace.v1.ConstantSampler', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='decision', full_name='opentelemetry.proto.trace.v1.ConstantSampler.decision', index=0, - number=1, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - _CONSTANTSAMPLER_CONSTANTDECISION, - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=541, - serialized_end=710, -) - - -_TRACEIDRATIOBASED = _descriptor.Descriptor( - name='TraceIdRatioBased', - full_name='opentelemetry.proto.trace.v1.TraceIdRatioBased', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='samplingRatio', full_name='opentelemetry.proto.trace.v1.TraceIdRatioBased.samplingRatio', index=0, - number=1, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=float(0), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=712, - serialized_end=754, -) - - -_RATELIMITINGSAMPLER = _descriptor.Descriptor( - name='RateLimitingSampler', - full_name='opentelemetry.proto.trace.v1.RateLimitingSampler', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='qps', full_name='opentelemetry.proto.trace.v1.RateLimitingSampler.qps', index=0, - number=1, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=756, - serialized_end=790, -) - -_TRACECONFIG.fields_by_name['constant_sampler'].message_type = _CONSTANTSAMPLER -_TRACECONFIG.fields_by_name['trace_id_ratio_based'].message_type = _TRACEIDRATIOBASED -_TRACECONFIG.fields_by_name['rate_limiting_sampler'].message_type = _RATELIMITINGSAMPLER -_TRACECONFIG.oneofs_by_name['sampler'].fields.append( - _TRACECONFIG.fields_by_name['constant_sampler']) -_TRACECONFIG.fields_by_name['constant_sampler'].containing_oneof = _TRACECONFIG.oneofs_by_name['sampler'] -_TRACECONFIG.oneofs_by_name['sampler'].fields.append( - _TRACECONFIG.fields_by_name['trace_id_ratio_based']) -_TRACECONFIG.fields_by_name['trace_id_ratio_based'].containing_oneof = _TRACECONFIG.oneofs_by_name['sampler'] -_TRACECONFIG.oneofs_by_name['sampler'].fields.append( - _TRACECONFIG.fields_by_name['rate_limiting_sampler']) -_TRACECONFIG.fields_by_name['rate_limiting_sampler'].containing_oneof = _TRACECONFIG.oneofs_by_name['sampler'] -_CONSTANTSAMPLER.fields_by_name['decision'].enum_type = _CONSTANTSAMPLER_CONSTANTDECISION -_CONSTANTSAMPLER_CONSTANTDECISION.containing_type = _CONSTANTSAMPLER -DESCRIPTOR.message_types_by_name['TraceConfig'] = _TRACECONFIG -DESCRIPTOR.message_types_by_name['ConstantSampler'] = _CONSTANTSAMPLER -DESCRIPTOR.message_types_by_name['TraceIdRatioBased'] = _TRACEIDRATIOBASED -DESCRIPTOR.message_types_by_name['RateLimitingSampler'] = _RATELIMITINGSAMPLER -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - +_TRACECONFIG = DESCRIPTOR.message_types_by_name['TraceConfig'] +_CONSTANTSAMPLER = DESCRIPTOR.message_types_by_name['ConstantSampler'] +_TRACEIDRATIOBASED = DESCRIPTOR.message_types_by_name['TraceIdRatioBased'] +_RATELIMITINGSAMPLER = DESCRIPTOR.message_types_by_name['RateLimitingSampler'] +_CONSTANTSAMPLER_CONSTANTDECISION = _CONSTANTSAMPLER.enum_types_by_name['ConstantDecision'] TraceConfig = _reflection.GeneratedProtocolMessageType('TraceConfig', (_message.Message,), { 'DESCRIPTOR' : _TRACECONFIG, '__module__' : 'opentelemetry.proto.trace.v1.trace_config_pb2' @@ -285,6 +51,18 @@ }) _sym_db.RegisterMessage(RateLimitingSampler) - -DESCRIPTOR._options = None +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\037io.opentelemetry.proto.trace.v1B\020TraceConfigProtoP\001Z1go.opentelemetry.io/proto/otlp/collector/trace/v1' + _TRACECONFIG._serialized_start=82 + _TRACECONFIG._serialized_end=538 + _CONSTANTSAMPLER._serialized_start=541 + _CONSTANTSAMPLER._serialized_end=710 + _CONSTANTSAMPLER_CONSTANTDECISION._serialized_start=642 + _CONSTANTSAMPLER_CONSTANTDECISION._serialized_end=710 + _TRACEIDRATIOBASED._serialized_start=712 + _TRACEIDRATIOBASED._serialized_end=754 + _RATELIMITINGSAMPLER._serialized_start=756 + _RATELIMITINGSAMPLER._serialized_end=790 # @@protoc_insertion_point(module_scope) diff --git a/opentelemetry-proto/src/opentelemetry/proto/trace/v1/trace_pb2.py b/opentelemetry-proto/src/opentelemetry/proto/trace/v1/trace_pb2.py index 7c4057ca7b8..0827c143013 100644 --- a/opentelemetry-proto/src/opentelemetry/proto/trace/v1/trace_pb2.py +++ b/opentelemetry-proto/src/opentelemetry/proto/trace/v1/trace_pb2.py @@ -3,6 +3,7 @@ # source: opentelemetry/proto/trace/v1/trace.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database @@ -15,580 +16,20 @@ from opentelemetry.proto.resource.v1 import resource_pb2 as opentelemetry_dot_proto_dot_resource_dot_v1_dot_resource__pb2 -DESCRIPTOR = _descriptor.FileDescriptor( - name='opentelemetry/proto/trace/v1/trace.proto', - package='opentelemetry.proto.trace.v1', - syntax='proto3', - serialized_options=b'\n\037io.opentelemetry.proto.trace.v1B\nTraceProtoP\001Z\'go.opentelemetry.io/proto/otlp/trace/v1', - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n(opentelemetry/proto/trace/v1/trace.proto\x12\x1copentelemetry.proto.trace.v1\x1a*opentelemetry/proto/common/v1/common.proto\x1a.opentelemetry/proto/resource/v1/resource.proto\"Q\n\nTracesData\x12\x43\n\x0eresource_spans\x18\x01 \x03(\x0b\x32+.opentelemetry.proto.trace.v1.ResourceSpans\"\x86\x02\n\rResourceSpans\x12;\n\x08resource\x18\x01 \x01(\x0b\x32).opentelemetry.proto.resource.v1.Resource\x12=\n\x0bscope_spans\x18\x02 \x03(\x0b\x32(.opentelemetry.proto.trace.v1.ScopeSpans\x12\x65\n\x1dinstrumentation_library_spans\x18\xe8\x07 \x03(\x0b\x32\x39.opentelemetry.proto.trace.v1.InstrumentationLibrarySpansB\x02\x18\x01\x12\x12\n\nschema_url\x18\x03 \x01(\t\"\x97\x01\n\nScopeSpans\x12\x42\n\x05scope\x18\x01 \x01(\x0b\x32\x33.opentelemetry.proto.common.v1.InstrumentationScope\x12\x31\n\x05spans\x18\x02 \x03(\x0b\x32\".opentelemetry.proto.trace.v1.Span\x12\x12\n\nschema_url\x18\x03 \x01(\t\"\xc0\x01\n\x1bInstrumentationLibrarySpans\x12V\n\x17instrumentation_library\x18\x01 \x01(\x0b\x32\x35.opentelemetry.proto.common.v1.InstrumentationLibrary\x12\x31\n\x05spans\x18\x02 \x03(\x0b\x32\".opentelemetry.proto.trace.v1.Span\x12\x12\n\nschema_url\x18\x03 \x01(\t:\x02\x18\x01\"\xe6\x07\n\x04Span\x12\x10\n\x08trace_id\x18\x01 \x01(\x0c\x12\x0f\n\x07span_id\x18\x02 \x01(\x0c\x12\x13\n\x0btrace_state\x18\x03 \x01(\t\x12\x16\n\x0eparent_span_id\x18\x04 \x01(\x0c\x12\x0c\n\x04name\x18\x05 \x01(\t\x12\x39\n\x04kind\x18\x06 \x01(\x0e\x32+.opentelemetry.proto.trace.v1.Span.SpanKind\x12\x1c\n\x14start_time_unix_nano\x18\x07 \x01(\x06\x12\x1a\n\x12\x65nd_time_unix_nano\x18\x08 \x01(\x06\x12;\n\nattributes\x18\t \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12 \n\x18\x64ropped_attributes_count\x18\n \x01(\r\x12\x38\n\x06\x65vents\x18\x0b \x03(\x0b\x32(.opentelemetry.proto.trace.v1.Span.Event\x12\x1c\n\x14\x64ropped_events_count\x18\x0c \x01(\r\x12\x36\n\x05links\x18\r \x03(\x0b\x32\'.opentelemetry.proto.trace.v1.Span.Link\x12\x1b\n\x13\x64ropped_links_count\x18\x0e \x01(\r\x12\x34\n\x06status\x18\x0f \x01(\x0b\x32$.opentelemetry.proto.trace.v1.Status\x1a\x8c\x01\n\x05\x45vent\x12\x16\n\x0etime_unix_nano\x18\x01 \x01(\x06\x12\x0c\n\x04name\x18\x02 \x01(\t\x12;\n\nattributes\x18\x03 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12 \n\x18\x64ropped_attributes_count\x18\x04 \x01(\r\x1a\x9d\x01\n\x04Link\x12\x10\n\x08trace_id\x18\x01 \x01(\x0c\x12\x0f\n\x07span_id\x18\x02 \x01(\x0c\x12\x13\n\x0btrace_state\x18\x03 \x01(\t\x12;\n\nattributes\x18\x04 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12 \n\x18\x64ropped_attributes_count\x18\x05 \x01(\r\"\x99\x01\n\x08SpanKind\x12\x19\n\x15SPAN_KIND_UNSPECIFIED\x10\x00\x12\x16\n\x12SPAN_KIND_INTERNAL\x10\x01\x12\x14\n\x10SPAN_KIND_SERVER\x10\x02\x12\x14\n\x10SPAN_KIND_CLIENT\x10\x03\x12\x16\n\x12SPAN_KIND_PRODUCER\x10\x04\x12\x16\n\x12SPAN_KIND_CONSUMER\x10\x05\"\xae\x01\n\x06Status\x12\x0f\n\x07message\x18\x02 \x01(\t\x12=\n\x04\x63ode\x18\x03 \x01(\x0e\x32/.opentelemetry.proto.trace.v1.Status.StatusCode\"N\n\nStatusCode\x12\x15\n\x11STATUS_CODE_UNSET\x10\x00\x12\x12\n\x0eSTATUS_CODE_OK\x10\x01\x12\x15\n\x11STATUS_CODE_ERROR\x10\x02J\x04\x08\x01\x10\x02\x42X\n\x1fio.opentelemetry.proto.trace.v1B\nTraceProtoP\x01Z\'go.opentelemetry.io/proto/otlp/trace/v1b\x06proto3' - , - dependencies=[opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2.DESCRIPTOR,opentelemetry_dot_proto_dot_resource_dot_v1_dot_resource__pb2.DESCRIPTOR,]) - - - -_SPAN_SPANKIND = _descriptor.EnumDescriptor( - name='SpanKind', - full_name='opentelemetry.proto.trace.v1.Span.SpanKind', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='SPAN_KIND_UNSPECIFIED', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SPAN_KIND_INTERNAL', index=1, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SPAN_KIND_SERVER', index=2, number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SPAN_KIND_CLIENT', index=3, number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SPAN_KIND_PRODUCER', index=4, number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SPAN_KIND_CONSUMER', index=5, number=5, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - serialized_start=1709, - serialized_end=1862, -) -_sym_db.RegisterEnumDescriptor(_SPAN_SPANKIND) - -_STATUS_STATUSCODE = _descriptor.EnumDescriptor( - name='StatusCode', - full_name='opentelemetry.proto.trace.v1.Status.StatusCode', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='STATUS_CODE_UNSET', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='STATUS_CODE_OK', index=1, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='STATUS_CODE_ERROR', index=2, number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - serialized_start=1955, - serialized_end=2033, -) -_sym_db.RegisterEnumDescriptor(_STATUS_STATUSCODE) - - -_TRACESDATA = _descriptor.Descriptor( - name='TracesData', - full_name='opentelemetry.proto.trace.v1.TracesData', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='resource_spans', full_name='opentelemetry.proto.trace.v1.TracesData.resource_spans', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=166, - serialized_end=247, -) - - -_RESOURCESPANS = _descriptor.Descriptor( - name='ResourceSpans', - full_name='opentelemetry.proto.trace.v1.ResourceSpans', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='resource', full_name='opentelemetry.proto.trace.v1.ResourceSpans.resource', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='scope_spans', full_name='opentelemetry.proto.trace.v1.ResourceSpans.scope_spans', index=1, - number=2, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='instrumentation_library_spans', full_name='opentelemetry.proto.trace.v1.ResourceSpans.instrumentation_library_spans', index=2, - number=1000, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=b'\030\001', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='schema_url', full_name='opentelemetry.proto.trace.v1.ResourceSpans.schema_url', index=3, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=250, - serialized_end=512, -) - +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n(opentelemetry/proto/trace/v1/trace.proto\x12\x1copentelemetry.proto.trace.v1\x1a*opentelemetry/proto/common/v1/common.proto\x1a.opentelemetry/proto/resource/v1/resource.proto\"Q\n\nTracesData\x12\x43\n\x0eresource_spans\x18\x01 \x03(\x0b\x32+.opentelemetry.proto.trace.v1.ResourceSpans\"\x86\x02\n\rResourceSpans\x12;\n\x08resource\x18\x01 \x01(\x0b\x32).opentelemetry.proto.resource.v1.Resource\x12=\n\x0bscope_spans\x18\x02 \x03(\x0b\x32(.opentelemetry.proto.trace.v1.ScopeSpans\x12\x65\n\x1dinstrumentation_library_spans\x18\xe8\x07 \x03(\x0b\x32\x39.opentelemetry.proto.trace.v1.InstrumentationLibrarySpansB\x02\x18\x01\x12\x12\n\nschema_url\x18\x03 \x01(\t\"\x97\x01\n\nScopeSpans\x12\x42\n\x05scope\x18\x01 \x01(\x0b\x32\x33.opentelemetry.proto.common.v1.InstrumentationScope\x12\x31\n\x05spans\x18\x02 \x03(\x0b\x32\".opentelemetry.proto.trace.v1.Span\x12\x12\n\nschema_url\x18\x03 \x01(\t\"\xc0\x01\n\x1bInstrumentationLibrarySpans\x12V\n\x17instrumentation_library\x18\x01 \x01(\x0b\x32\x35.opentelemetry.proto.common.v1.InstrumentationLibrary\x12\x31\n\x05spans\x18\x02 \x03(\x0b\x32\".opentelemetry.proto.trace.v1.Span\x12\x12\n\nschema_url\x18\x03 \x01(\t:\x02\x18\x01\"\xe6\x07\n\x04Span\x12\x10\n\x08trace_id\x18\x01 \x01(\x0c\x12\x0f\n\x07span_id\x18\x02 \x01(\x0c\x12\x13\n\x0btrace_state\x18\x03 \x01(\t\x12\x16\n\x0eparent_span_id\x18\x04 \x01(\x0c\x12\x0c\n\x04name\x18\x05 \x01(\t\x12\x39\n\x04kind\x18\x06 \x01(\x0e\x32+.opentelemetry.proto.trace.v1.Span.SpanKind\x12\x1c\n\x14start_time_unix_nano\x18\x07 \x01(\x06\x12\x1a\n\x12\x65nd_time_unix_nano\x18\x08 \x01(\x06\x12;\n\nattributes\x18\t \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12 \n\x18\x64ropped_attributes_count\x18\n \x01(\r\x12\x38\n\x06\x65vents\x18\x0b \x03(\x0b\x32(.opentelemetry.proto.trace.v1.Span.Event\x12\x1c\n\x14\x64ropped_events_count\x18\x0c \x01(\r\x12\x36\n\x05links\x18\r \x03(\x0b\x32\'.opentelemetry.proto.trace.v1.Span.Link\x12\x1b\n\x13\x64ropped_links_count\x18\x0e \x01(\r\x12\x34\n\x06status\x18\x0f \x01(\x0b\x32$.opentelemetry.proto.trace.v1.Status\x1a\x8c\x01\n\x05\x45vent\x12\x16\n\x0etime_unix_nano\x18\x01 \x01(\x06\x12\x0c\n\x04name\x18\x02 \x01(\t\x12;\n\nattributes\x18\x03 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12 \n\x18\x64ropped_attributes_count\x18\x04 \x01(\r\x1a\x9d\x01\n\x04Link\x12\x10\n\x08trace_id\x18\x01 \x01(\x0c\x12\x0f\n\x07span_id\x18\x02 \x01(\x0c\x12\x13\n\x0btrace_state\x18\x03 \x01(\t\x12;\n\nattributes\x18\x04 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12 \n\x18\x64ropped_attributes_count\x18\x05 \x01(\r\"\x99\x01\n\x08SpanKind\x12\x19\n\x15SPAN_KIND_UNSPECIFIED\x10\x00\x12\x16\n\x12SPAN_KIND_INTERNAL\x10\x01\x12\x14\n\x10SPAN_KIND_SERVER\x10\x02\x12\x14\n\x10SPAN_KIND_CLIENT\x10\x03\x12\x16\n\x12SPAN_KIND_PRODUCER\x10\x04\x12\x16\n\x12SPAN_KIND_CONSUMER\x10\x05\"\xae\x01\n\x06Status\x12\x0f\n\x07message\x18\x02 \x01(\t\x12=\n\x04\x63ode\x18\x03 \x01(\x0e\x32/.opentelemetry.proto.trace.v1.Status.StatusCode\"N\n\nStatusCode\x12\x15\n\x11STATUS_CODE_UNSET\x10\x00\x12\x12\n\x0eSTATUS_CODE_OK\x10\x01\x12\x15\n\x11STATUS_CODE_ERROR\x10\x02J\x04\x08\x01\x10\x02\x42X\n\x1fio.opentelemetry.proto.trace.v1B\nTraceProtoP\x01Z\'go.opentelemetry.io/proto/otlp/trace/v1b\x06proto3') -_SCOPESPANS = _descriptor.Descriptor( - name='ScopeSpans', - full_name='opentelemetry.proto.trace.v1.ScopeSpans', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='scope', full_name='opentelemetry.proto.trace.v1.ScopeSpans.scope', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='spans', full_name='opentelemetry.proto.trace.v1.ScopeSpans.spans', index=1, - number=2, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='schema_url', full_name='opentelemetry.proto.trace.v1.ScopeSpans.schema_url', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=515, - serialized_end=666, -) -_INSTRUMENTATIONLIBRARYSPANS = _descriptor.Descriptor( - name='InstrumentationLibrarySpans', - full_name='opentelemetry.proto.trace.v1.InstrumentationLibrarySpans', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='instrumentation_library', full_name='opentelemetry.proto.trace.v1.InstrumentationLibrarySpans.instrumentation_library', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='spans', full_name='opentelemetry.proto.trace.v1.InstrumentationLibrarySpans.spans', index=1, - number=2, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='schema_url', full_name='opentelemetry.proto.trace.v1.InstrumentationLibrarySpans.schema_url', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=b'\030\001', - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=669, - serialized_end=861, -) - - -_SPAN_EVENT = _descriptor.Descriptor( - name='Event', - full_name='opentelemetry.proto.trace.v1.Span.Event', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='time_unix_nano', full_name='opentelemetry.proto.trace.v1.Span.Event.time_unix_nano', index=0, - number=1, type=6, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='name', full_name='opentelemetry.proto.trace.v1.Span.Event.name', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='attributes', full_name='opentelemetry.proto.trace.v1.Span.Event.attributes', index=2, - number=3, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='dropped_attributes_count', full_name='opentelemetry.proto.trace.v1.Span.Event.dropped_attributes_count', index=3, - number=4, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1406, - serialized_end=1546, -) - -_SPAN_LINK = _descriptor.Descriptor( - name='Link', - full_name='opentelemetry.proto.trace.v1.Span.Link', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='trace_id', full_name='opentelemetry.proto.trace.v1.Span.Link.trace_id', index=0, - number=1, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='span_id', full_name='opentelemetry.proto.trace.v1.Span.Link.span_id', index=1, - number=2, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='trace_state', full_name='opentelemetry.proto.trace.v1.Span.Link.trace_state', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='attributes', full_name='opentelemetry.proto.trace.v1.Span.Link.attributes', index=3, - number=4, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='dropped_attributes_count', full_name='opentelemetry.proto.trace.v1.Span.Link.dropped_attributes_count', index=4, - number=5, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1549, - serialized_end=1706, -) - -_SPAN = _descriptor.Descriptor( - name='Span', - full_name='opentelemetry.proto.trace.v1.Span', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='trace_id', full_name='opentelemetry.proto.trace.v1.Span.trace_id', index=0, - number=1, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='span_id', full_name='opentelemetry.proto.trace.v1.Span.span_id', index=1, - number=2, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='trace_state', full_name='opentelemetry.proto.trace.v1.Span.trace_state', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='parent_span_id', full_name='opentelemetry.proto.trace.v1.Span.parent_span_id', index=3, - number=4, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=b"", - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='name', full_name='opentelemetry.proto.trace.v1.Span.name', index=4, - number=5, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='kind', full_name='opentelemetry.proto.trace.v1.Span.kind', index=5, - number=6, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='start_time_unix_nano', full_name='opentelemetry.proto.trace.v1.Span.start_time_unix_nano', index=6, - number=7, type=6, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='end_time_unix_nano', full_name='opentelemetry.proto.trace.v1.Span.end_time_unix_nano', index=7, - number=8, type=6, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='attributes', full_name='opentelemetry.proto.trace.v1.Span.attributes', index=8, - number=9, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='dropped_attributes_count', full_name='opentelemetry.proto.trace.v1.Span.dropped_attributes_count', index=9, - number=10, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='events', full_name='opentelemetry.proto.trace.v1.Span.events', index=10, - number=11, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='dropped_events_count', full_name='opentelemetry.proto.trace.v1.Span.dropped_events_count', index=11, - number=12, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='links', full_name='opentelemetry.proto.trace.v1.Span.links', index=12, - number=13, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='dropped_links_count', full_name='opentelemetry.proto.trace.v1.Span.dropped_links_count', index=13, - number=14, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='status', full_name='opentelemetry.proto.trace.v1.Span.status', index=14, - number=15, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[_SPAN_EVENT, _SPAN_LINK, ], - enum_types=[ - _SPAN_SPANKIND, - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=864, - serialized_end=1862, -) - - -_STATUS = _descriptor.Descriptor( - name='Status', - full_name='opentelemetry.proto.trace.v1.Status', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='message', full_name='opentelemetry.proto.trace.v1.Status.message', index=0, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=b"".decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - _descriptor.FieldDescriptor( - name='code', full_name='opentelemetry.proto.trace.v1.Status.code', index=1, - number=3, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - _STATUS_STATUSCODE, - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1865, - serialized_end=2039, -) - -_TRACESDATA.fields_by_name['resource_spans'].message_type = _RESOURCESPANS -_RESOURCESPANS.fields_by_name['resource'].message_type = opentelemetry_dot_proto_dot_resource_dot_v1_dot_resource__pb2._RESOURCE -_RESOURCESPANS.fields_by_name['scope_spans'].message_type = _SCOPESPANS -_RESOURCESPANS.fields_by_name['instrumentation_library_spans'].message_type = _INSTRUMENTATIONLIBRARYSPANS -_SCOPESPANS.fields_by_name['scope'].message_type = opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2._INSTRUMENTATIONSCOPE -_SCOPESPANS.fields_by_name['spans'].message_type = _SPAN -_INSTRUMENTATIONLIBRARYSPANS.fields_by_name['instrumentation_library'].message_type = opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2._INSTRUMENTATIONLIBRARY -_INSTRUMENTATIONLIBRARYSPANS.fields_by_name['spans'].message_type = _SPAN -_SPAN_EVENT.fields_by_name['attributes'].message_type = opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2._KEYVALUE -_SPAN_EVENT.containing_type = _SPAN -_SPAN_LINK.fields_by_name['attributes'].message_type = opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2._KEYVALUE -_SPAN_LINK.containing_type = _SPAN -_SPAN.fields_by_name['kind'].enum_type = _SPAN_SPANKIND -_SPAN.fields_by_name['attributes'].message_type = opentelemetry_dot_proto_dot_common_dot_v1_dot_common__pb2._KEYVALUE -_SPAN.fields_by_name['events'].message_type = _SPAN_EVENT -_SPAN.fields_by_name['links'].message_type = _SPAN_LINK -_SPAN.fields_by_name['status'].message_type = _STATUS -_SPAN_SPANKIND.containing_type = _SPAN -_STATUS.fields_by_name['code'].enum_type = _STATUS_STATUSCODE -_STATUS_STATUSCODE.containing_type = _STATUS -DESCRIPTOR.message_types_by_name['TracesData'] = _TRACESDATA -DESCRIPTOR.message_types_by_name['ResourceSpans'] = _RESOURCESPANS -DESCRIPTOR.message_types_by_name['ScopeSpans'] = _SCOPESPANS -DESCRIPTOR.message_types_by_name['InstrumentationLibrarySpans'] = _INSTRUMENTATIONLIBRARYSPANS -DESCRIPTOR.message_types_by_name['Span'] = _SPAN -DESCRIPTOR.message_types_by_name['Status'] = _STATUS -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - +_TRACESDATA = DESCRIPTOR.message_types_by_name['TracesData'] +_RESOURCESPANS = DESCRIPTOR.message_types_by_name['ResourceSpans'] +_SCOPESPANS = DESCRIPTOR.message_types_by_name['ScopeSpans'] +_INSTRUMENTATIONLIBRARYSPANS = DESCRIPTOR.message_types_by_name['InstrumentationLibrarySpans'] +_SPAN = DESCRIPTOR.message_types_by_name['Span'] +_SPAN_EVENT = _SPAN.nested_types_by_name['Event'] +_SPAN_LINK = _SPAN.nested_types_by_name['Link'] +_STATUS = DESCRIPTOR.message_types_by_name['Status'] +_SPAN_SPANKIND = _SPAN.enum_types_by_name['SpanKind'] +_STATUS_STATUSCODE = _STATUS.enum_types_by_name['StatusCode'] TracesData = _reflection.GeneratedProtocolMessageType('TracesData', (_message.Message,), { 'DESCRIPTOR' : _TRACESDATA, '__module__' : 'opentelemetry.proto.trace.v1.trace_pb2' @@ -647,8 +88,32 @@ }) _sym_db.RegisterMessage(Status) - -DESCRIPTOR._options = None -_RESOURCESPANS.fields_by_name['instrumentation_library_spans']._options = None -_INSTRUMENTATIONLIBRARYSPANS._options = None +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\037io.opentelemetry.proto.trace.v1B\nTraceProtoP\001Z\'go.opentelemetry.io/proto/otlp/trace/v1' + _RESOURCESPANS.fields_by_name['instrumentation_library_spans']._options = None + _RESOURCESPANS.fields_by_name['instrumentation_library_spans']._serialized_options = b'\030\001' + _INSTRUMENTATIONLIBRARYSPANS._options = None + _INSTRUMENTATIONLIBRARYSPANS._serialized_options = b'\030\001' + _TRACESDATA._serialized_start=166 + _TRACESDATA._serialized_end=247 + _RESOURCESPANS._serialized_start=250 + _RESOURCESPANS._serialized_end=512 + _SCOPESPANS._serialized_start=515 + _SCOPESPANS._serialized_end=666 + _INSTRUMENTATIONLIBRARYSPANS._serialized_start=669 + _INSTRUMENTATIONLIBRARYSPANS._serialized_end=861 + _SPAN._serialized_start=864 + _SPAN._serialized_end=1862 + _SPAN_EVENT._serialized_start=1406 + _SPAN_EVENT._serialized_end=1546 + _SPAN_LINK._serialized_start=1549 + _SPAN_LINK._serialized_end=1706 + _SPAN_SPANKIND._serialized_start=1709 + _SPAN_SPANKIND._serialized_end=1862 + _STATUS._serialized_start=1865 + _STATUS._serialized_end=2039 + _STATUS_STATUSCODE._serialized_start=1955 + _STATUS_STATUSCODE._serialized_end=2033 # @@protoc_insertion_point(module_scope) diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/_configuration/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/_configuration/__init__.py index 27f3a334c7a..a1ef3b76a27 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/_configuration/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/_configuration/__init__.py @@ -26,6 +26,7 @@ from pkg_resources import iter_entry_points from typing_extensions import Literal +from opentelemetry._logs import set_logger_provider from opentelemetry.environment_variables import ( OTEL_LOGS_EXPORTER, OTEL_METRICS_EXPORTER, @@ -33,11 +34,7 @@ OTEL_TRACES_EXPORTER, ) from opentelemetry.metrics import set_meter_provider -from opentelemetry.sdk._logs import ( - LoggerProvider, - LoggingHandler, - set_logger_provider, -) +from opentelemetry.sdk._logs import LoggerProvider, LoggingHandler from opentelemetry.sdk._logs.export import BatchLogRecordProcessor, LogExporter from opentelemetry.sdk.environment_variables import ( _OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED, diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/_logs/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/_logs/__init__.py index 1ca3aa48b0e..a548ef3793b 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/_logs/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/_logs/__init__.py @@ -12,514 +12,19 @@ # See the License for the specific language governing permissions and # limitations under the License. -import abc -import atexit -import concurrent.futures -import json -import logging -import os -import threading -import traceback -from time import time_ns -from typing import Any, Callable, Optional, Tuple, Union, cast - -from opentelemetry.sdk._logs.severity import SeverityNumber, std_to_otlp -from opentelemetry.sdk.environment_variables import ( - _OTEL_PYTHON_LOGGER_PROVIDER, -) -from opentelemetry.sdk.resources import Resource -from opentelemetry.sdk.util import ns_to_iso_str -from opentelemetry.sdk.util.instrumentation import InstrumentationScope -from opentelemetry.semconv.trace import SpanAttributes -from opentelemetry.trace import ( - format_span_id, - format_trace_id, - get_current_span, +# pylint: disable=unused-import + +from opentelemetry.sdk._logs._internal import ( # noqa: F401 + LogData, + Logger, + LoggerProvider, + LoggingHandler, + LogRecord, + LogRecordProcessor, ) -from opentelemetry.trace.span import TraceFlags -from opentelemetry.util._providers import _load_provider -from opentelemetry.util.types import Attributes - -_logger = logging.getLogger(__name__) - - -class LogRecord: - """A LogRecord instance represents an event being logged. - - LogRecord instances are created and emitted via `Logger` - every time something is logged. They contain all the information - pertinent to the event being logged. - """ - - def __init__( - self, - timestamp: Optional[int] = None, - trace_id: Optional[int] = None, - span_id: Optional[int] = None, - trace_flags: Optional[TraceFlags] = None, - severity_text: Optional[str] = None, - severity_number: Optional[SeverityNumber] = None, - body: Optional[Any] = None, - resource: Optional[Resource] = None, - attributes: Optional[Attributes] = None, - ): - self.timestamp = timestamp - self.trace_id = trace_id - self.span_id = span_id - self.trace_flags = trace_flags - self.severity_text = severity_text - self.severity_number = severity_number - self.body = body - self.resource = resource - self.attributes = attributes - - def __eq__(self, other: object) -> bool: - if not isinstance(other, LogRecord): - return NotImplemented - return self.__dict__ == other.__dict__ - - def to_json(self, indent=4) -> str: - return json.dumps( - { - "body": self.body, - "severity_number": repr(self.severity_number), - "severity_text": self.severity_text, - "attributes": self.attributes, - "timestamp": ns_to_iso_str(self.timestamp), - "trace_id": f"0x{format_trace_id(self.trace_id)}" - if self.trace_id is not None - else "", - "span_id": f"0x{format_span_id(self.span_id)}" - if self.span_id is not None - else "", - "trace_flags": self.trace_flags, - "resource": repr(self.resource.attributes) - if self.resource - else "", - }, - indent=indent, - ) - - -class LogData: - """Readable LogRecord data plus associated InstrumentationLibrary.""" - - def __init__( - self, - log_record: LogRecord, - instrumentation_scope: InstrumentationScope, - ): - self.log_record = log_record - self.instrumentation_scope = instrumentation_scope - - -class LogRecordProcessor(abc.ABC): - """Interface to hook the log record emitting action. - - Log processors can be registered directly using - :func:`LoggerProvider.add_log_record_processor` and they are invoked - in the same order as they were registered. - """ - - @abc.abstractmethod - def emit(self, log_data: LogData): - """Emits the `LogData`""" - - @abc.abstractmethod - def shutdown(self): - """Called when a :class:`opentelemetry.sdk._logs.Logger` is shutdown""" - - @abc.abstractmethod - def force_flush(self, timeout_millis: int = 30000): - """Export all the received logs to the configured Exporter that have not yet - been exported. - - Args: - timeout_millis: The maximum amount of time to wait for logs to be - exported. - - Returns: - False if the timeout is exceeded, True otherwise. - """ - - -# Temporary fix until https://github.com/PyCQA/pylint/issues/4098 is resolved -# pylint:disable=no-member -class SynchronousMultiLogRecordProcessor(LogRecordProcessor): - """Implementation of class:`LogRecordProcessor` that forwards all received - events to a list of log processors sequentially. - - The underlying log processors are called in sequential order as they were - added. - """ - - def __init__(self): - # use a tuple to avoid race conditions when adding a new log and - # iterating through it on "emit". - self._log_record_processors = () # type: Tuple[LogRecordProcessor, ...] - self._lock = threading.Lock() - - def add_log_record_processor( - self, log_record_processor: LogRecordProcessor - ) -> None: - """Adds a Logprocessor to the list of log processors handled by this instance""" - with self._lock: - self._log_record_processors += (log_record_processor,) - - def emit(self, log_data: LogData) -> None: - for lp in self._log_record_processors: - lp.emit(log_data) - - def shutdown(self) -> None: - """Shutdown the log processors one by one""" - for lp in self._log_record_processors: - lp.shutdown() - - def force_flush(self, timeout_millis: int = 30000) -> bool: - """Force flush the log processors one by one - - Args: - timeout_millis: The maximum amount of time to wait for logs to be - exported. If the first n log processors exceeded the timeout - then remaining log processors will not be flushed. - - Returns: - True if all the log processors flushes the logs within timeout, - False otherwise. - """ - deadline_ns = time_ns() + timeout_millis * 1000000 - for lp in self._log_record_processors: - current_ts = time_ns() - if current_ts >= deadline_ns: - return False - - if not lp.force_flush((deadline_ns - current_ts) // 1000000): - return False - - return True - - -class ConcurrentMultiLogRecordProcessor(LogRecordProcessor): - """Implementation of :class:`LogRecordProcessor` that forwards all received - events to a list of log processors in parallel. - - Calls to the underlying log processors are forwarded in parallel by - submitting them to a thread pool executor and waiting until each log - processor finished its work. - - Args: - max_workers: The number of threads managed by the thread pool executor - and thus defining how many log processors can work in parallel. - """ - - def __init__(self, max_workers: int = 2): - # use a tuple to avoid race conditions when adding a new log and - # iterating through it on "emit". - self._log_record_processors = () # type: Tuple[LogRecordProcessor, ...] - self._lock = threading.Lock() - self._executor = concurrent.futures.ThreadPoolExecutor( - max_workers=max_workers - ) - - def add_log_record_processor( - self, log_record_processor: LogRecordProcessor - ): - with self._lock: - self._log_record_processors += (log_record_processor,) - - def _submit_and_wait( - self, - func: Callable[[LogRecordProcessor], Callable[..., None]], - *args: Any, - **kwargs: Any, - ): - futures = [] - for lp in self._log_record_processors: - future = self._executor.submit(func(lp), *args, **kwargs) - futures.append(future) - for future in futures: - future.result() - - def emit(self, log_data: LogData): - self._submit_and_wait(lambda lp: lp.emit, log_data) - - def shutdown(self): - self._submit_and_wait(lambda lp: lp.shutdown) - - def force_flush(self, timeout_millis: int = 30000) -> bool: - """Force flush the log processors in parallel. - - Args: - timeout_millis: The maximum amount of time to wait for logs to be - exported. - - Returns: - True if all the log processors flushes the logs within timeout, - False otherwise. - """ - futures = [] - for lp in self._log_record_processors: - future = self._executor.submit(lp.force_flush, timeout_millis) - futures.append(future) - - done_futures, not_done_futures = concurrent.futures.wait( - futures, timeout_millis / 1e3 - ) - - if not_done_futures: - return False - - for future in done_futures: - if not future.result(): - return False - - return True - - -# skip natural LogRecord attributes -# http://docs.python.org/library/logging.html#logrecord-attributes -_RESERVED_ATTRS = frozenset( - ( - "asctime", - "args", - "created", - "exc_info", - "exc_text", - "filename", - "funcName", - "getMessage", - "levelname", - "levelno", - "lineno", - "module", - "msecs", - "msg", - "name", - "pathname", - "process", - "processName", - "relativeCreated", - "stack_info", - "thread", - "threadName", - ) -) - - -class LoggingHandler(logging.Handler): - """A handler class which writes logging records, in OTLP format, to - a network destination or file. Supports signals from the `logging` module. - https://docs.python.org/3/library/logging.html - """ - - def __init__( - self, - level=logging.NOTSET, - logger_provider=None, - ) -> None: - super().__init__(level=level) - self._logger_provider = logger_provider or get_logger_provider() - self._logger = get_logger( - __name__, logger_provider=self._logger_provider - ) - - @staticmethod - def _get_attributes(record: logging.LogRecord) -> Attributes: - attributes = { - k: v for k, v in vars(record).items() if k not in _RESERVED_ATTRS - } - if record.exc_info: - exc_type = "" - message = "" - stack_trace = "" - exctype, value, tb = record.exc_info - if exctype is not None: - exc_type = exctype.__name__ - if value is not None and value.args: - message = value.args[0] - if tb is not None: - # https://github.com/open-telemetry/opentelemetry-specification/blob/9fa7c656b26647b27e485a6af7e38dc716eba98a/specification/trace/semantic_conventions/exceptions.md#stacktrace-representation - stack_trace = "".join( - traceback.format_exception(*record.exc_info) - ) - attributes[SpanAttributes.EXCEPTION_TYPE] = exc_type - attributes[SpanAttributes.EXCEPTION_MESSAGE] = message - attributes[SpanAttributes.EXCEPTION_STACKTRACE] = stack_trace - return attributes - - def _translate(self, record: logging.LogRecord) -> LogRecord: - timestamp = int(record.created * 1e9) - span_context = get_current_span().get_span_context() - attributes = self._get_attributes(record) - severity_number = std_to_otlp(record.levelno) - return LogRecord( - timestamp=timestamp, - trace_id=span_context.trace_id, - span_id=span_context.span_id, - trace_flags=span_context.trace_flags, - severity_text=record.levelname, - severity_number=severity_number, - body=record.getMessage(), - resource=self._logger.resource, - attributes=attributes, - ) - - def emit(self, record: logging.LogRecord) -> None: - """ - Emit a record. - - The record is translated to OTLP format, and then sent across the pipeline. - """ - self._logger.emit(self._translate(record)) - - def flush(self) -> None: - """ - Flushes the logging output. - """ - self._logger_provider.force_flush() - - -class Logger: - def __init__( - self, - resource: Resource, - multi_log_record_processor: Union[ - SynchronousMultiLogRecordProcessor, - ConcurrentMultiLogRecordProcessor, - ], - instrumentation_scope: InstrumentationScope, - ): - self._resource = resource - self._multi_log_record_processor = multi_log_record_processor - self._instrumentation_scope = instrumentation_scope - - @property - def resource(self): - return self._resource - - def emit(self, record: LogRecord): - """Emits the :class:`LogData` by associating :class:`LogRecord` - and instrumentation info. - """ - log_data = LogData(record, self._instrumentation_scope) - self._multi_log_record_processor.emit(log_data) - - -class LoggerProvider: - def __init__( - self, - resource: Resource = Resource.create(), - shutdown_on_exit: bool = True, - multi_log_record_processor: Union[ - SynchronousMultiLogRecordProcessor, - ConcurrentMultiLogRecordProcessor, - ] = None, - ): - self._resource = resource - self._multi_log_record_processor = ( - multi_log_record_processor or SynchronousMultiLogRecordProcessor() - ) - self._at_exit_handler = None - if shutdown_on_exit: - self._at_exit_handler = atexit.register(self.shutdown) - - @property - def resource(self): - return self._resource - - def get_logger( - self, - instrumenting_module_name: str, - instrumenting_module_version: str = "", - ) -> Logger: - return Logger( - self._resource, - self._multi_log_record_processor, - InstrumentationScope( - instrumenting_module_name, instrumenting_module_version - ), - ) - - def add_log_record_processor( - self, log_record_processor: LogRecordProcessor - ): - """Registers a new :class:`LogRecordProcessor` for this `LoggerProvider` instance. - - The log processors are invoked in the same order they are registered. - """ - self._multi_log_record_processor.add_log_record_processor( - log_record_processor - ) - - def shutdown(self): - """Shuts down the log processors.""" - self._multi_log_record_processor.shutdown() - if self._at_exit_handler is not None: - atexit.unregister(self._at_exit_handler) - self._at_exit_handler = None - - def force_flush(self, timeout_millis: int = 30000) -> bool: - """Force flush the log processors. - - Args: - timeout_millis: The maximum amount of time to wait for logs to be - exported. - - Returns: - True if all the log processors flushes the logs within timeout, - False otherwise. - """ - return self._multi_log_record_processor.force_flush(timeout_millis) - - -_LOGGER_PROVIDER = None - - -def get_logger_provider() -> LoggerProvider: - """Gets the current global :class:`~.LoggerProvider` object.""" - global _LOGGER_PROVIDER # pylint: disable=global-statement - if _LOGGER_PROVIDER is None: - if _OTEL_PYTHON_LOGGER_PROVIDER not in os.environ: - _LOGGER_PROVIDER = LoggerProvider() - return _LOGGER_PROVIDER - - _LOGGER_PROVIDER = cast( - "LoggerProvider", - _load_provider(_OTEL_PYTHON_LOGGER_PROVIDER, "logger_provider"), - ) - - return _LOGGER_PROVIDER - - -def set_logger_provider(logger_provider: LoggerProvider) -> None: - """Sets the current global :class:`~.LoggerProvider` object. - - This can only be done once, a warning will be logged if any further attempt - is made. - """ - global _LOGGER_PROVIDER # pylint: disable=global-statement - - if _LOGGER_PROVIDER is not None: - _logger.warning("Overriding of current LoggerProvider is not allowed") - return - - _LOGGER_PROVIDER = logger_provider - - -def get_logger( - instrumenting_module_name: str, - instrumenting_library_version: str = "", - logger_provider: Optional[LoggerProvider] = None, -) -> Logger: - """Returns a `Logger` for use within a python process. - - This function is a convenience wrapper for - opentelemetry.sdk._logs.LoggerProvider.get_logger. - If logger_provider param is omitted the current configured one is used. - """ - if logger_provider is None: - logger_provider = get_logger_provider() - return logger_provider.get_logger( - instrumenting_module_name, instrumenting_library_version - ) +__all__ = [] +for key, value in globals().copy().items(): + if not key.startswith("_"): + value.__module__ = __name__ + __all__.append(key) diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/_logs/_internal/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/_logs/_internal/__init__.py new file mode 100644 index 00000000000..83cef931491 --- /dev/null +++ b/opentelemetry-sdk/src/opentelemetry/sdk/_logs/_internal/__init__.py @@ -0,0 +1,489 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import abc +import atexit +import concurrent.futures +import json +import logging +import threading +import traceback +from time import time_ns +from typing import Any, Callable, Optional, Tuple, Union + +from opentelemetry._logs import Logger as APILogger +from opentelemetry._logs import LoggerProvider as APILoggerProvider +from opentelemetry._logs import LogRecord as APILogRecord +from opentelemetry._logs import ( + SeverityNumber, + get_logger, + get_logger_provider, + std_to_otel, +) +from opentelemetry.sdk.resources import Resource +from opentelemetry.sdk.util import ns_to_iso_str +from opentelemetry.sdk.util.instrumentation import InstrumentationScope +from opentelemetry.semconv.trace import SpanAttributes +from opentelemetry.trace import ( + format_span_id, + format_trace_id, + get_current_span, +) +from opentelemetry.trace.span import TraceFlags +from opentelemetry.util.types import Attributes + +_logger = logging.getLogger(__name__) + + +class LogRecord(APILogRecord): + """A LogRecord instance represents an event being logged. + + LogRecord instances are created and emitted via `Logger` + every time something is logged. They contain all the information + pertinent to the event being logged. + """ + + def __init__( + self, + timestamp: Optional[int] = None, + observed_timestamp: Optional[int] = None, + trace_id: Optional[int] = None, + span_id: Optional[int] = None, + trace_flags: Optional[TraceFlags] = None, + severity_text: Optional[str] = None, + severity_number: Optional[SeverityNumber] = None, + body: Optional[Any] = None, + resource: Optional[Resource] = None, + attributes: Optional[Attributes] = None, + ): + super().__init__( + **{ + "timestamp": timestamp, + "observed_timestamp": observed_timestamp, + "trace_id": trace_id, + "span_id": span_id, + "trace_flags": trace_flags, + "severity_text": severity_text, + "severity_number": severity_number, + "body": body, + "attributes": attributes, + } + ) + self.resource = resource + + def __eq__(self, other: object) -> bool: + if not isinstance(other, LogRecord): + return NotImplemented + return self.__dict__ == other.__dict__ + + def to_json(self, indent=4) -> str: + return json.dumps( + { + "body": self.body, + "severity_number": repr(self.severity_number), + "severity_text": self.severity_text, + "attributes": self.attributes, + "timestamp": ns_to_iso_str(self.timestamp), + "trace_id": f"0x{format_trace_id(self.trace_id)}" + if self.trace_id is not None + else "", + "span_id": f"0x{format_span_id(self.span_id)}" + if self.span_id is not None + else "", + "trace_flags": self.trace_flags, + "resource": repr(self.resource.attributes) + if self.resource + else "", + }, + indent=indent, + ) + + +class LogData: + """Readable LogRecord data plus associated InstrumentationLibrary.""" + + def __init__( + self, + log_record: LogRecord, + instrumentation_scope: InstrumentationScope, + ): + self.log_record = log_record + self.instrumentation_scope = instrumentation_scope + + +class LogRecordProcessor(abc.ABC): + """Interface to hook the log record emitting action. + + Log processors can be registered directly using + :func:`LoggerProvider.add_log_record_processor` and they are invoked + in the same order as they were registered. + """ + + @abc.abstractmethod + def emit(self, log_data: LogData): + """Emits the `LogData`""" + + @abc.abstractmethod + def shutdown(self): + """Called when a :class:`opentelemetry.sdk._logs.Logger` is shutdown""" + + @abc.abstractmethod + def force_flush(self, timeout_millis: int = 30000): + """Export all the received logs to the configured Exporter that have not yet + been exported. + + Args: + timeout_millis: The maximum amount of time to wait for logs to be + exported. + + Returns: + False if the timeout is exceeded, True otherwise. + """ + + +# Temporary fix until https://github.com/PyCQA/pylint/issues/4098 is resolved +# pylint:disable=no-member +class SynchronousMultiLogRecordProcessor(LogRecordProcessor): + """Implementation of class:`LogRecordProcessor` that forwards all received + events to a list of log processors sequentially. + + The underlying log processors are called in sequential order as they were + added. + """ + + def __init__(self): + # use a tuple to avoid race conditions when adding a new log and + # iterating through it on "emit". + self._log_record_processors = () # type: Tuple[LogRecordProcessor, ...] + self._lock = threading.Lock() + + def add_log_record_processor( + self, log_record_processor: LogRecordProcessor + ) -> None: + """Adds a Logprocessor to the list of log processors handled by this instance""" + with self._lock: + self._log_record_processors += (log_record_processor,) + + def emit(self, log_data: LogData) -> None: + for lp in self._log_record_processors: + lp.emit(log_data) + + def shutdown(self) -> None: + """Shutdown the log processors one by one""" + for lp in self._log_record_processors: + lp.shutdown() + + def force_flush(self, timeout_millis: int = 30000) -> bool: + """Force flush the log processors one by one + + Args: + timeout_millis: The maximum amount of time to wait for logs to be + exported. If the first n log processors exceeded the timeout + then remaining log processors will not be flushed. + + Returns: + True if all the log processors flushes the logs within timeout, + False otherwise. + """ + deadline_ns = time_ns() + timeout_millis * 1000000 + for lp in self._log_record_processors: + current_ts = time_ns() + if current_ts >= deadline_ns: + return False + + if not lp.force_flush((deadline_ns - current_ts) // 1000000): + return False + + return True + + +class ConcurrentMultiLogRecordProcessor(LogRecordProcessor): + """Implementation of :class:`LogRecordProcessor` that forwards all received + events to a list of log processors in parallel. + + Calls to the underlying log processors are forwarded in parallel by + submitting them to a thread pool executor and waiting until each log + processor finished its work. + + Args: + max_workers: The number of threads managed by the thread pool executor + and thus defining how many log processors can work in parallel. + """ + + def __init__(self, max_workers: int = 2): + # use a tuple to avoid race conditions when adding a new log and + # iterating through it on "emit". + self._log_record_processors = () # type: Tuple[LogRecordProcessor, ...] + self._lock = threading.Lock() + self._executor = concurrent.futures.ThreadPoolExecutor( + max_workers=max_workers + ) + + def add_log_record_processor( + self, log_record_processor: LogRecordProcessor + ): + with self._lock: + self._log_record_processors += (log_record_processor,) + + def _submit_and_wait( + self, + func: Callable[[LogRecordProcessor], Callable[..., None]], + *args: Any, + **kwargs: Any, + ): + futures = [] + for lp in self._log_record_processors: + future = self._executor.submit(func(lp), *args, **kwargs) + futures.append(future) + for future in futures: + future.result() + + def emit(self, log_data: LogData): + self._submit_and_wait(lambda lp: lp.emit, log_data) + + def shutdown(self): + self._submit_and_wait(lambda lp: lp.shutdown) + + def force_flush(self, timeout_millis: int = 30000) -> bool: + """Force flush the log processors in parallel. + + Args: + timeout_millis: The maximum amount of time to wait for logs to be + exported. + + Returns: + True if all the log processors flushes the logs within timeout, + False otherwise. + """ + futures = [] + for lp in self._log_record_processors: + future = self._executor.submit(lp.force_flush, timeout_millis) + futures.append(future) + + done_futures, not_done_futures = concurrent.futures.wait( + futures, timeout_millis / 1e3 + ) + + if not_done_futures: + return False + + for future in done_futures: + if not future.result(): + return False + + return True + + +# skip natural LogRecord attributes +# http://docs.python.org/library/logging.html#logrecord-attributes +_RESERVED_ATTRS = frozenset( + ( + "asctime", + "args", + "created", + "exc_info", + "exc_text", + "filename", + "funcName", + "getMessage", + "levelname", + "levelno", + "lineno", + "module", + "msecs", + "msg", + "name", + "pathname", + "process", + "processName", + "relativeCreated", + "stack_info", + "thread", + "threadName", + ) +) + + +class LoggingHandler(logging.Handler): + """A handler class which writes logging records, in OTLP format, to + a network destination or file. Supports signals from the `logging` module. + https://docs.python.org/3/library/logging.html + """ + + def __init__( + self, + level=logging.NOTSET, + logger_provider=None, + ) -> None: + super().__init__(level=level) + self._logger_provider = logger_provider or get_logger_provider() + self._logger = get_logger( + __name__, logger_provider=self._logger_provider + ) + + @staticmethod + def _get_attributes(record: logging.LogRecord) -> Attributes: + attributes = { + k: v for k, v in vars(record).items() if k not in _RESERVED_ATTRS + } + if record.exc_info: + exc_type = "" + message = "" + stack_trace = "" + exctype, value, tb = record.exc_info + if exctype is not None: + exc_type = exctype.__name__ + if value is not None and value.args: + message = value.args[0] + if tb is not None: + # https://github.com/open-telemetry/opentelemetry-specification/blob/9fa7c656b26647b27e485a6af7e38dc716eba98a/specification/trace/semantic_conventions/exceptions.md#stacktrace-representation + stack_trace = "".join( + traceback.format_exception(*record.exc_info) + ) + attributes[SpanAttributes.EXCEPTION_TYPE] = exc_type + attributes[SpanAttributes.EXCEPTION_MESSAGE] = message + attributes[SpanAttributes.EXCEPTION_STACKTRACE] = stack_trace + return attributes + + def _translate(self, record: logging.LogRecord) -> LogRecord: + timestamp = int(record.created * 1e9) + span_context = get_current_span().get_span_context() + attributes = self._get_attributes(record) + severity_number = std_to_otel(record.levelno) + return LogRecord( + timestamp=timestamp, + trace_id=span_context.trace_id, + span_id=span_context.span_id, + trace_flags=span_context.trace_flags, + severity_text=record.levelname, + severity_number=severity_number, + body=record.getMessage(), + resource=self._logger.resource, + attributes=attributes, + ) + + def emit(self, record: logging.LogRecord) -> None: + """ + Emit a record. + + The record is translated to OTel format, and then sent across the pipeline. + """ + self._logger.emit(self._translate(record)) + + def flush(self) -> None: + """ + Flushes the logging output. + """ + self._logger_provider.force_flush() + + +class Logger(APILogger): + def __init__( + self, + resource: Resource, + multi_log_record_processor: Union[ + SynchronousMultiLogRecordProcessor, + ConcurrentMultiLogRecordProcessor, + ], + instrumentation_scope: InstrumentationScope, + ): + super().__init__( + instrumentation_scope.name, + instrumentation_scope.version, + instrumentation_scope.schema_url, + ) + self._resource = resource + self._multi_log_record_processor = multi_log_record_processor + self._instrumentation_scope = instrumentation_scope + + @property + def resource(self): + return self._resource + + def emit(self, record: LogRecord): + """Emits the :class:`LogData` by associating :class:`LogRecord` + and instrumentation info. + """ + log_data = LogData(record, self._instrumentation_scope) + self._multi_log_record_processor.emit(log_data) + + +class LoggerProvider(APILoggerProvider): + def __init__( + self, + resource: Resource = Resource.create(), + shutdown_on_exit: bool = True, + multi_log_record_processor: Union[ + SynchronousMultiLogRecordProcessor, + ConcurrentMultiLogRecordProcessor, + ] = None, + ): + self._resource = resource + self._multi_log_record_processor = ( + multi_log_record_processor or SynchronousMultiLogRecordProcessor() + ) + self._at_exit_handler = None + if shutdown_on_exit: + self._at_exit_handler = atexit.register(self.shutdown) + + @property + def resource(self): + return self._resource + + def get_logger( + self, + name: str, + version: Optional[str] = None, + schema_url: Optional[str] = None, + ) -> Logger: + return Logger( + self._resource, + self._multi_log_record_processor, + InstrumentationScope( + name, + version, + schema_url, + ), + ) + + def add_log_record_processor( + self, log_record_processor: LogRecordProcessor + ): + """Registers a new :class:`LogRecordProcessor` for this `LoggerProvider` instance. + + The log processors are invoked in the same order they are registered. + """ + self._multi_log_record_processor.add_log_record_processor( + log_record_processor + ) + + def shutdown(self): + """Shuts down the log processors.""" + self._multi_log_record_processor.shutdown() + if self._at_exit_handler is not None: + atexit.unregister(self._at_exit_handler) + self._at_exit_handler = None + + def force_flush(self, timeout_millis: int = 30000) -> bool: + """Force flush the log processors. + + Args: + timeout_millis: The maximum amount of time to wait for logs to be + exported. + + Returns: + True if all the log processors flushes the logs within timeout, + False otherwise. + """ + return self._multi_log_record_processor.force_flush(timeout_millis) diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/_logs/_internal/export/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/_logs/_internal/export/__init__.py new file mode 100644 index 00000000000..3f19b79e100 --- /dev/null +++ b/opentelemetry-sdk/src/opentelemetry/sdk/_logs/_internal/export/__init__.py @@ -0,0 +1,330 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import abc +import collections +import enum +import logging +import os +import sys +import threading +from os import linesep +from time import time_ns +from typing import IO, Callable, Deque, List, Optional, Sequence + +from opentelemetry.context import attach, detach, set_value +from opentelemetry.sdk._logs import LogData, LogRecord, LogRecordProcessor +from opentelemetry.util._once import Once + +_logger = logging.getLogger(__name__) + + +class LogExportResult(enum.Enum): + SUCCESS = 0 + FAILURE = 1 + + +class LogExporter(abc.ABC): + """Interface for exporting logs. + + Interface to be implemented by services that want to export logs received + in their own format. + + To export data this MUST be registered to the :class`opentelemetry.sdk._logs.Logger` using a + log processor. + """ + + @abc.abstractmethod + def export(self, batch: Sequence[LogData]): + """Exports a batch of logs. + + Args: + batch: The list of `LogData` objects to be exported + + Returns: + The result of the export + """ + + @abc.abstractmethod + def shutdown(self): + """Shuts down the exporter. + + Called when the SDK is shut down. + """ + + +class ConsoleLogExporter(LogExporter): + """Implementation of :class:`LogExporter` that prints log records to the + console. + + This class can be used for diagnostic purposes. It prints the exported + log records to the console STDOUT. + """ + + def __init__( + self, + out: IO = sys.stdout, + formatter: Callable[[LogRecord], str] = lambda record: record.to_json() + + linesep, + ): + self.out = out + self.formatter = formatter + + def export(self, batch: Sequence[LogData]): + for data in batch: + self.out.write(self.formatter(data.log_record)) + self.out.flush() + return LogExportResult.SUCCESS + + def shutdown(self): + pass + + +class SimpleLogRecordProcessor(LogRecordProcessor): + """This is an implementation of LogRecordProcessor which passes + received logs in the export-friendly LogData representation to the + configured LogExporter, as soon as they are emitted. + """ + + def __init__(self, exporter: LogExporter): + self._exporter = exporter + self._shutdown = False + + def emit(self, log_data: LogData): + if self._shutdown: + _logger.warning("Processor is already shutdown, ignoring call") + return + token = attach(set_value("suppress_instrumentation", True)) + try: + self._exporter.export((log_data,)) + except Exception: # pylint: disable=broad-except + _logger.exception("Exception while exporting logs.") + detach(token) + + def shutdown(self): + self._shutdown = True + self._exporter.shutdown() + + def force_flush( + self, timeout_millis: int = 30000 + ) -> bool: # pylint: disable=no-self-use + return True + + +class _FlushRequest: + __slots__ = ["event", "num_log_records"] + + def __init__(self): + self.event = threading.Event() + self.num_log_records = 0 + + +_BSP_RESET_ONCE = Once() + + +class BatchLogRecordProcessor(LogRecordProcessor): + """This is an implementation of LogRecordProcessor which creates batches of + received logs in the export-friendly LogData representation and + send to the configured LogExporter, as soon as they are emitted. + """ + + def __init__( + self, + exporter: LogExporter, + schedule_delay_millis: int = 5000, + max_export_batch_size: int = 512, + export_timeout_millis: int = 30000, + ): + self._exporter = exporter + self._schedule_delay_millis = schedule_delay_millis + self._max_export_batch_size = max_export_batch_size + self._export_timeout_millis = export_timeout_millis + self._queue = collections.deque() # type: Deque[LogData] + self._worker_thread = threading.Thread( + name="OtelBatchLogRecordProcessor", + target=self.worker, + daemon=True, + ) + self._condition = threading.Condition(threading.Lock()) + self._shutdown = False + self._flush_request = None # type: Optional[_FlushRequest] + self._log_records = [ + None + ] * self._max_export_batch_size # type: List[Optional[LogData]] + self._worker_thread.start() + # Only available in *nix since py37. + if hasattr(os, "register_at_fork"): + os.register_at_fork( + after_in_child=self._at_fork_reinit + ) # pylint: disable=protected-access + self._pid = os.getpid() + + def _at_fork_reinit(self): + self._condition = threading.Condition(threading.Lock()) + self._queue.clear() + self._worker_thread = threading.Thread( + name="OtelBatchLogRecordProcessor", + target=self.worker, + daemon=True, + ) + self._worker_thread.start() + self._pid = os.getpid() + + def worker(self): + timeout = self._schedule_delay_millis / 1e3 + flush_request = None # type: Optional[_FlushRequest] + while not self._shutdown: + with self._condition: + if self._shutdown: + # shutdown may have been called, avoid further processing + break + flush_request = self._get_and_unset_flush_request() + if ( + len(self._queue) < self._max_export_batch_size + and flush_request is None + ): + self._condition.wait(timeout) + + flush_request = self._get_and_unset_flush_request() + if not self._queue: + timeout = self._schedule_delay_millis / 1e3 + self._notify_flush_request_finished(flush_request) + flush_request = None + continue + if self._shutdown: + break + + start_ns = time_ns() + self._export(flush_request) + end_ns = time_ns() + # subtract the duration of this export call to the next timeout + timeout = self._schedule_delay_millis / 1e3 - ( + (end_ns - start_ns) / 1e9 + ) + + self._notify_flush_request_finished(flush_request) + flush_request = None + + # there might have been a new flush request while export was running + # and before the done flag switched to true + with self._condition: + shutdown_flush_request = self._get_and_unset_flush_request() + + # flush the remaining logs + self._drain_queue() + self._notify_flush_request_finished(flush_request) + self._notify_flush_request_finished(shutdown_flush_request) + + def _export(self, flush_request: Optional[_FlushRequest] = None): + """Exports logs considering the given flush_request. + + If flush_request is not None then logs are exported in batches + until the number of exported logs reached or exceeded the num of logs in + flush_request, otherwise exports at max max_export_batch_size logs. + """ + if flush_request is None: + self._export_batch() + return + + num_log_records = flush_request.num_log_records + while self._queue: + exported = self._export_batch() + num_log_records -= exported + + if num_log_records <= 0: + break + + def _export_batch(self) -> int: + """Exports at most max_export_batch_size logs and returns the number of + exported logs. + """ + idx = 0 + while idx < self._max_export_batch_size and self._queue: + record = self._queue.pop() + self._log_records[idx] = record + idx += 1 + token = attach(set_value("suppress_instrumentation", True)) + try: + self._exporter.export(self._log_records[:idx]) # type: ignore + except Exception: # pylint: disable=broad-except + _logger.exception("Exception while exporting logs.") + detach(token) + + for index in range(idx): + self._log_records[index] = None + return idx + + def _drain_queue(self): + """Export all elements until queue is empty. + + Can only be called from the worker thread context because it invokes + `export` that is not thread safe. + """ + while self._queue: + self._export_batch() + + def _get_and_unset_flush_request(self) -> Optional[_FlushRequest]: + flush_request = self._flush_request + self._flush_request = None + if flush_request is not None: + flush_request.num_log_records = len(self._queue) + return flush_request + + @staticmethod + def _notify_flush_request_finished( + flush_request: Optional[_FlushRequest] = None, + ): + if flush_request is not None: + flush_request.event.set() + + def _get_or_create_flush_request(self) -> _FlushRequest: + if self._flush_request is None: + self._flush_request = _FlushRequest() + return self._flush_request + + def emit(self, log_data: LogData) -> None: + """Adds the `LogData` to queue and notifies the waiting threads + when size of queue reaches max_export_batch_size. + """ + if self._shutdown: + return + if self._pid != os.getpid(): + _BSP_RESET_ONCE.do_once(self._at_fork_reinit) + + self._queue.appendleft(log_data) + if len(self._queue) >= self._max_export_batch_size: + with self._condition: + self._condition.notify() + + def shutdown(self): + self._shutdown = True + with self._condition: + self._condition.notify_all() + self._worker_thread.join() + self._exporter.shutdown() + + def force_flush(self, timeout_millis: Optional[int] = None) -> bool: + if timeout_millis is None: + timeout_millis = self._export_timeout_millis + if self._shutdown: + return True + + with self._condition: + flush_request = self._get_or_create_flush_request() + self._condition.notify_all() + + ret = flush_request.event.wait(timeout_millis / 1e3) + if not ret: + _logger.warning("Timeout was exceeded in force_flush().") + return ret diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/_logs/export/in_memory_log_exporter.py b/opentelemetry-sdk/src/opentelemetry/sdk/_logs/_internal/export/in_memory_log_exporter.py similarity index 100% rename from opentelemetry-sdk/src/opentelemetry/sdk/_logs/export/in_memory_log_exporter.py rename to opentelemetry-sdk/src/opentelemetry/sdk/_logs/_internal/export/in_memory_log_exporter.py diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/_logs/export/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/_logs/export/__init__.py index 3f19b79e100..10402886671 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/_logs/export/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/_logs/export/__init__.py @@ -12,319 +12,23 @@ # See the License for the specific language governing permissions and # limitations under the License. -import abc -import collections -import enum -import logging -import os -import sys -import threading -from os import linesep -from time import time_ns -from typing import IO, Callable, Deque, List, Optional, Sequence - -from opentelemetry.context import attach, detach, set_value -from opentelemetry.sdk._logs import LogData, LogRecord, LogRecordProcessor -from opentelemetry.util._once import Once - -_logger = logging.getLogger(__name__) - - -class LogExportResult(enum.Enum): - SUCCESS = 0 - FAILURE = 1 - - -class LogExporter(abc.ABC): - """Interface for exporting logs. - - Interface to be implemented by services that want to export logs received - in their own format. - - To export data this MUST be registered to the :class`opentelemetry.sdk._logs.Logger` using a - log processor. - """ - - @abc.abstractmethod - def export(self, batch: Sequence[LogData]): - """Exports a batch of logs. - - Args: - batch: The list of `LogData` objects to be exported - - Returns: - The result of the export - """ - - @abc.abstractmethod - def shutdown(self): - """Shuts down the exporter. - - Called when the SDK is shut down. - """ - - -class ConsoleLogExporter(LogExporter): - """Implementation of :class:`LogExporter` that prints log records to the - console. - - This class can be used for diagnostic purposes. It prints the exported - log records to the console STDOUT. - """ - - def __init__( - self, - out: IO = sys.stdout, - formatter: Callable[[LogRecord], str] = lambda record: record.to_json() - + linesep, - ): - self.out = out - self.formatter = formatter - - def export(self, batch: Sequence[LogData]): - for data in batch: - self.out.write(self.formatter(data.log_record)) - self.out.flush() - return LogExportResult.SUCCESS - - def shutdown(self): - pass - - -class SimpleLogRecordProcessor(LogRecordProcessor): - """This is an implementation of LogRecordProcessor which passes - received logs in the export-friendly LogData representation to the - configured LogExporter, as soon as they are emitted. - """ - - def __init__(self, exporter: LogExporter): - self._exporter = exporter - self._shutdown = False - - def emit(self, log_data: LogData): - if self._shutdown: - _logger.warning("Processor is already shutdown, ignoring call") - return - token = attach(set_value("suppress_instrumentation", True)) - try: - self._exporter.export((log_data,)) - except Exception: # pylint: disable=broad-except - _logger.exception("Exception while exporting logs.") - detach(token) - - def shutdown(self): - self._shutdown = True - self._exporter.shutdown() - - def force_flush( - self, timeout_millis: int = 30000 - ) -> bool: # pylint: disable=no-self-use - return True - - -class _FlushRequest: - __slots__ = ["event", "num_log_records"] - - def __init__(self): - self.event = threading.Event() - self.num_log_records = 0 - - -_BSP_RESET_ONCE = Once() - - -class BatchLogRecordProcessor(LogRecordProcessor): - """This is an implementation of LogRecordProcessor which creates batches of - received logs in the export-friendly LogData representation and - send to the configured LogExporter, as soon as they are emitted. - """ - - def __init__( - self, - exporter: LogExporter, - schedule_delay_millis: int = 5000, - max_export_batch_size: int = 512, - export_timeout_millis: int = 30000, - ): - self._exporter = exporter - self._schedule_delay_millis = schedule_delay_millis - self._max_export_batch_size = max_export_batch_size - self._export_timeout_millis = export_timeout_millis - self._queue = collections.deque() # type: Deque[LogData] - self._worker_thread = threading.Thread( - name="OtelBatchLogRecordProcessor", - target=self.worker, - daemon=True, - ) - self._condition = threading.Condition(threading.Lock()) - self._shutdown = False - self._flush_request = None # type: Optional[_FlushRequest] - self._log_records = [ - None - ] * self._max_export_batch_size # type: List[Optional[LogData]] - self._worker_thread.start() - # Only available in *nix since py37. - if hasattr(os, "register_at_fork"): - os.register_at_fork( - after_in_child=self._at_fork_reinit - ) # pylint: disable=protected-access - self._pid = os.getpid() - - def _at_fork_reinit(self): - self._condition = threading.Condition(threading.Lock()) - self._queue.clear() - self._worker_thread = threading.Thread( - name="OtelBatchLogRecordProcessor", - target=self.worker, - daemon=True, - ) - self._worker_thread.start() - self._pid = os.getpid() - - def worker(self): - timeout = self._schedule_delay_millis / 1e3 - flush_request = None # type: Optional[_FlushRequest] - while not self._shutdown: - with self._condition: - if self._shutdown: - # shutdown may have been called, avoid further processing - break - flush_request = self._get_and_unset_flush_request() - if ( - len(self._queue) < self._max_export_batch_size - and flush_request is None - ): - self._condition.wait(timeout) - - flush_request = self._get_and_unset_flush_request() - if not self._queue: - timeout = self._schedule_delay_millis / 1e3 - self._notify_flush_request_finished(flush_request) - flush_request = None - continue - if self._shutdown: - break - - start_ns = time_ns() - self._export(flush_request) - end_ns = time_ns() - # subtract the duration of this export call to the next timeout - timeout = self._schedule_delay_millis / 1e3 - ( - (end_ns - start_ns) / 1e9 - ) - - self._notify_flush_request_finished(flush_request) - flush_request = None - - # there might have been a new flush request while export was running - # and before the done flag switched to true - with self._condition: - shutdown_flush_request = self._get_and_unset_flush_request() - - # flush the remaining logs - self._drain_queue() - self._notify_flush_request_finished(flush_request) - self._notify_flush_request_finished(shutdown_flush_request) - - def _export(self, flush_request: Optional[_FlushRequest] = None): - """Exports logs considering the given flush_request. - - If flush_request is not None then logs are exported in batches - until the number of exported logs reached or exceeded the num of logs in - flush_request, otherwise exports at max max_export_batch_size logs. - """ - if flush_request is None: - self._export_batch() - return - - num_log_records = flush_request.num_log_records - while self._queue: - exported = self._export_batch() - num_log_records -= exported - - if num_log_records <= 0: - break - - def _export_batch(self) -> int: - """Exports at most max_export_batch_size logs and returns the number of - exported logs. - """ - idx = 0 - while idx < self._max_export_batch_size and self._queue: - record = self._queue.pop() - self._log_records[idx] = record - idx += 1 - token = attach(set_value("suppress_instrumentation", True)) - try: - self._exporter.export(self._log_records[:idx]) # type: ignore - except Exception: # pylint: disable=broad-except - _logger.exception("Exception while exporting logs.") - detach(token) - - for index in range(idx): - self._log_records[index] = None - return idx - - def _drain_queue(self): - """Export all elements until queue is empty. - - Can only be called from the worker thread context because it invokes - `export` that is not thread safe. - """ - while self._queue: - self._export_batch() - - def _get_and_unset_flush_request(self) -> Optional[_FlushRequest]: - flush_request = self._flush_request - self._flush_request = None - if flush_request is not None: - flush_request.num_log_records = len(self._queue) - return flush_request - - @staticmethod - def _notify_flush_request_finished( - flush_request: Optional[_FlushRequest] = None, - ): - if flush_request is not None: - flush_request.event.set() - - def _get_or_create_flush_request(self) -> _FlushRequest: - if self._flush_request is None: - self._flush_request = _FlushRequest() - return self._flush_request - - def emit(self, log_data: LogData) -> None: - """Adds the `LogData` to queue and notifies the waiting threads - when size of queue reaches max_export_batch_size. - """ - if self._shutdown: - return - if self._pid != os.getpid(): - _BSP_RESET_ONCE.do_once(self._at_fork_reinit) - - self._queue.appendleft(log_data) - if len(self._queue) >= self._max_export_batch_size: - with self._condition: - self._condition.notify() - - def shutdown(self): - self._shutdown = True - with self._condition: - self._condition.notify_all() - self._worker_thread.join() - self._exporter.shutdown() - - def force_flush(self, timeout_millis: Optional[int] = None) -> bool: - if timeout_millis is None: - timeout_millis = self._export_timeout_millis - if self._shutdown: - return True - - with self._condition: - flush_request = self._get_or_create_flush_request() - self._condition.notify_all() - - ret = flush_request.event.wait(timeout_millis / 1e3) - if not ret: - _logger.warning("Timeout was exceeded in force_flush().") - return ret +# pylint: disable=unused-import + +from opentelemetry.sdk._logs._internal.export import ( # noqa: F401 + BatchLogRecordProcessor, + ConsoleLogExporter, + LogExporter, + LogExportResult, + SimpleLogRecordProcessor, +) + +# The point module is not in the export directory to avoid a circular import. +from opentelemetry.sdk._logs._internal.export.in_memory_log_exporter import ( # noqa: F401 + InMemoryLogExporter, +) + +__all__ = [] +for key, value in globals().copy().items(): + if not key.startswith("_"): + value.__module__ = __name__ + __all__.append(key) diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py b/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py index 17a669e01f5..562863156fc 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables.py @@ -501,14 +501,6 @@ If both are set, :envvar:`OTEL_SERVICE_NAME` takes precedence. """ -_OTEL_PYTHON_LOGGER_PROVIDER = "OTEL_PYTHON_LOGGER_PROVIDER" -""" -.. envvar:: OTEL_PYTHON_LOGGER_PROVIDER - -The :envvar:`OTEL_PYTHON_LOGGER_PROVIDER` environment variable allows users to -provide the entry point for loading the log emitter provider. If not specified, SDK -LoggerProvider is used. -""" _OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED = ( "OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED" diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/resources/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/resources/__init__.py index 3088dbc5bbf..56707415e5b 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/resources/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/resources/__init__.py @@ -62,6 +62,7 @@ import sys import typing from json import dumps +from urllib import parse import pkg_resources @@ -289,7 +290,8 @@ def detect(self) -> "Resource": exc, ) continue - env_resource_map[key.strip()] = value.strip() + value_url_decoded = parse.unquote(value.strip()) + env_resource_map[key.strip()] = value_url_decoded service_name = os.environ.get(OTEL_SERVICE_NAME) if service_name: diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py index 0ddf531a4d5..739f59ee706 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py @@ -37,6 +37,7 @@ Type, Union, ) +from warnings import filterwarnings, resetwarnings from deprecated import deprecated @@ -1167,16 +1168,20 @@ def get_tracer( logger.error("get_tracer called with missing module name.") if instrumenting_library_version is None: instrumenting_library_version = "" + + filterwarnings("ignore", category=DeprecationWarning) + instrumentation_info = InstrumentationInfo( + instrumenting_module_name, + instrumenting_library_version, + schema_url, + ) + resetwarnings() return Tracer( self.sampler, self.resource, self._active_span_processor, self.id_generator, - InstrumentationInfo( - instrumenting_module_name, - instrumenting_library_version, - schema_url, - ), + instrumentation_info, self._span_limits, InstrumentationScope( instrumenting_module_name, diff --git a/opentelemetry-sdk/tests/logs/test_export.py b/opentelemetry-sdk/tests/logs/test_export.py index e65fc04a423..6a6b1d5bf86 100644 --- a/opentelemetry-sdk/tests/logs/test_export.py +++ b/opentelemetry-sdk/tests/logs/test_export.py @@ -21,6 +21,7 @@ from concurrent.futures import ThreadPoolExecutor from unittest.mock import Mock, patch +from opentelemetry._logs import SeverityNumber from opentelemetry.sdk import trace from opentelemetry.sdk._logs import ( LogData, @@ -31,12 +32,9 @@ from opentelemetry.sdk._logs.export import ( BatchLogRecordProcessor, ConsoleLogExporter, - SimpleLogRecordProcessor, -) -from opentelemetry.sdk._logs.export.in_memory_log_exporter import ( InMemoryLogExporter, + SimpleLogRecordProcessor, ) -from opentelemetry.sdk._logs.severity import SeverityNumber from opentelemetry.sdk.resources import Resource as SDKResource from opentelemetry.sdk.util.instrumentation import InstrumentationScope from opentelemetry.test.concurrency_test import ConcurrencyTestBase diff --git a/opentelemetry-sdk/tests/logs/test_global_provider.py b/opentelemetry-sdk/tests/logs/test_global_provider.py deleted file mode 100644 index d888789898f..00000000000 --- a/opentelemetry-sdk/tests/logs/test_global_provider.py +++ /dev/null @@ -1,75 +0,0 @@ -# Copyright The OpenTelemetry Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# type:ignore -import unittest -from importlib import reload -from logging import WARNING -from unittest.mock import patch - -from opentelemetry.sdk import _logs -from opentelemetry.sdk._logs import ( - LoggerProvider, - get_logger_provider, - set_logger_provider, -) -from opentelemetry.sdk.environment_variables import ( - _OTEL_PYTHON_LOGGER_PROVIDER, -) - - -class TestGlobals(unittest.TestCase): - def tearDown(self): - reload(_logs) - - def check_override_not_allowed(self): - """set_logger_provider should throw a warning when overridden""" - provider = get_logger_provider() - with self.assertLogs(level=WARNING) as test: - set_logger_provider(LoggerProvider()) - self.assertEqual( - test.output, - [ - ( - "WARNING:opentelemetry.sdk._logs:Overriding of current " - "LoggerProvider is not allowed" - ) - ], - ) - self.assertIs(provider, get_logger_provider()) - - def test_set_tracer_provider(self): - reload(_logs) - provider = LoggerProvider() - set_logger_provider(provider) - retrieved_provider = get_logger_provider() - self.assertEqual(provider, retrieved_provider) - - def test_tracer_provider_override_warning(self): - reload(_logs) - self.check_override_not_allowed() - - @patch.dict( - "os.environ", - {_OTEL_PYTHON_LOGGER_PROVIDER: "sdk_logger_provider"}, - ) - def test_sdk_logger_provider(self): - reload(_logs) - self.check_override_not_allowed() - - @patch.dict("os.environ", {_OTEL_PYTHON_LOGGER_PROVIDER: "unknown"}) - def test_unknown_logger_provider(self): - reload(_logs) - with self.assertRaises(Exception): - get_logger_provider() diff --git a/opentelemetry-sdk/tests/logs/test_handler.py b/opentelemetry-sdk/tests/logs/test_handler.py index 771179c3d22..b9c40608e14 100644 --- a/opentelemetry-sdk/tests/logs/test_handler.py +++ b/opentelemetry-sdk/tests/logs/test_handler.py @@ -15,10 +15,10 @@ import unittest from unittest.mock import Mock +from opentelemetry._logs import SeverityNumber +from opentelemetry._logs import get_logger as APIGetLogger from opentelemetry.sdk import trace from opentelemetry.sdk._logs import LoggerProvider, LoggingHandler -from opentelemetry.sdk._logs import get_logger as sdk_get_logger -from opentelemetry.sdk._logs.severity import SeverityNumber from opentelemetry.semconv.trace import SpanAttributes from opentelemetry.trace import INVALID_SPAN_CONTEXT @@ -33,7 +33,7 @@ def get_logger(level=logging.NOTSET, logger_provider=None): class TestLoggingHandler(unittest.TestCase): def test_handler_default_log_level(self): emitter_provider_mock = Mock(spec=LoggerProvider) - emitter_mock = sdk_get_logger( + emitter_mock = APIGetLogger( __name__, logger_provider=emitter_provider_mock ) logger = get_logger(logger_provider=emitter_provider_mock) @@ -46,7 +46,7 @@ def test_handler_default_log_level(self): def test_handler_custom_log_level(self): emitter_provider_mock = Mock(spec=LoggerProvider) - emitter_mock = sdk_get_logger( + emitter_mock = APIGetLogger( __name__, logger_provider=emitter_provider_mock ) logger = get_logger( @@ -61,7 +61,7 @@ def test_handler_custom_log_level(self): def test_log_record_no_span_context(self): emitter_provider_mock = Mock(spec=LoggerProvider) - emitter_mock = sdk_get_logger( + emitter_mock = APIGetLogger( __name__, logger_provider=emitter_provider_mock ) logger = get_logger(logger_provider=emitter_provider_mock) @@ -80,7 +80,7 @@ def test_log_record_no_span_context(self): def test_log_record_user_attributes(self): """Attributes can be injected into logs by adding them to the LogRecord""" emitter_provider_mock = Mock(spec=LoggerProvider) - emitter_mock = sdk_get_logger( + emitter_mock = APIGetLogger( __name__, logger_provider=emitter_provider_mock ) logger = get_logger(logger_provider=emitter_provider_mock) @@ -95,7 +95,7 @@ def test_log_record_user_attributes(self): def test_log_record_exception(self): """Exception information will be included in attributes""" emitter_provider_mock = Mock(spec=LoggerProvider) - emitter_mock = sdk_get_logger( + emitter_mock = APIGetLogger( __name__, logger_provider=emitter_provider_mock ) logger = get_logger(logger_provider=emitter_provider_mock) @@ -128,7 +128,7 @@ def test_log_record_exception(self): def test_log_exc_info_false(self): """Exception information will be included in attributes""" emitter_provider_mock = Mock(spec=LoggerProvider) - emitter_mock = sdk_get_logger( + emitter_mock = APIGetLogger( __name__, logger_provider=emitter_provider_mock ) logger = get_logger(logger_provider=emitter_provider_mock) @@ -151,7 +151,7 @@ def test_log_exc_info_false(self): def test_log_record_trace_correlation(self): emitter_provider_mock = Mock(spec=LoggerProvider) - emitter_mock = sdk_get_logger( + emitter_mock = APIGetLogger( __name__, logger_provider=emitter_provider_mock ) logger = get_logger(logger_provider=emitter_provider_mock) diff --git a/opentelemetry-sdk/tests/logs/test_logs.py b/opentelemetry-sdk/tests/logs/test_logs.py new file mode 100644 index 00000000000..80a7d66f1cf --- /dev/null +++ b/opentelemetry-sdk/tests/logs/test_logs.py @@ -0,0 +1,58 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# pylint: disable=protected-access + +import unittest + +from opentelemetry.sdk._logs import LoggerProvider +from opentelemetry.sdk.resources import Resource + + +class TestLoggerProvider(unittest.TestCase): + def test_resource(self): + """ + `LoggerProvider` provides a way to allow a `Resource` to be specified. + """ + + logger_provider_0 = LoggerProvider() + logger_provider_1 = LoggerProvider() + + self.assertIs( + logger_provider_0.resource, + logger_provider_1.resource, + ) + self.assertIsInstance(logger_provider_0.resource, Resource) + self.assertIsInstance(logger_provider_1.resource, Resource) + + resource = Resource({"key": "value"}) + self.assertIs(LoggerProvider(resource=resource).resource, resource) + + def test_get_logger(self): + """ + `LoggerProvider.get_logger` arguments are used to create an + `InstrumentationScope` object on the created `Logger`. + """ + + logger = LoggerProvider().get_logger( + "name", + version="version", + schema_url="schema_url", + ) + + self.assertEqual(logger._instrumentation_scope.name, "name") + self.assertEqual(logger._instrumentation_scope.version, "version") + self.assertEqual( + logger._instrumentation_scope.schema_url, "schema_url" + ) diff --git a/opentelemetry-sdk/tests/logs/test_multi_log_prcessor.py b/opentelemetry-sdk/tests/logs/test_multi_log_processor.py similarity index 98% rename from opentelemetry-sdk/tests/logs/test_multi_log_prcessor.py rename to opentelemetry-sdk/tests/logs/test_multi_log_processor.py index 004bc296bec..0d5ac8b1154 100644 --- a/opentelemetry-sdk/tests/logs/test_multi_log_prcessor.py +++ b/opentelemetry-sdk/tests/logs/test_multi_log_processor.py @@ -21,7 +21,8 @@ from abc import ABC, abstractmethod from unittest.mock import Mock -from opentelemetry.sdk._logs import ( +from opentelemetry._logs import SeverityNumber +from opentelemetry.sdk._logs._internal import ( ConcurrentMultiLogRecordProcessor, LoggerProvider, LoggingHandler, @@ -29,7 +30,6 @@ LogRecordProcessor, SynchronousMultiLogRecordProcessor, ) -from opentelemetry.sdk._logs.severity import SeverityNumber class AnotherLogRecordProcessor(LogRecordProcessor): diff --git a/opentelemetry-sdk/tests/resources/test_resources.py b/opentelemetry-sdk/tests/resources/test_resources.py index 2d584981e62..c9649f685ad 100644 --- a/opentelemetry-sdk/tests/resources/test_resources.py +++ b/opentelemetry-sdk/tests/resources/test_resources.py @@ -19,6 +19,7 @@ import uuid from logging import ERROR from unittest import mock +from urllib import parse from opentelemetry.sdk import resources @@ -492,6 +493,25 @@ def test_invalid_key_value_pairs(self): resources.Resource({"k": "v", "k2": "v2", "foo": "bar=baz"}), ) + def test_multiple_with_url_decode(self): + detector = resources.OTELResourceDetector() + os.environ[ + resources.OTEL_RESOURCE_ATTRIBUTES + ] = "key=value%20test%0A, key2=value+%202" + self.assertEqual( + detector.detect(), + resources.Resource({"key": "value test\n", "key2": "value+ 2"}), + ) + self.assertEqual( + detector.detect(), + resources.Resource( + { + "key": parse.unquote("value%20test%0A"), + "key2": parse.unquote("value+%202"), + } + ), + ) + @mock.patch.dict( os.environ, {resources.OTEL_SERVICE_NAME: "test-srv-name"}, diff --git a/opentelemetry-sdk/tests/trace/export/test_export.py b/opentelemetry-sdk/tests/trace/export/test_export.py index de9b1564efd..422945798ff 100644 --- a/opentelemetry-sdk/tests/trace/export/test_export.py +++ b/opentelemetry-sdk/tests/trace/export/test_export.py @@ -19,10 +19,10 @@ import unittest from concurrent.futures import ThreadPoolExecutor from logging import WARNING -from platform import python_implementation +from platform import python_implementation, system from unittest import mock -from flaky import flaky +from pytest import mark from opentelemetry import trace as trace_api from opentelemetry.context import Context @@ -442,6 +442,10 @@ def test_batch_span_processor_scheduled_delay(self): span_processor.shutdown() + @mark.skipif( + python_implementation() == "PyPy" and system() == "Windows", + reason="This test randomly fails in Windows with PyPy", + ) def test_batch_span_processor_reset_timeout(self): """Test that the scheduled timeout is reset on cycles without spans""" spans_names_list = [] @@ -480,11 +484,6 @@ def test_batch_span_processor_reset_timeout(self): span_processor.shutdown() - if python_implementation() == "PyPy": - test_batch_span_processor_reset_timeout = flaky( - max_runs=2, min_passes=1 - )(test_batch_span_processor_reset_timeout) - def test_batch_span_processor_parameters(self): # zero max_queue_size self.assertRaises( diff --git a/opentelemetry-sdk/tests/trace/test_trace.py b/opentelemetry-sdk/tests/trace/test_trace.py index 5bb8d87c658..7b86fa7247d 100644 --- a/opentelemetry-sdk/tests/trace/test_trace.py +++ b/opentelemetry-sdk/tests/trace/test_trace.py @@ -23,6 +23,7 @@ from time import time_ns from typing import Optional from unittest import mock +from unittest.mock import Mock from opentelemetry import trace as trace_api from opentelemetry.context import Context @@ -39,7 +40,7 @@ OTEL_TRACES_SAMPLER, OTEL_TRACES_SAMPLER_ARG, ) -from opentelemetry.sdk.trace import Resource +from opentelemetry.sdk.trace import Resource, TracerProvider from opentelemetry.sdk.trace.id_generator import RandomIdGenerator from opentelemetry.sdk.trace.sampling import ( ALWAYS_OFF, @@ -58,6 +59,11 @@ class TestTracer(unittest.TestCase): + def test_no_deprecated_warning(self): + with self.assertRaises(AssertionError): + with self.assertWarns(DeprecationWarning): + TracerProvider(Mock(), Mock()).get_tracer(Mock(), Mock()) + def test_extends_api(self): tracer = new_tracer() self.assertIsInstance(tracer, trace.Tracer) diff --git a/scripts/proto_codegen.sh b/scripts/proto_codegen.sh index 7ba991ea4ea..7625848f71b 100755 --- a/scripts/proto_codegen.sh +++ b/scripts/proto_codegen.sh @@ -34,6 +34,8 @@ source $venv_dir/bin/activate python -m pip install \ -c $repo_root/dev-requirements.txt \ grpcio-tools mypy-protobuf +echo 'python -m grpc_tools.protoc --version' +python -m grpc_tools.protoc --version # Clone the proto repo if it doesn't exist if [ ! -d "$PROTO_REPO_DIR" ]; then @@ -64,6 +66,7 @@ python -m grpc_tools.protoc \ # generate grpc output only for protos with service definitions service_protos=$(grep -REl "service \w+ {" $PROTO_REPO_DIR/opentelemetry/) + python -m grpc_tools.protoc \ -I $PROTO_REPO_DIR \ --python_out=. \ diff --git a/tests/opentelemetry-test-utils/src/opentelemetry/test/globals_test.py b/tests/opentelemetry-test-utils/src/opentelemetry/test/globals_test.py index 19ee5f85eaf..23b3112430d 100644 --- a/tests/opentelemetry-test-utils/src/opentelemetry/test/globals_test.py +++ b/tests/opentelemetry-test-utils/src/opentelemetry/test/globals_test.py @@ -15,6 +15,7 @@ import unittest from opentelemetry import trace as trace_api +from opentelemetry._logs import _internal as logging_api from opentelemetry.metrics import _internal as metrics_api from opentelemetry.metrics._internal import _ProxyMeterProvider from opentelemetry.util._once import Once @@ -36,6 +37,14 @@ def reset_metrics_globals() -> None: metrics_api._PROXY_METER_PROVIDER = _ProxyMeterProvider() # type: ignore[attr-defined] +# pylint: disable=protected-access +def reset_logging_globals() -> None: + """WARNING: only use this for tests.""" + logging_api._LOGGER_PROVIDER_SET_ONCE = Once() # type: ignore[attr-defined] + logging_api._LOGGER_PROVIDER = None # type: ignore[attr-defined] + # logging_api._PROXY_LOGGER_PROVIDER = _ProxyLoggerProvider() # type: ignore[attr-defined] + + class TraceGlobalsTest(unittest.TestCase): """Resets trace API globals in setUp/tearDown diff --git a/tox.ini b/tox.ini index 90f8f8d94b2..147931eb6b8 100644 --- a/tox.ini +++ b/tox.ini @@ -8,8 +8,9 @@ envlist = py3{7,8,9,10,11}-opentelemetry-api pypy3-opentelemetry-api - py3{7,8,9,10,11}-opentelemetry-protobuf - pypy3-opentelemetry-protobuf + ; Test against both protobuf 3.x and 4.x + py3{7,8,9,10,11}-proto{3,4}-opentelemetry-protobuf + pypy3-proto{3,4}-opentelemetry-protobuf py3{7,8,9,10,11}-opentelemetry-sdk pypy3-opentelemetry-sdk @@ -37,11 +38,11 @@ envlist = py3{7,8,9,10,11}-opentelemetry-exporter-otlp-combined ; intentionally excluded from pypy3 - py3{7,8,9,10,11}-opentelemetry-exporter-otlp-proto-grpc + py3{7,8,9,10,11}-proto{3,4}-opentelemetry-exporter-otlp-proto-grpc ; intentionally excluded from pypy3 - py3{7,8,9,10,11}-opentelemetry-exporter-otlp-proto-http - pypy3-opentelemetry-exporter-otlp-proto-http + py3{7,8,9,10,11}-proto{3,4}-opentelemetry-exporter-otlp-proto-http + pypy3-opentelemetry-proto{3,4}-exporter-otlp-proto-http py3{7,8,9,10,11}-opentelemetry-exporter-prometheus pypy3-opentelemetry-exporter-prometheus @@ -67,7 +68,7 @@ envlist = tracecontext mypy,mypyinstalled docs - docker-tests + docker-tests-proto{3,4} public-symbols-check [testenv] @@ -80,6 +81,11 @@ deps = coverage: pytest-cov mypy,mypyinstalled: mypy + ; proto 3 and 4 tests install the respective version of protobuf + proto3: protobuf~=3.19.0 + proto4: protobuf~=4.0 + + setenv = ; override CONTRIB_REPO_SHA via env variable when testing other branches/commits than main ; i.e: CONTRIB_REPO_SHA=dde62cebffe519c35875af6d06fae053b3be65ec tox -e @@ -272,27 +278,36 @@ commands_pre = commands = {toxinidir}/scripts/tracecontext-integration-test.sh -[testenv:docker-tests] +[testenv:docker-tests-proto{3,4}] deps = pytest docker-compose >= 1.25.2 + ; proto 3 and 4 tests install the respective version of protobuf + proto3: protobuf~=3.19.0 + proto4: protobuf~=4.0 + changedir = tests/opentelemetry-docker-tests/tests commands_pre = + pip freeze pip install -e {toxinidir}/opentelemetry-api \ -e {toxinidir}/opentelemetry-semantic-conventions \ -e {toxinidir}/opentelemetry-sdk \ -e {toxinidir}/tests/opentelemetry-test-utils \ - -e {toxinidir}/exporter/opentelemetry-exporter-opencensus \ + ; opencensus exporter does not work with protobuf 4 + proto3: -e {toxinidir}/exporter/opentelemetry-exporter-opencensus \ -e {toxinidir}/opentelemetry-proto \ -e {toxinidir}/exporter/opentelemetry-exporter-otlp-proto-grpc \ -e {toxinidir}/exporter/opentelemetry-exporter-otlp-proto-http \ -e {toxinidir}/exporter/opentelemetry-exporter-otlp docker-compose up -d commands = - pytest {posargs} + proto3: pytest {posargs} + ; opencensus exporter does not work with protobuf 4 + proto4: pytest --ignore opencensus {posargs} + commands_post = docker-compose down -v