├── .codespellrc ├── .coveragerc ├── .gitattributes ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── bug_report.yaml │ ├── config.yml │ └── feature_request.yaml ├── dependabot.yml ├── pull_request_template.md ├── rtd-build-instructions.png ├── scripts │ ├── update-version-patch.sh │ ├── update-version.sh │ └── use-cla-approved-github-bot.sh └── workflows │ ├── backport.yml │ ├── benchmarks.yml │ ├── changelog.yml │ ├── check-links.yml │ ├── check_links_config.json │ ├── codeql-analysis.yml │ ├── contrib.yml │ ├── fossa.yml │ ├── generate_workflows.py │ ├── lint_0.yml │ ├── misc_0.yml │ ├── ossf-scorecard.yml │ ├── prepare-patch-release.yml │ ├── prepare-release-branch.yml │ ├── release.yml │ ├── templates │ ├── lint.yml.j2 │ ├── misc.yml.j2 │ └── test.yml.j2 │ ├── test_0.yml │ └── test_1.yml ├── .gitignore ├── .pre-commit-config.yaml ├── .pylintrc ├── .readthedocs.yml ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── RELEASING.md ├── dev-requirements.txt ├── docs-requirements.txt ├── docs ├── Makefile ├── api │ ├── _logs.rst │ ├── _logs.severity.rst │ ├── baggage.propagation.rst │ ├── baggage.rst │ ├── context.context.rst │ ├── context.rst │ ├── environment_variables.rst │ ├── index.rst │ ├── metrics.rst │ ├── propagate.rst │ ├── propagators.composite.rst │ ├── propagators.rst │ ├── propagators.textmap.rst │ ├── trace.rst │ ├── trace.span.rst │ └── trace.status.rst ├── conf.py ├── examples │ ├── auto-instrumentation │ │ ├── README.rst │ │ ├── client.py │ │ ├── server_automatic.py │ │ ├── server_manual.py │ │ └── server_programmatic.py │ ├── basic_context │ │ ├── README.rst │ │ ├── async_context.py │ │ ├── child_context.py │ │ └── implicit_context.py │ ├── basic_tracer │ │ ├── README.rst │ │ ├── basic_trace.py │ │ └── resources.py │ ├── django │ │ ├── README.rst │ │ ├── client.py │ │ ├── instrumentation_example │ │ │ ├── __init__.py │ │ │ ├── asgi.py │ │ │ ├── settings.py │ │ │ ├── urls.py │ │ │ └── wsgi.py │ │ ├── manage.py │ │ └── pages │ │ │ ├── __init__.py │ │ │ ├── apps.py │ │ │ ├── migrations │ │ │ └── __init__.py │ │ │ ├── urls.py │ │ │ └── views.py │ ├── error_handler │ │ ├── README.rst │ │ ├── error_handler_0 │ │ │ ├── README.rst │ │ │ ├── pyproject.toml │ │ │ └── src │ │ │ │ └── error_handler_0 │ │ │ │ ├── __init__.py │ │ │ │ └── version │ │ │ │ └── __init__.py │ │ ├── error_handler_1 │ │ │ ├── README.rst │ │ │ ├── pyproject.toml │ │ │ └── src │ │ │ │ └── error_handler_1 │ │ │ │ ├── __init__.py │ │ │ │ └── version │ │ │ │ └── __init__.py │ │ └── example.py │ ├── fork-process-model │ │ ├── README.rst │ │ ├── flask-gunicorn │ │ │ ├── README.rst │ │ │ ├── app.py │ │ │ ├── gunicorn.conf.py │ │ │ └── requirements.txt │ │ └── flask-uwsgi │ │ │ ├── README.rst │ │ │ ├── app.py │ │ │ └── requirements.txt │ ├── index.rst │ ├── logs │ │ ├── README.rst │ │ ├── example.py │ │ └── otel-collector-config.yaml │ ├── metrics │ │ ├── instruments │ │ │ ├── README.rst │ │ │ ├── example.py │ │ │ ├── otel-collector-config.yaml │ │ │ └── requirements.txt │ │ ├── prometheus-grafana │ │ │ ├── prometheus-monitor.py │ │ │ └── requirements.txt │ │ ├── reader │ │ │ ├── README.rst │ │ │ ├── preferred_aggregation.py │ │ │ ├── preferred_exemplarfilter.py │ │ │ ├── preferred_temporality.py │ │ │ ├── requirements.txt │ │ │ └── synchronous_gauge_read.py │ │ └── views │ │ │ ├── README.rst │ │ │ ├── change_aggregation.py │ │ │ ├── change_name.py │ │ │ ├── change_reservoir_factory.py │ │ │ ├── disable_default_aggregation.py │ │ │ ├── drop_metrics_from_instrument.py │ │ │ ├── limit_num_of_attrs.py │ │ │ └── requirements.txt │ ├── opencensus-exporter-tracer │ │ ├── README.rst │ │ ├── collector.py │ │ └── docker │ │ │ ├── collector-config.yaml │ │ │ └── docker-compose.yaml │ ├── opencensus-shim │ │ ├── .gitignore │ │ ├── README.rst │ │ ├── app.py │ │ └── requirements.txt │ └── opentracing │ │ ├── README.rst │ │ ├── __init__.py │ │ ├── main.py │ │ ├── rediscache.py │ │ └── requirements.txt ├── exporter │ ├── index.rst │ ├── opencensus │ │ └── opencensus.rst │ ├── otlp │ │ └── otlp.rst │ └── zipkin │ │ └── zipkin.rst ├── getting_started │ ├── __init__.py │ ├── flask_example.py │ ├── metrics_example.py │ ├── otlpcollector_example.py │ ├── tests │ │ ├── __init__.py │ │ ├── requirements.txt │ │ ├── test_flask.py │ │ └── test_tracing.py │ └── tracing_example.py ├── index.rst ├── make.bat ├── sdk │ ├── _logs.rst │ ├── environment_variables.rst │ ├── error_handler.rst │ ├── index.rst │ ├── metrics.export.rst │ ├── metrics.rst │ ├── metrics.view.rst │ ├── resources.rst │ ├── trace.export.rst │ ├── trace.id_generator.rst │ ├── trace.rst │ ├── trace.sampling.rst │ └── util.instrumentation.rst └── shim │ ├── index.rst │ ├── opencensus_shim │ └── opencensus_shim.rst │ └── opentracing_shim │ └── opentracing_shim.rst ├── eachdist.ini ├── exporter ├── opentelemetry-exporter-opencensus │ ├── LICENSE │ ├── README.rst │ ├── pyproject.toml │ ├── src │ │ └── opentelemetry │ │ │ └── exporter │ │ │ └── opencensus │ │ │ ├── __init__.py │ │ │ ├── py.typed │ │ │ ├── trace_exporter │ │ │ └── __init__.py │ │ │ ├── util.py │ │ │ └── version │ │ │ └── __init__.py │ ├── test-requirements.txt │ └── tests │ │ ├── __init__.py │ │ └── test_otcollector_trace_exporter.py ├── opentelemetry-exporter-otlp-proto-common │ ├── LICENSE │ ├── README.rst │ ├── pyproject.toml │ ├── src │ │ └── opentelemetry │ │ │ └── exporter │ │ │ └── otlp │ │ │ └── proto │ │ │ └── common │ │ │ ├── __init__.py │ │ │ ├── _internal │ │ │ ├── __init__.py │ │ │ ├── _log_encoder │ │ │ │ └── __init__.py │ │ │ ├── metrics_encoder │ │ │ │ └── __init__.py │ │ │ └── trace_encoder │ │ │ │ └── __init__.py │ │ │ ├── _log_encoder.py │ │ │ ├── metrics_encoder.py │ │ │ ├── py.typed │ │ │ ├── trace_encoder.py │ │ │ └── version │ │ │ └── __init__.py │ ├── test-requirements.txt │ └── tests │ │ ├── __init__.py │ │ ├── test_attribute_encoder.py │ │ ├── test_backoff.py │ │ ├── test_log_encoder.py │ │ ├── test_metrics_encoder.py │ │ └── test_trace_encoder.py ├── opentelemetry-exporter-otlp-proto-grpc │ ├── LICENSE │ ├── README.rst │ ├── benchmark-requirements.txt │ ├── benchmarks │ │ └── test_benchmark_trace_exporter.py │ ├── pyproject.toml │ ├── src │ │ └── opentelemetry │ │ │ └── exporter │ │ │ └── otlp │ │ │ └── proto │ │ │ └── grpc │ │ │ ├── __init__.py │ │ │ ├── _log_exporter │ │ │ └── __init__.py │ │ │ ├── exporter.py │ │ │ ├── metric_exporter │ │ │ └── __init__.py │ │ │ ├── py.typed │ │ │ ├── trace_exporter │ │ │ └── __init__.py │ │ │ └── version │ │ │ └── __init__.py │ ├── test-requirements.txt │ └── tests │ │ ├── __init__.py │ │ ├── fixtures │ │ ├── test-client-cert.pem │ │ ├── test-client-key.pem │ │ └── test.cert │ │ ├── logs │ │ ├── __init__.py │ │ └── test_otlp_logs_exporter.py │ │ ├── test_otlp_exporter_mixin.py │ │ ├── test_otlp_metrics_exporter.py │ │ └── test_otlp_trace_exporter.py ├── opentelemetry-exporter-otlp-proto-http │ ├── LICENSE │ ├── README.rst │ ├── pyproject.toml │ ├── src │ │ └── opentelemetry │ │ │ └── exporter │ │ │ └── otlp │ │ │ └── proto │ │ │ └── http │ │ │ ├── __init__.py │ │ │ ├── _log_exporter │ │ │ └── __init__.py │ │ │ ├── metric_exporter │ │ │ └── __init__.py │ │ │ ├── py.typed │ │ │ ├── trace_exporter │ │ │ ├── __init__.py │ │ │ └── encoder │ │ │ │ └── __init__.py │ │ │ └── version │ │ │ └── __init__.py │ ├── test-requirements.txt │ └── tests │ │ ├── __init__.py │ │ ├── metrics │ │ ├── __init__.py │ │ └── test_otlp_metrics_exporter.py │ │ ├── test_proto_log_exporter.py │ │ └── test_proto_span_exporter.py ├── opentelemetry-exporter-otlp │ ├── LICENSE │ ├── README.rst │ ├── pyproject.toml │ ├── src │ │ └── opentelemetry │ │ │ └── exporter │ │ │ └── otlp │ │ │ ├── py.typed │ │ │ └── version │ │ │ └── __init__.py │ ├── test-requirements.txt │ └── tests │ │ ├── __init__.py │ │ └── test_otlp.py ├── opentelemetry-exporter-prometheus │ ├── LICENSE │ ├── README.rst │ ├── pyproject.toml │ ├── src │ │ └── opentelemetry │ │ │ └── exporter │ │ │ └── prometheus │ │ │ ├── __init__.py │ │ │ ├── _mapping.py │ │ │ ├── py.typed │ │ │ └── version │ │ │ └── __init__.py │ ├── test-requirements.txt │ └── tests │ │ ├── __init__.py │ │ ├── test_entrypoints.py │ │ ├── test_mapping.py │ │ └── test_prometheus_exporter.py ├── opentelemetry-exporter-zipkin-json │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.rst │ ├── pyproject.toml │ ├── src │ │ └── opentelemetry │ │ │ └── exporter │ │ │ └── zipkin │ │ │ ├── encoder │ │ │ └── __init__.py │ │ │ ├── json │ │ │ ├── __init__.py │ │ │ ├── v1 │ │ │ │ └── __init__.py │ │ │ ├── v2 │ │ │ │ └── __init__.py │ │ │ └── version │ │ │ │ └── __init__.py │ │ │ ├── node_endpoint.py │ │ │ └── py.typed │ ├── test-requirements.txt │ └── tests │ │ ├── __init__.py │ │ ├── encoder │ │ ├── __init__.py │ │ ├── common_tests.py │ │ ├── test_v1_json.py │ │ └── test_v2_json.py │ │ └── test_zipkin_exporter.py ├── opentelemetry-exporter-zipkin-proto-http │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.rst │ ├── pyproject.toml │ ├── src │ │ └── opentelemetry │ │ │ └── exporter │ │ │ └── zipkin │ │ │ └── proto │ │ │ └── http │ │ │ ├── __init__.py │ │ │ ├── py.typed │ │ │ ├── v2 │ │ │ ├── __init__.py │ │ │ └── gen │ │ │ │ ├── __init__.py │ │ │ │ ├── zipkin_pb2.py │ │ │ │ └── zipkin_pb2.pyi │ │ │ └── version │ │ │ └── __init__.py │ ├── test-requirements.txt │ └── tests │ │ ├── __init__.py │ │ ├── encoder │ │ ├── __init__.py │ │ ├── common_tests.py │ │ └── test_v2_protobuf.py │ │ └── test_zipkin_exporter.py └── opentelemetry-exporter-zipkin │ ├── LICENSE │ ├── README.rst │ ├── pyproject.toml │ ├── src │ └── opentelemetry │ │ └── exporter │ │ └── zipkin │ │ ├── py.typed │ │ └── version │ │ └── __init__.py │ ├── test-requirements.txt │ └── tests │ ├── __init__.py │ └── test_zipkin.py ├── gen-requirements.txt ├── opentelemetry-api ├── LICENSE ├── README.rst ├── pyproject.toml ├── src │ └── opentelemetry │ │ ├── _events │ │ ├── __init__.py │ │ └── py.typed │ │ ├── _logs │ │ ├── __init__.py │ │ ├── _internal │ │ │ └── __init__.py │ │ ├── py.typed │ │ └── severity │ │ │ └── __init__.py │ │ ├── attributes │ │ ├── __init__.py │ │ └── py.typed │ │ ├── baggage │ │ ├── __init__.py │ │ ├── propagation │ │ │ └── __init__.py │ │ └── py.typed │ │ ├── context │ │ ├── __init__.py │ │ ├── context.py │ │ ├── contextvars_context.py │ │ └── py.typed │ │ ├── environment_variables │ │ ├── __init__.py │ │ └── py.typed │ │ ├── metrics │ │ ├── __init__.py │ │ ├── _internal │ │ │ ├── __init__.py │ │ │ ├── instrument.py │ │ │ └── observation.py │ │ └── py.typed │ │ ├── propagate │ │ ├── __init__.py │ │ └── py.typed │ │ ├── propagators │ │ ├── composite.py │ │ ├── py.typed │ │ └── textmap.py │ │ ├── py.typed │ │ ├── trace │ │ ├── __init__.py │ │ ├── propagation │ │ │ ├── __init__.py │ │ │ └── tracecontext.py │ │ ├── py.typed │ │ ├── span.py │ │ └── status.py │ │ ├── util │ │ ├── _decorator.py │ │ ├── _importlib_metadata.py │ │ ├── _once.py │ │ ├── _providers.py │ │ ├── py.typed │ │ ├── re.py │ │ └── types.py │ │ └── version │ │ ├── __init__.py │ │ └── py.typed ├── test-requirements.txt └── tests │ ├── __init__.py │ ├── attributes │ └── test_attributes.py │ ├── baggage │ ├── propagation │ │ └── test_propagation.py │ └── test_baggage.py │ ├── context │ ├── __init__.py │ ├── base_context.py │ ├── propagation │ │ └── __init__.py │ ├── test_context.py │ └── test_contextvars_context.py │ ├── distributedcontext │ └── __init__.py │ ├── events │ ├── test_event.py │ ├── test_event_logger_provider.py │ └── test_proxy_event.py │ ├── logs │ ├── test_log_record.py │ ├── test_logger_provider.py │ └── test_proxy.py │ ├── metrics │ ├── test_instruments.py │ ├── test_meter.py │ ├── test_meter_provider.py │ ├── test_observation.py │ └── test_subclass_instantiation.py │ ├── mypysmoke.py │ ├── propagators │ ├── test_composite.py │ ├── test_global_httptextformat.py │ ├── test_propagators.py │ └── test_w3cbaggagepropagator.py │ ├── test_implementation.py │ ├── trace │ ├── __init__.py │ ├── propagation │ │ ├── test_textmap.py │ │ └── test_tracecontexthttptextformat.py │ ├── test_defaultspan.py │ ├── test_globals.py │ ├── test_immutablespancontext.py │ ├── test_proxy.py │ ├── test_span_context.py │ ├── test_status.py │ ├── test_tracer.py │ └── test_tracestate.py │ └── util │ ├── test__importlib_metadata.py │ ├── test__providers.py │ ├── test_contextmanager.py │ ├── test_once.py │ └── test_re.py ├── opentelemetry-proto ├── LICENSE ├── README.rst ├── pyproject.toml ├── src │ └── opentelemetry │ │ └── proto │ │ ├── __init__.py │ │ ├── collector │ │ ├── __init__.py │ │ ├── logs │ │ │ └── v1 │ │ │ │ ├── logs_service_pb2.py │ │ │ │ ├── logs_service_pb2.pyi │ │ │ │ └── logs_service_pb2_grpc.py │ │ ├── metrics │ │ │ ├── __init__.py │ │ │ └── v1 │ │ │ │ ├── __init__.py │ │ │ │ ├── metrics_service_pb2.py │ │ │ │ ├── metrics_service_pb2.pyi │ │ │ │ └── metrics_service_pb2_grpc.py │ │ └── trace │ │ │ ├── __init__.py │ │ │ └── v1 │ │ │ ├── __init__.py │ │ │ ├── trace_service_pb2.py │ │ │ ├── trace_service_pb2.pyi │ │ │ └── trace_service_pb2_grpc.py │ │ ├── common │ │ ├── __init__.py │ │ └── v1 │ │ │ ├── __init__.py │ │ │ ├── common_pb2.py │ │ │ └── common_pb2.pyi │ │ ├── logs │ │ └── v1 │ │ │ ├── logs_pb2.py │ │ │ └── logs_pb2.pyi │ │ ├── metrics │ │ ├── __init__.py │ │ └── v1 │ │ │ ├── __init__.py │ │ │ ├── metrics_pb2.py │ │ │ └── metrics_pb2.pyi │ │ ├── py.typed │ │ ├── resource │ │ ├── __init__.py │ │ └── v1 │ │ │ ├── __init__.py │ │ │ ├── resource_pb2.py │ │ │ └── resource_pb2.pyi │ │ ├── trace │ │ ├── __init__.py │ │ └── v1 │ │ │ ├── __init__.py │ │ │ ├── trace_pb2.py │ │ │ └── trace_pb2.pyi │ │ └── version │ │ └── __init__.py ├── test-requirements.txt └── tests │ ├── __init__.py │ └── test_proto.py ├── opentelemetry-sdk ├── LICENSE ├── README.rst ├── benchmark-requirements.txt ├── benchmarks │ ├── logs │ │ └── test_benchmark_logging_handler.py │ ├── metrics │ │ ├── test_benchmark_metrics.py │ │ ├── test_benchmark_metrics_histogram.py │ │ └── test_benchmark_metrics_histogram_steady.py │ ├── test_baggage.py │ └── trace │ │ └── test_benchmark_trace.py ├── pyproject.toml ├── src │ └── opentelemetry │ │ └── sdk │ │ ├── __init__.pyi │ │ ├── _configuration │ │ └── __init__.py │ │ ├── _events │ │ └── __init__.py │ │ ├── _logs │ │ ├── __init__.py │ │ ├── _internal │ │ │ ├── __init__.py │ │ │ └── export │ │ │ │ ├── __init__.py │ │ │ │ └── in_memory_log_exporter.py │ │ └── export │ │ │ └── __init__.py │ │ ├── _shared_internal │ │ └── __init__.py │ │ ├── environment_variables │ │ └── __init__.py │ │ ├── error_handler │ │ └── __init__.py │ │ ├── metrics │ │ ├── __init__.py │ │ ├── _internal │ │ │ ├── __init__.py │ │ │ ├── _view_instrument_match.py │ │ │ ├── aggregation.py │ │ │ ├── exceptions.py │ │ │ ├── exemplar │ │ │ │ ├── __init__.py │ │ │ │ ├── exemplar.py │ │ │ │ ├── exemplar_filter.py │ │ │ │ └── exemplar_reservoir.py │ │ │ ├── exponential_histogram │ │ │ │ ├── __init__.py │ │ │ │ ├── buckets.py │ │ │ │ └── mapping │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── errors.py │ │ │ │ │ ├── exponent_mapping.py │ │ │ │ │ ├── ieee_754.md │ │ │ │ │ ├── ieee_754.py │ │ │ │ │ └── logarithm_mapping.py │ │ │ ├── export │ │ │ │ └── __init__.py │ │ │ ├── instrument.py │ │ │ ├── measurement.py │ │ │ ├── measurement_consumer.py │ │ │ ├── metric_reader_storage.py │ │ │ ├── point.py │ │ │ ├── sdk_configuration.py │ │ │ └── view.py │ │ ├── export │ │ │ └── __init__.py │ │ └── view │ │ │ └── __init__.py │ │ ├── py.typed │ │ ├── resources │ │ └── __init__.py │ │ ├── trace │ │ ├── __init__.py │ │ ├── export │ │ │ ├── __init__.py │ │ │ └── in_memory_span_exporter.py │ │ ├── id_generator.py │ │ └── sampling.py │ │ ├── util │ │ ├── __init__.py │ │ ├── __init__.pyi │ │ └── instrumentation.py │ │ └── version │ │ └── __init__.py ├── test-requirements.txt └── tests │ ├── __init__.py │ ├── conftest.py │ ├── context │ ├── __init__.py │ └── test_asyncio.py │ ├── error_handler │ ├── __init__.py │ └── test_error_handler.py │ ├── events │ ├── __init__.py │ └── test_events.py │ ├── logs │ ├── __init__.py │ ├── test_export.py │ ├── test_handler.py │ ├── test_log_limits.py │ ├── test_log_record.py │ ├── test_logger_provider_cache.py │ ├── test_logs.py │ └── test_multi_log_processor.py │ ├── metrics │ ├── exponential_histogram │ │ ├── test_exponent_mapping.py │ │ ├── test_exponential_bucket_histogram_aggregation.py │ │ └── test_logarithm_mapping.py │ ├── integration_test │ │ ├── test_console_exporter.py │ │ ├── test_cpu_time.py │ │ ├── test_disable_default_views.py │ │ ├── test_exemplars.py │ │ ├── test_explicit_bucket_histogram_aggregation.py │ │ ├── test_exponential_bucket_histogram.py │ │ ├── test_exporter_concurrency.py │ │ ├── test_histogram_advisory_explicit_buckets.py │ │ ├── test_histogram_export.py │ │ ├── test_provider_shutdown.py │ │ ├── test_sum_aggregation.py │ │ └── test_time_align.py │ ├── test_aggregation.py │ ├── test_backward_compat.py │ ├── test_exemplarfilter.py │ ├── test_exemplarreservoir.py │ ├── test_import.py │ ├── test_in_memory_metric_reader.py │ ├── test_instrument.py │ ├── test_measurement_consumer.py │ ├── test_metric_reader.py │ ├── test_metric_reader_storage.py │ ├── test_metrics.py │ ├── test_periodic_exporting_metric_reader.py │ ├── test_point.py │ ├── test_view.py │ └── test_view_instrument_match.py │ ├── resources │ ├── __init__.py │ └── test_resources.py │ ├── shared_internal │ ├── __init__.py │ └── test_batch_processor.py │ ├── test_configurator.py │ ├── test_util.py │ └── trace │ ├── __init__.py │ ├── export │ ├── __init__.py │ ├── test_export.py │ └── test_in_memory_span_exporter.py │ ├── propagation │ └── __init__.py │ ├── test_globals.py │ ├── test_implementation.py │ ├── test_sampling.py │ ├── test_span_processor.py │ └── test_trace.py ├── opentelemetry-semantic-conventions ├── LICENSE ├── README.rst ├── pyproject.toml ├── src │ └── opentelemetry │ │ └── semconv │ │ ├── __init__.py │ │ ├── _incubating │ │ ├── attributes │ │ │ ├── app_attributes.py │ │ │ ├── artifact_attributes.py │ │ │ ├── aws_attributes.py │ │ │ ├── az_attributes.py │ │ │ ├── azure_attributes.py │ │ │ ├── browser_attributes.py │ │ │ ├── cassandra_attributes.py │ │ │ ├── cicd_attributes.py │ │ │ ├── client_attributes.py │ │ │ ├── cloud_attributes.py │ │ │ ├── cloudevents_attributes.py │ │ │ ├── cloudfoundry_attributes.py │ │ │ ├── code_attributes.py │ │ │ ├── container_attributes.py │ │ │ ├── cpu_attributes.py │ │ │ ├── cpython_attributes.py │ │ │ ├── db_attributes.py │ │ │ ├── deployment_attributes.py │ │ │ ├── destination_attributes.py │ │ │ ├── device_attributes.py │ │ │ ├── disk_attributes.py │ │ │ ├── dns_attributes.py │ │ │ ├── elasticsearch_attributes.py │ │ │ ├── enduser_attributes.py │ │ │ ├── error_attributes.py │ │ │ ├── event_attributes.py │ │ │ ├── exception_attributes.py │ │ │ ├── faas_attributes.py │ │ │ ├── feature_flag_attributes.py │ │ │ ├── file_attributes.py │ │ │ ├── gcp_attributes.py │ │ │ ├── gen_ai_attributes.py │ │ │ ├── geo_attributes.py │ │ │ ├── graphql_attributes.py │ │ │ ├── heroku_attributes.py │ │ │ ├── host_attributes.py │ │ │ ├── http_attributes.py │ │ │ ├── hw_attributes.py │ │ │ ├── k8s_attributes.py │ │ │ ├── linux_attributes.py │ │ │ ├── log_attributes.py │ │ │ ├── message_attributes.py │ │ │ ├── messaging_attributes.py │ │ │ ├── net_attributes.py │ │ │ ├── network_attributes.py │ │ │ ├── oci_attributes.py │ │ │ ├── opentracing_attributes.py │ │ │ ├── os_attributes.py │ │ │ ├── otel_attributes.py │ │ │ ├── other_attributes.py │ │ │ ├── peer_attributes.py │ │ │ ├── pool_attributes.py │ │ │ ├── process_attributes.py │ │ │ ├── profile_attributes.py │ │ │ ├── rpc_attributes.py │ │ │ ├── security_rule_attributes.py │ │ │ ├── server_attributes.py │ │ │ ├── service_attributes.py │ │ │ ├── session_attributes.py │ │ │ ├── source_attributes.py │ │ │ ├── system_attributes.py │ │ │ ├── telemetry_attributes.py │ │ │ ├── test_attributes.py │ │ │ ├── thread_attributes.py │ │ │ ├── tls_attributes.py │ │ │ ├── url_attributes.py │ │ │ ├── user_agent_attributes.py │ │ │ ├── user_attributes.py │ │ │ ├── vcs_attributes.py │ │ │ └── webengine_attributes.py │ │ └── metrics │ │ │ ├── azure_metrics.py │ │ │ ├── cicd_metrics.py │ │ │ ├── container_metrics.py │ │ │ ├── cpu_metrics.py │ │ │ ├── cpython_metrics.py │ │ │ ├── db_metrics.py │ │ │ ├── dns_metrics.py │ │ │ ├── faas_metrics.py │ │ │ ├── gen_ai_metrics.py │ │ │ ├── http_metrics.py │ │ │ ├── hw_metrics.py │ │ │ ├── k8s_metrics.py │ │ │ ├── messaging_metrics.py │ │ │ ├── otel_metrics.py │ │ │ ├── process_metrics.py │ │ │ ├── rpc_metrics.py │ │ │ ├── system_metrics.py │ │ │ └── vcs_metrics.py │ │ ├── attributes │ │ ├── __init__.py │ │ ├── client_attributes.py │ │ ├── code_attributes.py │ │ ├── db_attributes.py │ │ ├── error_attributes.py │ │ ├── exception_attributes.py │ │ ├── http_attributes.py │ │ ├── network_attributes.py │ │ ├── otel_attributes.py │ │ ├── server_attributes.py │ │ ├── service_attributes.py │ │ ├── telemetry_attributes.py │ │ ├── url_attributes.py │ │ └── user_agent_attributes.py │ │ ├── metrics │ │ ├── __init__.py │ │ ├── db_metrics.py │ │ └── http_metrics.py │ │ ├── py.typed │ │ ├── resource │ │ └── __init__.py │ │ ├── schemas.py │ │ ├── trace │ │ └── __init__.py │ │ └── version │ │ └── __init__.py ├── test-requirements.txt └── tests │ ├── __init__.py │ └── test_semconv.py ├── propagator ├── opentelemetry-propagator-b3 │ ├── LICENSE │ ├── README.rst │ ├── benchmark-requirements.txt │ ├── benchmarks │ │ └── trace │ │ │ └── propagation │ │ │ └── test_benchmark_b3_format.py │ ├── py.typed │ ├── pyproject.toml │ ├── src │ │ └── opentelemetry │ │ │ └── propagators │ │ │ └── b3 │ │ │ ├── __init__.py │ │ │ ├── py.typed │ │ │ └── version │ │ │ └── __init__.py │ ├── test-requirements.txt │ └── tests │ │ ├── __init__.py │ │ └── test_b3_format.py └── opentelemetry-propagator-jaeger │ ├── LICENSE │ ├── README.rst │ ├── py.typed │ ├── pyproject.toml │ ├── src │ └── opentelemetry │ │ └── propagators │ │ └── jaeger │ │ ├── __init__.py │ │ ├── py.typed │ │ └── version │ │ └── __init__.py │ ├── test-requirements.txt │ └── tests │ ├── __init__.py │ └── test_jaeger_propagator.py ├── pyproject.toml ├── rationale.md ├── scripts ├── add_required_checks.py ├── build.sh ├── check_for_valid_readme.py ├── coverage.sh ├── eachdist.py ├── generate_website_docs.sh ├── proto_codegen.sh ├── public_symbols_checker.py ├── semconv │ ├── .gitignore │ ├── generate.sh │ └── templates │ │ └── registry │ │ ├── common.j2 │ │ ├── semantic_attributes.j2 │ │ ├── semantic_metrics.j2 │ │ └── weaver.yaml ├── tracecontext-integration-test.sh └── update_sha.py ├── shim ├── opentelemetry-opencensus-shim │ ├── LICENSE │ ├── README.rst │ ├── pyproject.toml │ ├── src │ │ └── opentelemetry │ │ │ └── shim │ │ │ └── opencensus │ │ │ ├── __init__.py │ │ │ ├── _patch.py │ │ │ ├── _shim_span.py │ │ │ ├── _shim_tracer.py │ │ │ ├── py.typed │ │ │ └── version │ │ │ └── __init__.py │ ├── test-requirements.txt │ └── tests │ │ ├── __init__.py │ │ ├── test_patch.py │ │ ├── test_shim.py │ │ └── test_shim_with_sdk.py └── opentelemetry-opentracing-shim │ ├── LICENSE │ ├── README.rst │ ├── pyproject.toml │ ├── src │ └── opentelemetry │ │ └── shim │ │ └── opentracing_shim │ │ ├── __init__.py │ │ ├── py.typed │ │ ├── util.py │ │ └── version │ │ └── __init__.py │ ├── test-requirements.txt │ └── tests │ ├── __init__.py │ ├── test_shim.py │ ├── test_util.py │ └── testbed │ ├── README.rst │ ├── __init__.py │ ├── otel_ot_shim_tracer.py │ ├── test_active_span_replacement │ ├── README.rst │ ├── __init__.py │ ├── test_asyncio.py │ └── test_threads.py │ ├── test_client_server │ ├── README.rst │ ├── __init__.py │ ├── test_asyncio.py │ └── test_threads.py │ ├── test_common_request_handler │ ├── README.rst │ ├── __init__.py │ ├── request_handler.py │ ├── test_asyncio.py │ └── test_threads.py │ ├── test_late_span_finish │ ├── README.rst │ ├── __init__.py │ ├── test_asyncio.py │ └── test_threads.py │ ├── test_listener_per_request │ ├── README.rst │ ├── __init__.py │ ├── response_listener.py │ ├── test_asyncio.py │ └── test_threads.py │ ├── test_multiple_callbacks │ ├── README.rst │ ├── __init__.py │ ├── test_asyncio.py │ └── test_threads.py │ ├── test_nested_callbacks │ ├── README.rst │ ├── __init__.py │ ├── test_asyncio.py │ └── test_threads.py │ ├── test_subtask_span_propagation │ ├── README.rst │ ├── __init__.py │ ├── test_asyncio.py │ └── test_threads.py │ ├── testcase.py │ └── utils.py ├── tests ├── opentelemetry-docker-tests │ └── tests │ │ ├── docker-compose.yml │ │ ├── opencensus │ │ └── test_opencensusexporter_functional.py │ │ └── otlpexporter │ │ ├── __init__.py │ │ ├── test_otlp_grpc_exporter_functional.py │ │ └── test_otlp_http_exporter_functional.py ├── opentelemetry-test-utils │ ├── README.rst │ ├── pyproject.toml │ ├── src │ │ └── opentelemetry │ │ │ └── test │ │ │ ├── __init__.py │ │ │ ├── asgitestutil.py │ │ │ ├── concurrency_test.py │ │ │ ├── globals_test.py │ │ │ ├── httptest.py │ │ │ ├── metrictestutil.py │ │ │ ├── mock_textmap.py │ │ │ ├── spantestutil.py │ │ │ ├── test_base.py │ │ │ ├── version │ │ │ └── __init__.py │ │ │ └── wsgitestutil.py │ ├── test-requirements.txt │ └── tests │ │ ├── __init__.py │ │ ├── test_base.py │ │ └── test_utils.py └── w3c_tracecontext_validation_server.py ├── tox.ini └── uv.lock /.codespellrc: -------------------------------------------------------------------------------- 1 | [codespell] 2 | # skipping auto generated folders 3 | skip = ./.tox,./.mypy_cache,./docs/_build,./target,*/LICENSE,./venv,.git,./opentelemetry-semantic-conventions,*-requirements*.txt 4 | ignore-words-list = ans,ue,ot,hist,ro 5 | -------------------------------------------------------------------------------- /.coveragerc: -------------------------------------------------------------------------------- 1 | [run] 2 | omit = 3 | */tests/* 4 | */gen/* 5 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # tells github that proto code is generated 2 | opentelemetry-proto/src/**/*_pb2*.py* linguist-generated=true 3 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Code owners file. 2 | # This file controls who is tagged for review for any given pull request. 3 | 4 | # For anything not explicitly taken by someone else: 5 | * @open-telemetry/python-approvers 6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | contact_links: 2 | - name: Slack 3 | url: https://cloud-native.slack.com/archives/C01PD4HUVBL 4 | about: Or the `#otel-python` channel in the CNCF Slack instance. 5 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # Keep GitHub Actions up to date with GitHub's Dependabot... 2 | # https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot 3 | # https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem 4 | version: 2 5 | updates: 6 | - package-ecosystem: github-actions 7 | directory: / 8 | groups: 9 | github-actions: 10 | patterns: 11 | - "*" # Group all Actions updates into a single larger pull request 12 | schedule: 13 | interval: weekly 14 | -------------------------------------------------------------------------------- /.github/rtd-build-instructions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/.github/rtd-build-instructions.png -------------------------------------------------------------------------------- /.github/scripts/update-version-patch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | sed -i "/\[stable\]/{n;s/version=.*/version=$1/}" eachdist.ini 4 | sed -i "/\[prerelease\]/{n;s/version=.*/version=$2/}" eachdist.ini 5 | 6 | ./scripts/eachdist.py update_patch_versions \ 7 | --stable_version=$1 \ 8 | --unstable_version=$2 \ 9 | --stable_version_prev=$3 \ 10 | --unstable_version_prev=$4 11 | 12 | -------------------------------------------------------------------------------- /.github/scripts/update-version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | sed -i "/\[stable\]/{n;s/version=.*/version=$1/}" eachdist.ini 4 | sed -i "/\[prerelease\]/{n;s/version=.*/version=$2/}" eachdist.ini 5 | 6 | ./scripts/eachdist.py update_versions --versions stable,prerelease 7 | -------------------------------------------------------------------------------- /.github/scripts/use-cla-approved-github-bot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | git config user.name opentelemetrybot 4 | git config user.email 107717825+opentelemetrybot@users.noreply.github.com 5 | -------------------------------------------------------------------------------- /.github/workflows/benchmarks.yml: -------------------------------------------------------------------------------- 1 | name: SDK Benchmark Tests 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | 7 | jobs: 8 | sdk-benchmarks: 9 | runs-on: self-hosted 10 | steps: 11 | - name: Checkout Core Repo @ SHA - ${{ github.sha }} 12 | uses: actions/checkout@v4 13 | - name: Set up Python 14 | uses: actions/setup-python@v5 15 | with: 16 | python-version: "3.13" 17 | architecture: 'x64' 18 | - name: Install tox 19 | run: pip install tox 20 | - name: Run tox 21 | run: tox -e benchmark-opentelemetry-sdk -- -k opentelemetry-sdk/benchmarks --benchmark-json=opentelemetry-sdk/output.json 22 | - name: Report on SDK benchmark results 23 | uses: benchmark-action/github-action-benchmark@v1 24 | with: 25 | name: OpenTelemetry Python SDK Benchmarks 26 | tool: pytest 27 | output-file-path: opentelemetry-sdk/output.json 28 | gh-pages-branch: gh-pages 29 | github-token: ${{ secrets.GITHUB_TOKEN }} 30 | # Make a commit on `gh-pages` with benchmarks from previous step 31 | benchmark-data-dir-path: "benchmarks" 32 | auto-push: true 33 | max-items-in-chart: 100 34 | # Alert with a commit comment on possible performance regression 35 | alert-threshold: '200%' 36 | comment-on-alert: true 37 | -------------------------------------------------------------------------------- /.github/workflows/changelog.yml: -------------------------------------------------------------------------------- 1 | # This action requires that any PR targeting the main branch should touch at 2 | # least one CHANGELOG file. If a CHANGELOG entry is not required, add the "Skip 3 | # Changelog" label to disable this action. 4 | 5 | name: changelog 6 | 7 | on: 8 | pull_request: 9 | types: [opened, synchronize, reopened, labeled, unlabeled] 10 | branches: 11 | - main 12 | 13 | jobs: 14 | changelog: 15 | runs-on: ubuntu-latest 16 | if: | 17 | !contains(github.event.pull_request.labels.*.name, 'Skip Changelog') 18 | && github.actor != 'opentelemetrybot' 19 | 20 | steps: 21 | - uses: actions/checkout@v4 22 | 23 | - name: Check for CHANGELOG changes 24 | run: | 25 | # Only the latest commit of the feature branch is available 26 | # automatically. To diff with the base branch, we need to 27 | # fetch that too (and we only need its latest commit). 28 | git fetch origin ${{ github.base_ref }} --depth=1 29 | if [[ $(git diff --name-only FETCH_HEAD | grep CHANGELOG) ]] 30 | then 31 | echo "A CHANGELOG was modified. Looks good!" 32 | else 33 | echo "No CHANGELOG was modified." 34 | echo "Please add a CHANGELOG entry, or add the \"Skip Changelog\" label if not required." 35 | false 36 | fi 37 | -------------------------------------------------------------------------------- /.github/workflows/check_links_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "ignorePatterns": [ 3 | { 4 | "pattern": "http(s)?://\\d+\\.\\d+\\.\\d+\\.\\d+" 5 | }, 6 | { 7 | "pattern": "http(s)?://localhost" 8 | }, 9 | { 10 | "pattern": "http(s)?://example.com" 11 | } 12 | ], 13 | "aliveStatusCodes": [429, 200] 14 | } 15 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | name: CodeQL Analysis 2 | 3 | on: 4 | workflow_dispatch: 5 | schedule: 6 | # ┌───────────── minute (0 - 59) 7 | # │ ┌───────────── hour (0 - 23) 8 | # │ │ ┌───────────── day of the month (1 - 31) 9 | # │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) 10 | # │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) 11 | # │ │ │ │ │ 12 | # │ │ │ │ │ 13 | # │ │ │ │ │ 14 | # * * * * * 15 | - cron: '30 1 * * *' 16 | 17 | jobs: 18 | CodeQL-Build: 19 | runs-on: ubuntu-latest 20 | 21 | steps: 22 | - name: Checkout repository 23 | uses: actions/checkout@v4 24 | 25 | # Initializes the CodeQL tools for scanning. 26 | - name: Initialize CodeQL 27 | uses: github/codeql-action/init@v3 28 | with: 29 | languages: python 30 | 31 | - name: Autobuild 32 | uses: github/codeql-action/autobuild@v3 33 | 34 | - name: Perform CodeQL Analysis 35 | uses: github/codeql-action/analyze@v3 36 | -------------------------------------------------------------------------------- /.github/workflows/contrib.yml: -------------------------------------------------------------------------------- 1 | name: Core Contrib Test 2 | 3 | on: 4 | push: 5 | branches-ignore: 6 | - 'release/*' 7 | pull_request: 8 | 9 | concurrency: 10 | group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} 11 | cancel-in-progress: true 12 | 13 | jobs: 14 | contrib_0: 15 | uses: open-telemetry/opentelemetry-python-contrib/.github/workflows/core_contrib_test_0.yml@main 16 | with: 17 | CORE_REPO_SHA: ${{ github.sha }} 18 | CONTRIB_REPO_SHA: ${{ github.event_name == 'pull_request' && ( 19 | contains(github.event.pull_request.labels.*.name, 'prepare-release') && github.event.pull_request.head.ref || 20 | contains(github.event.pull_request.labels.*.name, 'backport') && github.event.pull_request.base.ref || 21 | 'main' 22 | ) || 'main' }} 23 | -------------------------------------------------------------------------------- /.github/workflows/fossa.yml: -------------------------------------------------------------------------------- 1 | name: FOSSA scanning 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | 8 | permissions: 9 | contents: read 10 | 11 | jobs: 12 | fossa: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 16 | 17 | - uses: fossas/fossa-action@3ebcea1862c6ffbd5cf1b4d0bd6b3fe7bd6f2cac # v1.7.0 18 | with: 19 | api-key: ${{secrets.FOSSA_API_KEY}} 20 | team: OpenTelemetry 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.py[cod] 2 | *.sw[op] 3 | 4 | # C extensions 5 | *.so 6 | 7 | # Packages 8 | *.egg 9 | *.egg-info 10 | dist 11 | build 12 | eggs 13 | parts 14 | bin 15 | include 16 | var 17 | sdist 18 | develop-eggs 19 | .installed.cfg 20 | pyvenv.cfg 21 | lib 22 | share/ 23 | lib64 24 | __pycache__ 25 | venv*/ 26 | .venv*/ 27 | 28 | # Installer logs 29 | pip-log.txt 30 | 31 | # Unit test / coverage reports 32 | coverage.xml 33 | .coverage 34 | .nox 35 | .tox 36 | .cache 37 | htmlcov 38 | 39 | # Translations 40 | *.mo 41 | 42 | # Mac 43 | .DS_Store 44 | 45 | # Mr Developer 46 | .mr.developer.cfg 47 | .project 48 | .pydevproject 49 | 50 | # JetBrains 51 | .idea 52 | 53 | # VSCode 54 | .vscode 55 | 56 | # Sphinx 57 | _build/ 58 | 59 | # mypy 60 | .mypy_cache/ 61 | target 62 | 63 | # Django example 64 | 65 | docs/examples/django/db.sqlite3 66 | 67 | # Semantic conventions 68 | scripts/semconv/semantic-conventions 69 | 70 | # Benchmark result files 71 | *-benchmark.json 72 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/astral-sh/ruff-pre-commit 3 | # Ruff version. 4 | rev: v0.6.9 5 | hooks: 6 | # Run the linter. 7 | - id: ruff 8 | args: ["--fix", "--show-fixes"] 9 | # Run the formatter. 10 | - id: ruff-format 11 | - repo: https://github.com/astral-sh/uv-pre-commit 12 | # uv version. 13 | rev: 0.6.0 14 | hooks: 15 | - id: uv-lock 16 | -------------------------------------------------------------------------------- /.readthedocs.yml: -------------------------------------------------------------------------------- 1 | # Read the Docs configuration file 2 | # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details 3 | version: 2 4 | 5 | build: 6 | os: "ubuntu-22.04" 7 | tools: 8 | python: "3.9" 9 | 10 | sphinx: 11 | configuration: docs/conf.py 12 | 13 | python: 14 | install: 15 | - requirements: docs-requirements.txt 16 | -------------------------------------------------------------------------------- /dev-requirements.txt: -------------------------------------------------------------------------------- 1 | pylint==3.3.4 2 | httpretty==1.1.4 3 | pyright==1.1.396 4 | sphinx==7.1.2 5 | sphinx-rtd-theme==2.0.0rc4 6 | sphinx-autodoc-typehints==1.25.2 7 | pytest==7.4.4 8 | pytest-cov==4.1.0 9 | readme-renderer==42.0 10 | markupsafe==2.1.3 11 | bleach==4.1.0 # This dependency was updated to a breaking version. 12 | codespell==2.1.0 13 | requests==2.32.3 14 | ruamel.yaml==0.17.21 15 | asgiref==3.7.2 16 | psutil==5.9.6 17 | GitPython==3.1.41 18 | pre-commit==3.7.0; python_version >= '3.9' 19 | pre-commit==3.5.0; python_version < '3.9' 20 | ruff==0.6.9 21 | -------------------------------------------------------------------------------- /docs-requirements.txt: -------------------------------------------------------------------------------- 1 | sphinx==7.1.2 2 | sphinx-rtd-theme==2.0.0rc4 3 | sphinx-autodoc-typehints==1.25.2 4 | # used to generate docs for the website 5 | sphinx-jekyll-builder==0.3.0 6 | 7 | # Need to install the api/sdk in the venv for autodoc. Modifying sys.path 8 | # doesn't work for pkg_resources. 9 | ./opentelemetry-api 10 | ./opentelemetry-semantic-conventions 11 | ./opentelemetry-sdk 12 | ./opentelemetry-proto 13 | ./shim/opentelemetry-opencensus-shim 14 | ./shim/opentelemetry-opentracing-shim 15 | ./exporter/opentelemetry-exporter-otlp-proto-common 16 | ./exporter/opentelemetry-exporter-otlp-proto-http 17 | ./exporter/opentelemetry-exporter-otlp-proto-grpc 18 | 19 | # Required by instrumentation and exporter packages 20 | grpcio~=1.27 21 | Deprecated~=1.2 22 | django~=4.2 23 | flask~=2.3 24 | opentracing~=2.2.0 25 | thrift~=0.10 26 | wrapt>=1.0.0,<2.0.0 27 | markupsafe~=2.0 28 | protobuf==5.26.1 29 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | SOURCEDIR = . 8 | BUILDDIR = _build 9 | 10 | # Put it first so that "make" without argument is like "make help". 11 | help: 12 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 13 | 14 | .PHONY: help Makefile 15 | 16 | # Catch-all target: route all unknown targets to Sphinx using the new 17 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 18 | %: Makefile 19 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 20 | -------------------------------------------------------------------------------- /docs/api/_logs.rst: -------------------------------------------------------------------------------- 1 | opentelemetry._logs package 2 | ============================= 3 | 4 | Submodules 5 | ---------- 6 | 7 | .. toctree:: 8 | 9 | _logs.severity 10 | 11 | Module contents 12 | --------------- 13 | 14 | .. automodule:: opentelemetry._logs 15 | -------------------------------------------------------------------------------- /docs/api/_logs.severity.rst: -------------------------------------------------------------------------------- 1 | opentelemetry._logs.severity 2 | ============================ 3 | 4 | .. automodule:: opentelemetry._logs.severity -------------------------------------------------------------------------------- /docs/api/baggage.propagation.rst: -------------------------------------------------------------------------------- 1 | opentelemetry.baggage.propagation package 2 | ==================================================== 3 | 4 | Module contents 5 | --------------- 6 | 7 | .. automodule:: opentelemetry.baggage.propagation 8 | -------------------------------------------------------------------------------- /docs/api/baggage.rst: -------------------------------------------------------------------------------- 1 | opentelemetry.baggage package 2 | ======================================== 3 | 4 | Subpackages 5 | ----------- 6 | 7 | .. toctree:: 8 | 9 | baggage.propagation 10 | 11 | Module contents 12 | --------------- 13 | 14 | .. automodule:: opentelemetry.baggage 15 | -------------------------------------------------------------------------------- /docs/api/context.context.rst: -------------------------------------------------------------------------------- 1 | opentelemetry.context.base\_context module 2 | ========================================== 3 | 4 | .. automodule:: opentelemetry.context.context 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /docs/api/context.rst: -------------------------------------------------------------------------------- 1 | opentelemetry.context package 2 | ============================= 3 | 4 | Submodules 5 | ---------- 6 | 7 | .. toctree:: 8 | 9 | context.context 10 | 11 | Module contents 12 | --------------- 13 | 14 | .. automodule:: opentelemetry.context 15 | -------------------------------------------------------------------------------- /docs/api/environment_variables.rst: -------------------------------------------------------------------------------- 1 | opentelemetry.environment_variables package 2 | =========================================== 3 | 4 | Module contents 5 | --------------- 6 | 7 | .. automodule:: opentelemetry.environment_variables 8 | -------------------------------------------------------------------------------- /docs/api/index.rst: -------------------------------------------------------------------------------- 1 | OpenTelemetry Python API 2 | ======================== 3 | 4 | .. TODO: what is the API 5 | 6 | .. toctree:: 7 | :maxdepth: 1 8 | 9 | _logs 10 | baggage 11 | context 12 | propagate 13 | propagators 14 | trace 15 | metrics 16 | environment_variables 17 | -------------------------------------------------------------------------------- /docs/api/metrics.rst: -------------------------------------------------------------------------------- 1 | opentelemetry.metrics package 2 | ============================= 3 | 4 | .. toctree:: 5 | 6 | 7 | Module contents 8 | --------------- 9 | 10 | .. automodule:: opentelemetry.metrics 11 | -------------------------------------------------------------------------------- /docs/api/propagate.rst: -------------------------------------------------------------------------------- 1 | opentelemetry.propagate package 2 | ======================================== 3 | 4 | Module contents 5 | --------------- 6 | 7 | .. automodule:: opentelemetry.propagate 8 | -------------------------------------------------------------------------------- /docs/api/propagators.composite.rst: -------------------------------------------------------------------------------- 1 | opentelemetry.propagators.composite 2 | ==================================================== 3 | 4 | Module contents 5 | --------------- 6 | 7 | .. automodule:: opentelemetry.propagators.composite 8 | -------------------------------------------------------------------------------- /docs/api/propagators.rst: -------------------------------------------------------------------------------- 1 | opentelemetry.propagators package 2 | ======================================== 3 | 4 | Subpackages 5 | ----------- 6 | 7 | .. toctree:: 8 | 9 | propagators.textmap 10 | propagators.composite 11 | -------------------------------------------------------------------------------- /docs/api/propagators.textmap.rst: -------------------------------------------------------------------------------- 1 | opentelemetry.propagators.textmap 2 | ==================================================== 3 | 4 | Module contents 5 | --------------- 6 | 7 | .. automodule:: opentelemetry.propagators.textmap 8 | -------------------------------------------------------------------------------- /docs/api/trace.rst: -------------------------------------------------------------------------------- 1 | opentelemetry.trace package 2 | =========================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | .. toctree:: 8 | 9 | trace.status 10 | trace.span 11 | 12 | Module contents 13 | --------------- 14 | 15 | .. automodule:: opentelemetry.trace -------------------------------------------------------------------------------- /docs/api/trace.span.rst: -------------------------------------------------------------------------------- 1 | opentelemetry.trace.span 2 | ======================== 3 | 4 | .. automodule:: opentelemetry.trace.span 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /docs/api/trace.status.rst: -------------------------------------------------------------------------------- 1 | opentelemetry.trace.status 2 | ========================== 3 | 4 | .. automodule:: opentelemetry.trace.status 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /docs/examples/auto-instrumentation/README.rst: -------------------------------------------------------------------------------- 1 | Auto-instrumentation 2 | ==================== 3 | 4 | To learn about automatic instrumentation and how to run the example in this 5 | directory, see `Automatic Instrumentation`_. 6 | 7 | .. _Automatic Instrumentation: https://opentelemetry.io/docs/instrumentation/python/automatic/example 8 | -------------------------------------------------------------------------------- /docs/examples/auto-instrumentation/server_automatic.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from flask import Flask, request 16 | 17 | app = Flask(__name__) 18 | 19 | 20 | @app.route("/server_request") 21 | def server_request(): 22 | print(request.args.get("param")) 23 | return "served" 24 | 25 | 26 | if __name__ == "__main__": 27 | app.run(port=8082) 28 | -------------------------------------------------------------------------------- /docs/examples/basic_context/README.rst: -------------------------------------------------------------------------------- 1 | Basic Context 2 | ============= 3 | 4 | These examples show how context is propagated through Spans in OpenTelemetry. There are three different 5 | examples: 6 | 7 | * implicit_context: Shows how starting a span implicitly creates context. 8 | * child_context: Shows how context is propagated through child spans. 9 | * async_context: Shows how context can be shared in another coroutine. 10 | 11 | The source files of these examples are available :scm_web:`here `. 12 | 13 | Installation 14 | ------------ 15 | 16 | .. code-block:: sh 17 | 18 | pip install opentelemetry-api 19 | pip install opentelemetry-sdk 20 | 21 | Run the Example 22 | --------------- 23 | 24 | .. code-block:: sh 25 | 26 | python .py 27 | 28 | The output will be shown in the console. 29 | 30 | Useful links 31 | ------------ 32 | 33 | - OpenTelemetry_ 34 | - :doc:`../../api/trace` 35 | 36 | .. _OpenTelemetry: https://github.com/open-telemetry/opentelemetry-python/ 37 | -------------------------------------------------------------------------------- /docs/examples/basic_context/async_context.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import asyncio 16 | 17 | from opentelemetry import baggage, trace 18 | from opentelemetry.sdk.trace import TracerProvider 19 | 20 | trace.set_tracer_provider(TracerProvider()) 21 | tracer = trace.get_tracer(__name__) 22 | 23 | loop = asyncio.get_event_loop() 24 | 25 | 26 | async def async_span(span): 27 | with trace.use_span(span): 28 | ctx = baggage.set_baggage("foo", "bar") 29 | return ctx 30 | 31 | 32 | async def main(): 33 | span = tracer.start_span(name="span") 34 | ctx = await async_span(span) 35 | print(baggage.get_all(context=ctx)) 36 | 37 | 38 | loop.run_until_complete(main()) 39 | -------------------------------------------------------------------------------- /docs/examples/basic_context/child_context.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from opentelemetry import baggage, trace 16 | 17 | tracer = trace.get_tracer(__name__) 18 | 19 | global_ctx = baggage.set_baggage("context", "global") 20 | with tracer.start_as_current_span(name="root span") as root_span: 21 | parent_ctx = baggage.set_baggage("context", "parent") 22 | with tracer.start_as_current_span( 23 | name="child span", context=parent_ctx 24 | ) as child_span: 25 | child_ctx = baggage.set_baggage("context", "child") 26 | 27 | print(baggage.get_baggage("context", global_ctx)) 28 | print(baggage.get_baggage("context", parent_ctx)) 29 | print(baggage.get_baggage("context", child_ctx)) 30 | -------------------------------------------------------------------------------- /docs/examples/basic_context/implicit_context.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from opentelemetry import baggage, trace 16 | from opentelemetry.sdk.trace import TracerProvider 17 | 18 | trace.set_tracer_provider(TracerProvider()) 19 | tracer = trace.get_tracer(__name__) 20 | 21 | with tracer.start_span(name="root span") as root_span: 22 | ctx = baggage.set_baggage("foo", "bar") 23 | 24 | print(f"Global context baggage: {baggage.get_all()}") 25 | print(f"Span context baggage: {baggage.get_all(context=ctx)}") 26 | -------------------------------------------------------------------------------- /docs/examples/basic_tracer/README.rst: -------------------------------------------------------------------------------- 1 | Basic Trace 2 | =========== 3 | 4 | These examples show how to use OpenTelemetry to create and export Spans. There are two different examples: 5 | 6 | * basic_trace: Shows how to configure a SpanProcessor and Exporter, and how to create a tracer and span. 7 | * resources: Shows how to add resource information to a Provider. 8 | 9 | The source files of these examples are available :scm_web:`here `. 10 | 11 | Installation 12 | ------------ 13 | 14 | .. code-block:: sh 15 | 16 | pip install opentelemetry-api 17 | pip install opentelemetry-sdk 18 | 19 | Run the Example 20 | --------------- 21 | 22 | .. code-block:: sh 23 | 24 | python .py 25 | 26 | The output will be shown in the console. 27 | 28 | Useful links 29 | ------------ 30 | 31 | - OpenTelemetry_ 32 | - :doc:`../../api/trace` 33 | 34 | .. _OpenTelemetry: https://github.com/open-telemetry/opentelemetry-python/ 35 | -------------------------------------------------------------------------------- /docs/examples/basic_tracer/basic_trace.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from opentelemetry import trace 16 | from opentelemetry.sdk.trace import TracerProvider 17 | from opentelemetry.sdk.trace.export import ( 18 | BatchSpanProcessor, 19 | ConsoleSpanExporter, 20 | ) 21 | 22 | trace.set_tracer_provider(TracerProvider()) 23 | trace.get_tracer_provider().add_span_processor( 24 | BatchSpanProcessor(ConsoleSpanExporter()) 25 | ) 26 | tracer = trace.get_tracer(__name__) 27 | with tracer.start_as_current_span("foo"): 28 | print("Hello world!") 29 | -------------------------------------------------------------------------------- /docs/examples/basic_tracer/resources.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from opentelemetry import trace 16 | from opentelemetry.sdk.resources import Resource 17 | from opentelemetry.sdk.trace import TracerProvider 18 | from opentelemetry.sdk.trace.export import ( 19 | BatchSpanProcessor, 20 | ConsoleSpanExporter, 21 | ) 22 | 23 | # Use Resource.create() instead of constructor directly 24 | resource = Resource.create({"service.name": "basic_service"}) 25 | 26 | trace.set_tracer_provider(TracerProvider(resource=resource)) 27 | 28 | trace.get_tracer_provider().add_span_processor( 29 | BatchSpanProcessor(ConsoleSpanExporter()) 30 | ) 31 | tracer = trace.get_tracer(__name__) 32 | with tracer.start_as_current_span("foo"): 33 | print("Hello world!") 34 | -------------------------------------------------------------------------------- /docs/examples/django/instrumentation_example/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/docs/examples/django/instrumentation_example/__init__.py -------------------------------------------------------------------------------- /docs/examples/django/instrumentation_example/asgi.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | """ 15 | ASGI config for instrumentation_example project. 16 | 17 | It exposes the ASGI callable as a module-level variable named ``application``. 18 | 19 | For more information on this file, see 20 | https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/ 21 | """ 22 | 23 | import os 24 | 25 | from django.core.asgi import get_asgi_application 26 | 27 | os.environ.setdefault( 28 | "DJANGO_SETTINGS_MODULE", "instrumentation_example.settings" 29 | ) 30 | 31 | application = get_asgi_application() 32 | -------------------------------------------------------------------------------- /docs/examples/django/instrumentation_example/wsgi.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | """ 15 | WSGI config for instrumentation_example project. 16 | 17 | It exposes the WSGI callable as a module-level variable named ``application``. 18 | 19 | For more information on this file, see 20 | https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/ 21 | """ 22 | 23 | import os 24 | 25 | from django.core.wsgi import get_wsgi_application 26 | 27 | os.environ.setdefault( 28 | "DJANGO_SETTINGS_MODULE", "instrumentation_example.settings" 29 | ) 30 | 31 | application = get_wsgi_application() 32 | -------------------------------------------------------------------------------- /docs/examples/django/pages/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | default_app_config = "pages.apps.PagesConfig" 16 | -------------------------------------------------------------------------------- /docs/examples/django/pages/apps.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | from django.apps import AppConfig 15 | 16 | 17 | class PagesConfig(AppConfig): 18 | name = "pages" 19 | -------------------------------------------------------------------------------- /docs/examples/django/pages/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/docs/examples/django/pages/migrations/__init__.py -------------------------------------------------------------------------------- /docs/examples/django/pages/urls.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | from django.urls import path 15 | 16 | from .views import home_page_view 17 | 18 | urlpatterns = [path("", home_page_view, name="home")] 19 | -------------------------------------------------------------------------------- /docs/examples/django/pages/views.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | from django.http import HttpResponse 15 | 16 | from opentelemetry import trace 17 | from opentelemetry.sdk.trace import TracerProvider 18 | from opentelemetry.sdk.trace.export import ( 19 | BatchSpanProcessor, 20 | ConsoleSpanExporter, 21 | ) 22 | 23 | trace.set_tracer_provider(TracerProvider()) 24 | 25 | trace.get_tracer_provider().add_span_processor( 26 | BatchSpanProcessor(ConsoleSpanExporter()) 27 | ) 28 | 29 | 30 | def home_page_view(request): 31 | return HttpResponse("Hello, world") 32 | -------------------------------------------------------------------------------- /docs/examples/error_handler/error_handler_0/README.rst: -------------------------------------------------------------------------------- 1 | Error Handler 0 2 | =============== 3 | 4 | This is just an error handler for this example. 5 | -------------------------------------------------------------------------------- /docs/examples/error_handler/error_handler_0/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["hatchling"] 3 | build-backend = "hatchling.build" 4 | 5 | [project] 6 | name = "error-handler-0" 7 | dynamic = ["version"] 8 | description = "This is just an error handler example package" 9 | readme = "README.rst" 10 | license = {text = "Apache-2.0"} 11 | requires-python = ">=3.9" 12 | authors = [ 13 | { name = "OpenTelemetry Authors", email = "cncf-opentelemetry-contributors@lists.cncf.io" }, 14 | ] 15 | classifiers = [ 16 | "Development Status :: 4 - Beta", 17 | "Intended Audience :: Developers", 18 | "License :: OSI Approved :: Apache Software License", 19 | "Programming Language :: Python", 20 | "Programming Language :: Python :: 3", 21 | "Programming Language :: Python :: 3.9", 22 | "Programming Language :: Python :: 3.10", 23 | "Programming Language :: Python :: 3.11", 24 | "Programming Language :: Python :: 3.12", 25 | "Programming Language :: Python :: 3.13", 26 | ] 27 | dependencies = [ 28 | "opentelemetry-sdk ~= 1.3", 29 | ] 30 | 31 | [project.entry-points.opentelemetry_error_handler] 32 | error_handler_0 = "error_handler_0:ErrorHandler0" 33 | 34 | [tool.hatch.version] 35 | path = "src/error_handler_0/version/__init__.py" 36 | 37 | [tool.hatch.build.targets.sdist] 38 | include = [ 39 | "/src", 40 | ] 41 | 42 | [tool.hatch.build.targets.wheel] 43 | packages = ["src/opentelemetry"] 44 | -------------------------------------------------------------------------------- /docs/examples/error_handler/error_handler_0/src/error_handler_0/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from logging import getLogger 16 | 17 | from opentelemetry.sdk.error_handler import ErrorHandler 18 | 19 | logger = getLogger(__name__) 20 | 21 | 22 | class ErrorHandler0(ErrorHandler, ZeroDivisionError): 23 | def _handle(self, error: Exception, *args, **kwargs): 24 | logger.exception("ErrorHandler0 handling a ZeroDivisionError") 25 | -------------------------------------------------------------------------------- /docs/examples/error_handler/error_handler_0/src/error_handler_0/version/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | __version__ = "0.23.dev0" 16 | -------------------------------------------------------------------------------- /docs/examples/error_handler/error_handler_1/README.rst: -------------------------------------------------------------------------------- 1 | Error Handler 1 2 | =============== 3 | 4 | This is just an error handler for this example. 5 | -------------------------------------------------------------------------------- /docs/examples/error_handler/error_handler_1/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["hatchling"] 3 | build-backend = "hatchling.build" 4 | 5 | [project] 6 | name = "error-handler-1" 7 | dynamic = ["version"] 8 | description = "This is just an error handler example package" 9 | readme = "README.rst" 10 | license = {text = "Apache-2.0"} 11 | requires-python = ">=3.9" 12 | authors = [ 13 | { name = "OpenTelemetry Authors", email = "cncf-opentelemetry-contributors@lists.cncf.io" }, 14 | ] 15 | classifiers = [ 16 | "Development Status :: 4 - Beta", 17 | "Intended Audience :: Developers", 18 | "License :: OSI Approved :: Apache Software License", 19 | "Programming Language :: Python", 20 | "Programming Language :: Python :: 3", 21 | "Programming Language :: Python :: 3.9", 22 | "Programming Language :: Python :: 3.10", 23 | "Programming Language :: Python :: 3.11", 24 | "Programming Language :: Python :: 3.12", 25 | "Programming Language :: Python :: 3.13", 26 | ] 27 | dependencies = [ 28 | "opentelemetry-sdk ~= 1.3", 29 | ] 30 | 31 | [project.entry-points.opentelemetry_error_handler] 32 | error_handler_1 = "error_handler_1:ErrorHandler1" 33 | 34 | [tool.hatch.version] 35 | path = "src/error_handler_1/version/__init__.py" 36 | 37 | [tool.hatch.build.targets.sdist] 38 | include = [ 39 | "/src", 40 | ] 41 | 42 | [tool.hatch.build.targets.wheel] 43 | packages = ["src/opentelemetry"] 44 | -------------------------------------------------------------------------------- /docs/examples/error_handler/error_handler_1/src/error_handler_1/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from logging import getLogger 16 | 17 | from opentelemetry.sdk.error_handler import ErrorHandler 18 | 19 | logger = getLogger(__name__) 20 | 21 | 22 | # pylint: disable=too-many-ancestors 23 | class ErrorHandler1(ErrorHandler, IndexError, KeyError): 24 | def _handle(self, error: Exception, *args, **kwargs): 25 | if isinstance(error, IndexError): 26 | logger.exception("ErrorHandler1 handling an IndexError") 27 | 28 | elif isinstance(error, KeyError): 29 | logger.exception("ErrorHandler1 handling a KeyError") 30 | -------------------------------------------------------------------------------- /docs/examples/error_handler/error_handler_1/src/error_handler_1/version/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | __version__ = "0.23.dev0" 16 | -------------------------------------------------------------------------------- /docs/examples/error_handler/example.py: -------------------------------------------------------------------------------- 1 | from opentelemetry.sdk.error_handler import GlobalErrorHandler 2 | 3 | # ZeroDivisionError to be handled by ErrorHandler0 4 | with GlobalErrorHandler(): 5 | 1 / 0 6 | 7 | print() 8 | 9 | # IndexError to be handled by ErrorHandler1 10 | with GlobalErrorHandler(): 11 | [1][2] 12 | 13 | print() 14 | 15 | # KeyError to be handled by ErrorHandler1 16 | with GlobalErrorHandler(): 17 | {1: 2}[2] 18 | 19 | print() 20 | 21 | # AssertionError to be handled by DefaultErrorHandler 22 | with GlobalErrorHandler(): 23 | assert False 24 | 25 | print() 26 | 27 | # No error raised 28 | with GlobalErrorHandler(): 29 | print("No error raised") 30 | -------------------------------------------------------------------------------- /docs/examples/fork-process-model/flask-gunicorn/README.rst: -------------------------------------------------------------------------------- 1 | Installation 2 | ------------ 3 | .. code-block:: sh 4 | 5 | pip install -rrequirements.txt 6 | 7 | Run application 8 | --------------- 9 | .. code-block:: sh 10 | 11 | gunicorn app -c gunicorn.conf.py 12 | -------------------------------------------------------------------------------- /docs/examples/fork-process-model/flask-gunicorn/requirements.txt: -------------------------------------------------------------------------------- 1 | click==8.1.7 2 | Flask==2.3.3 3 | googleapis-common-protos==1.52.0 4 | grpcio==1.56.2 5 | gunicorn==22.0.0 6 | itsdangerous==2.1.2 7 | Jinja2==3.1.6 8 | MarkupSafe==2.1.3 9 | opentelemetry-api==1.20.0 10 | opentelemetry-exporter-otlp==1.20.0 11 | opentelemetry-instrumentation==0.41b0 12 | opentelemetry-instrumentation-flask==0.41b0 13 | opentelemetry-instrumentation-wsgi==0.41b0 14 | opentelemetry-sdk==1.20.0 15 | protobuf==3.20.3 16 | six==1.15.0 17 | thrift==0.13.0 18 | uWSGI==2.0.22 19 | Werkzeug==3.0.6 20 | wrapt==1.16.0 21 | -------------------------------------------------------------------------------- /docs/examples/fork-process-model/flask-uwsgi/README.rst: -------------------------------------------------------------------------------- 1 | Installation 2 | ------------ 3 | .. code-block:: sh 4 | 5 | pip install -rrequirements.txt 6 | 7 | Run application 8 | --------------- 9 | 10 | .. code-block:: sh 11 | 12 | uwsgi --http :8000 --wsgi-file app.py --callable application --master --enable-threads 13 | -------------------------------------------------------------------------------- /docs/examples/fork-process-model/flask-uwsgi/requirements.txt: -------------------------------------------------------------------------------- 1 | click==8.1.7 2 | Flask==2.3.3 3 | googleapis-common-protos==1.52.0 4 | grpcio==1.56.2 5 | itsdangerous==2.1.2 6 | Jinja2==3.1.6 7 | MarkupSafe==2.1.3 8 | opentelemetry-api==1.20.0 9 | opentelemetry-exporter-otlp==1.20.0 10 | opentelemetry-instrumentation==0.41b0 11 | opentelemetry-instrumentation-flask==0.41b0 12 | opentelemetry-instrumentation-wsgi==0.41b0 13 | opentelemetry-sdk==1.20.0 14 | protobuf==3.20.3 15 | six==1.15.0 16 | thrift==0.13.0 17 | uWSGI==2.0.22 18 | Werkzeug==3.0.6 19 | wrapt==1.16.0 20 | -------------------------------------------------------------------------------- /docs/examples/index.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | Examples 4 | ======== 5 | 6 | .. toctree:: 7 | :maxdepth: 1 8 | :glob: 9 | 10 | ** 11 | -------------------------------------------------------------------------------- /docs/examples/logs/otel-collector-config.yaml: -------------------------------------------------------------------------------- 1 | receivers: 2 | otlp: 3 | protocols: 4 | grpc: 5 | endpoint: 0.0.0.0:4317 6 | 7 | exporters: 8 | debug: 9 | verbosity: detailed 10 | 11 | processors: 12 | batch: 13 | 14 | service: 15 | pipelines: 16 | logs: 17 | receivers: [otlp] 18 | processors: [batch] 19 | exporters: [debug] 20 | traces: 21 | receivers: [otlp] 22 | processors: [batch] 23 | exporters: [debug] -------------------------------------------------------------------------------- /docs/examples/metrics/instruments/otel-collector-config.yaml: -------------------------------------------------------------------------------- 1 | receivers: 2 | otlp: 3 | protocols: 4 | grpc: 5 | endpoint: 0.0.0.0:4317 6 | 7 | exporters: 8 | debug: 9 | 10 | processors: 11 | batch: 12 | 13 | service: 14 | pipelines: 15 | metrics: 16 | receivers: [otlp] 17 | exporters: [debug] 18 | -------------------------------------------------------------------------------- /docs/examples/metrics/instruments/requirements.txt: -------------------------------------------------------------------------------- 1 | opentelemetry-api~=1.25 2 | opentelemetry-sdk~=1.25 3 | opentelemetry-exporter-otlp~=1.25 4 | -------------------------------------------------------------------------------- /docs/examples/metrics/prometheus-grafana/prometheus-monitor.py: -------------------------------------------------------------------------------- 1 | import random 2 | import time 3 | 4 | from prometheus_client import start_http_server 5 | 6 | from opentelemetry.exporter.prometheus import PrometheusMetricReader 7 | from opentelemetry.metrics import get_meter_provider, set_meter_provider 8 | from opentelemetry.sdk.metrics import MeterProvider 9 | 10 | # Start Prometheus client 11 | start_http_server(port=8000, addr="localhost") 12 | # Exporter to export metrics to Prometheus 13 | prefix = "MyAppPrefix" 14 | reader = PrometheusMetricReader(prefix) 15 | # Meter is responsible for creating and recording metrics 16 | set_meter_provider(MeterProvider(metric_readers=[reader])) 17 | meter = get_meter_provider().get_meter("view-name-change", "0.1.2") 18 | 19 | my_counter = meter.create_counter("my.counter") 20 | 21 | while 1: 22 | my_counter.add(random.randint(1, 10)) 23 | time.sleep(random.random()) 24 | -------------------------------------------------------------------------------- /docs/examples/metrics/prometheus-grafana/requirements.txt: -------------------------------------------------------------------------------- 1 | opentelemetry-exporter-prometheus==1.12.0rc1 2 | protobuf~=3.18.1 3 | -------------------------------------------------------------------------------- /docs/examples/metrics/reader/README.rst: -------------------------------------------------------------------------------- 1 | MetricReader configuration scenarios 2 | ==================================== 3 | 4 | These examples show how to customize the metrics that are output by the SDK using configuration on metric readers. There are multiple examples: 5 | 6 | * preferred_aggregation.py: Shows how to configure the preferred aggregation for metric instrument types. 7 | * preferred_temporality.py: Shows how to configure the preferred temporality for metric instrument types. 8 | * preferred_exemplarfilter.py: Shows how to configure the exemplar filter. 9 | * synchronous_gauge_read.py: Shows how to use `PeriodicExportingMetricReader` in a synchronous manner to explicitly control the collection of metrics. 10 | 11 | The source files of these examples are available :scm_web:`here `. 12 | 13 | 14 | Installation 15 | ------------ 16 | 17 | .. code-block:: sh 18 | 19 | pip install -r requirements.txt 20 | 21 | Run the Example 22 | --------------- 23 | 24 | .. code-block:: sh 25 | 26 | python .py 27 | 28 | The output will be shown in the console. 29 | 30 | Useful links 31 | ------------ 32 | 33 | - OpenTelemetry_ 34 | - :doc:`../../../api/metrics` 35 | 36 | .. _OpenTelemetry: https://github.com/open-telemetry/opentelemetry-python/ 37 | -------------------------------------------------------------------------------- /docs/examples/metrics/reader/requirements.txt: -------------------------------------------------------------------------------- 1 | opentelemetry-api==1.15.0 2 | opentelemetry-sdk==1.15.0 3 | opentelemetry-semantic-conventions==0.36b0 4 | typing_extensions==4.5.0 5 | wrapt==1.14.1 6 | -------------------------------------------------------------------------------- /docs/examples/metrics/views/README.rst: -------------------------------------------------------------------------------- 1 | View common scenarios 2 | ===================== 3 | 4 | These examples show how to customize the metrics that are output by the SDK using Views. There are multiple examples: 5 | 6 | * change_aggregation.py: Shows how to configure to change the default aggregation for an instrument. 7 | * change_name.py: Shows how to change the name of a metric. 8 | * limit_num_of_attrs.py: Shows how to limit the number of attributes that are output for a metric. 9 | * drop_metrics_from_instrument.py: Shows how to drop measurements from an instrument. 10 | * change_reservoir_factory.py: Shows how to use your own ``ExemplarReservoir`` 11 | 12 | The source files of these examples are available :scm_web:`here `. 13 | 14 | 15 | Installation 16 | ------------ 17 | 18 | .. code-block:: sh 19 | 20 | pip install -r requirements.txt 21 | 22 | Run the Example 23 | --------------- 24 | 25 | .. code-block:: sh 26 | 27 | python .py 28 | 29 | The output will be shown in the console. 30 | 31 | Useful links 32 | ------------ 33 | 34 | - OpenTelemetry_ 35 | - :doc:`../../../api/metrics` 36 | 37 | .. _OpenTelemetry: https://github.com/open-telemetry/opentelemetry-python/ 38 | -------------------------------------------------------------------------------- /docs/examples/metrics/views/requirements.txt: -------------------------------------------------------------------------------- 1 | opentelemetry-api==1.12.0 2 | opentelemetry-sdk==1.12.0 3 | opentelemetry-semantic-conventions==0.33b0 4 | typing_extensions==4.5.0 5 | wrapt==1.14.1 6 | -------------------------------------------------------------------------------- /docs/examples/opencensus-exporter-tracer/docker/collector-config.yaml: -------------------------------------------------------------------------------- 1 | receivers: 2 | opencensus: 3 | endpoint: "0.0.0.0:55678" 4 | 5 | exporters: 6 | jaeger_grpc: 7 | endpoint: jaeger-all-in-one:14250 8 | debug: 9 | 10 | processors: 11 | batch: 12 | queued_retry: 13 | 14 | service: 15 | pipelines: 16 | traces: 17 | receivers: [opencensus] 18 | exporters: [jaeger_grpc, debug] 19 | processors: [batch, queued_retry] 20 | -------------------------------------------------------------------------------- /docs/examples/opencensus-exporter-tracer/docker/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: "2" 2 | services: 3 | 4 | # Collector 5 | collector: 6 | image: omnition/opentelemetry-collector-contrib:latest 7 | command: ["--config=/conf/collector-config.yaml", "--log-level=DEBUG"] 8 | volumes: 9 | - ./collector-config.yaml:/conf/collector-config.yaml 10 | ports: 11 | - "55678:55678" 12 | 13 | jaeger-all-in-one: 14 | image: jaegertracing/all-in-one:latest 15 | ports: 16 | - "16686:16686" 17 | - "6831:6831/udp" 18 | - "6832:6832/udp" 19 | - "14268" 20 | - "14250" 21 | -------------------------------------------------------------------------------- /docs/examples/opencensus-shim/.gitignore: -------------------------------------------------------------------------------- 1 | example.db 2 | -------------------------------------------------------------------------------- /docs/examples/opencensus-shim/requirements.txt: -------------------------------------------------------------------------------- 1 | opentelemetry-api 2 | opentelemetry-sdk 3 | opentelemetry-exporter-otlp 4 | opentelemetry-opencensus-shim 5 | opentelemetry-instrumentation-sqlite3 6 | opencensus 7 | opencensus-ext-flask 8 | Flask 9 | -------------------------------------------------------------------------------- /docs/examples/opentracing/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/docs/examples/opentracing/__init__.py -------------------------------------------------------------------------------- /docs/examples/opentracing/requirements.txt: -------------------------------------------------------------------------------- 1 | opentelemetry-api 2 | opentelemetry-sdk 3 | opentelemetry-exporter-otlp 4 | opentelemetry-opentracing-shim 5 | redis 6 | redis_opentracing 7 | -------------------------------------------------------------------------------- /docs/exporter/index.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | Exporters 4 | ========= 5 | 6 | .. toctree:: 7 | :maxdepth: 1 8 | :glob: 9 | 10 | ** 11 | -------------------------------------------------------------------------------- /docs/exporter/opencensus/opencensus.rst: -------------------------------------------------------------------------------- 1 | OpenCensus Exporter 2 | =================== 3 | 4 | .. automodule:: opentelemetry.exporter.opencensus 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /docs/exporter/otlp/otlp.rst: -------------------------------------------------------------------------------- 1 | OpenTelemetry OTLP Exporters 2 | ============================ 3 | .. automodule:: opentelemetry.exporter.otlp 4 | :members: 5 | :undoc-members: 6 | :show-inheritance: 7 | 8 | opentelemetry.exporter.otlp.proto.http 9 | --------------------------------------- 10 | 11 | .. automodule:: opentelemetry.exporter.otlp.proto.http 12 | :members: 13 | :undoc-members: 14 | :show-inheritance: 15 | 16 | .. automodule:: opentelemetry.exporter.otlp.proto.http.trace_exporter 17 | 18 | .. automodule:: opentelemetry.exporter.otlp.proto.http.metric_exporter 19 | 20 | .. automodule:: opentelemetry.exporter.otlp.proto.http._log_exporter 21 | 22 | opentelemetry.exporter.otlp.proto.grpc 23 | --------------------------------------- 24 | 25 | .. automodule:: opentelemetry.exporter.otlp.proto.grpc 26 | :members: 27 | :undoc-members: 28 | :show-inheritance: 29 | 30 | .. automodule:: opentelemetry.exporter.otlp.proto.grpc.trace_exporter 31 | 32 | .. automodule:: opentelemetry.exporter.otlp.proto.grpc.metric_exporter 33 | 34 | .. automodule:: opentelemetry.exporter.otlp.proto.grpc._log_exporter 35 | -------------------------------------------------------------------------------- /docs/exporter/zipkin/zipkin.rst: -------------------------------------------------------------------------------- 1 | OpenTelemetry Zipkin Exporters 2 | ============================== 3 | 4 | .. automodule:: opentelemetry.exporter.zipkin 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | 9 | .. automodule:: opentelemetry.exporter.zipkin.json 10 | :members: 11 | :undoc-members: 12 | :show-inheritance: 13 | 14 | .. automodule:: opentelemetry.exporter.zipkin.proto.http 15 | :members: 16 | :undoc-members: 17 | :show-inheritance: 18 | -------------------------------------------------------------------------------- /docs/getting_started/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/docs/getting_started/__init__.py -------------------------------------------------------------------------------- /docs/getting_started/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /docs/getting_started/tests/requirements.txt: -------------------------------------------------------------------------------- 1 | asgiref==3.7.2 2 | attrs==23.1.0 3 | certifi==2024.7.4 4 | charset-normalizer==2.0.12 5 | click==8.1.7 6 | Flask==2.3.3 7 | idna==3.7 8 | importlib-metadata==6.8.0 9 | iniconfig==2.0.0 10 | itsdangerous==2.1.2 11 | Jinja2==3.1.5 12 | MarkupSafe==2.1.3 13 | packaging==24.0 14 | pluggy==1.3.0 15 | py-cpuinfo==9.0.0 16 | pytest==7.4.4 17 | requests==2.32.3 18 | tomli==2.0.1 19 | typing_extensions==4.8.0 20 | urllib3==1.26.19 21 | Werkzeug==3.0.6 22 | wrapt==1.15.0 23 | zipp==3.19.2 24 | -e opentelemetry-semantic-conventions 25 | -e opentelemetry-proto 26 | -e exporter/opentelemetry-exporter-otlp-proto-common 27 | -e exporter/opentelemetry-exporter-otlp-proto-grpc 28 | -e opentelemetry-api 29 | -e opentelemetry-sdk 30 | -------------------------------------------------------------------------------- /docs/getting_started/tests/test_tracing.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | import os 15 | import subprocess 16 | import sys 17 | import unittest 18 | 19 | 20 | class TestBasicTracerExample(unittest.TestCase): 21 | def test_basic_tracer(self): 22 | dirpath = os.path.dirname(os.path.realpath(__file__)) 23 | test_script = f"{dirpath}/../tracing_example.py" 24 | output = subprocess.check_output( 25 | (sys.executable, test_script) 26 | ).decode() 27 | 28 | self.assertIn('"name": "foo"', output) 29 | self.assertIn('"name": "bar"', output) 30 | self.assertIn('"name": "baz"', output) 31 | -------------------------------------------------------------------------------- /docs/getting_started/tracing_example.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # tracing.py 16 | from opentelemetry import trace 17 | from opentelemetry.sdk.trace import TracerProvider 18 | from opentelemetry.sdk.trace.export import ( 19 | BatchSpanProcessor, 20 | ConsoleSpanExporter, 21 | ) 22 | 23 | provider = TracerProvider() 24 | processor = BatchSpanProcessor(ConsoleSpanExporter()) 25 | provider.add_span_processor(processor) 26 | trace.set_tracer_provider(provider) 27 | 28 | 29 | tracer = trace.get_tracer(__name__) 30 | 31 | with tracer.start_as_current_span("foo"): 32 | with tracer.start_as_current_span("bar"): 33 | with tracer.start_as_current_span("baz"): 34 | print("Hello world from OpenTelemetry Python!") 35 | -------------------------------------------------------------------------------- /docs/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | set SOURCEDIR=. 11 | set BUILDDIR=_build 12 | 13 | if "%1" == "" goto help 14 | 15 | %SPHINXBUILD% >NUL 2>NUL 16 | if errorlevel 9009 ( 17 | echo. 18 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 19 | echo.installed, then set the SPHINXBUILD environment variable to point 20 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 21 | echo.may add the Sphinx directory to PATH. 22 | echo. 23 | echo.If you don't have Sphinx installed, grab it from 24 | echo.http://sphinx-doc.org/ 25 | exit /b 1 26 | ) 27 | 28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 29 | goto end 30 | 31 | :help 32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 33 | 34 | :end 35 | popd 36 | -------------------------------------------------------------------------------- /docs/sdk/_logs.rst: -------------------------------------------------------------------------------- 1 | opentelemetry.sdk._logs package 2 | =============================== 3 | 4 | .. automodule:: opentelemetry.sdk._logs 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /docs/sdk/environment_variables.rst: -------------------------------------------------------------------------------- 1 | opentelemetry.sdk.environment_variables 2 | ======================================= 3 | 4 | .. TODO: what is the SDK 5 | 6 | .. toctree:: 7 | :maxdepth: 1 8 | 9 | .. automodule:: opentelemetry.sdk.environment_variables 10 | :members: 11 | :undoc-members: 12 | :show-inheritance: 13 | -------------------------------------------------------------------------------- /docs/sdk/error_handler.rst: -------------------------------------------------------------------------------- 1 | opentelemetry.sdk.error_handler package 2 | ======================================= 3 | 4 | .. automodule:: opentelemetry.sdk.error_handler 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /docs/sdk/index.rst: -------------------------------------------------------------------------------- 1 | OpenTelemetry Python SDK 2 | ======================== 3 | 4 | .. TODO: what is the SDK 5 | 6 | .. toctree:: 7 | :maxdepth: 1 8 | 9 | _logs 10 | resources 11 | trace 12 | metrics 13 | error_handler 14 | environment_variables 15 | -------------------------------------------------------------------------------- /docs/sdk/metrics.export.rst: -------------------------------------------------------------------------------- 1 | opentelemetry.sdk.metrics.export 2 | ================================ 3 | 4 | .. automodule:: opentelemetry.sdk.metrics.export 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /docs/sdk/metrics.rst: -------------------------------------------------------------------------------- 1 | opentelemetry.sdk.metrics package 2 | ================================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | .. toctree:: 8 | 9 | metrics.export 10 | metrics.view 11 | 12 | .. automodule:: opentelemetry.sdk.metrics 13 | :members: 14 | :undoc-members: 15 | :show-inheritance: 16 | -------------------------------------------------------------------------------- /docs/sdk/metrics.view.rst: -------------------------------------------------------------------------------- 1 | opentelemetry.sdk.metrics.view 2 | ============================== 3 | 4 | .. automodule:: opentelemetry.sdk.metrics.view 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /docs/sdk/resources.rst: -------------------------------------------------------------------------------- 1 | opentelemetry.sdk.resources package 2 | ========================================== 3 | 4 | .. automodule:: opentelemetry.sdk.resources 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /docs/sdk/trace.export.rst: -------------------------------------------------------------------------------- 1 | opentelemetry.sdk.trace.export 2 | ========================================== 3 | 4 | .. automodule:: opentelemetry.sdk.trace.export 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: -------------------------------------------------------------------------------- /docs/sdk/trace.id_generator.rst: -------------------------------------------------------------------------------- 1 | opentelemetry.sdk.trace.id_generator 2 | ==================================== 3 | 4 | .. automodule:: opentelemetry.sdk.trace.id_generator 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /docs/sdk/trace.rst: -------------------------------------------------------------------------------- 1 | opentelemetry.sdk.trace package 2 | =============================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | .. toctree:: 8 | 9 | trace.export 10 | trace.id_generator 11 | trace.sampling 12 | util.instrumentation 13 | 14 | .. automodule:: opentelemetry.sdk.trace 15 | :members: 16 | :undoc-members: 17 | :show-inheritance: 18 | -------------------------------------------------------------------------------- /docs/sdk/trace.sampling.rst: -------------------------------------------------------------------------------- 1 | opentelemetry.sdk.trace.sampling 2 | ========================================== 3 | 4 | .. automodule:: opentelemetry.sdk.trace.sampling 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: -------------------------------------------------------------------------------- /docs/sdk/util.instrumentation.rst: -------------------------------------------------------------------------------- 1 | opentelemetry.sdk.util.instrumentation 2 | ========================================== 3 | 4 | .. automodule:: opentelemetry.sdk.util.instrumentation 5 | -------------------------------------------------------------------------------- /docs/shim/index.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | Shims 4 | ===== 5 | 6 | .. toctree:: 7 | :maxdepth: 1 8 | :glob: 9 | 10 | ** 11 | -------------------------------------------------------------------------------- /docs/shim/opencensus_shim/opencensus_shim.rst: -------------------------------------------------------------------------------- 1 | OpenCensus Shim for OpenTelemetry 2 | ================================== 3 | 4 | .. automodule:: opentelemetry.shim.opencensus 5 | :no-show-inheritance: 6 | -------------------------------------------------------------------------------- /docs/shim/opentracing_shim/opentracing_shim.rst: -------------------------------------------------------------------------------- 1 | OpenTracing Shim for OpenTelemetry 2 | ================================== 3 | 4 | .. automodule:: opentelemetry.shim.opentracing_shim 5 | :no-show-inheritance: 6 | -------------------------------------------------------------------------------- /eachdist.ini: -------------------------------------------------------------------------------- 1 | # These will be sorted first in that order. 2 | # All packages that are depended upon by others should be listed here. 3 | [DEFAULT] 4 | 5 | sortfirst= 6 | opentelemetry-api 7 | opentelemetry-sdk 8 | opentelemetry-proto 9 | opentelemetry-distro 10 | tests/opentelemetry-test-utils 11 | exporter/* 12 | 13 | [stable] 14 | version=1.35.0.dev 15 | 16 | packages= 17 | opentelemetry-sdk 18 | opentelemetry-proto 19 | opentelemetry-propagator-jaeger 20 | opentelemetry-propagator-b3 21 | opentelemetry-exporter-zipkin-proto-http 22 | opentelemetry-exporter-zipkin-json 23 | opentelemetry-exporter-zipkin 24 | opentelemetry-exporter-otlp-proto-grpc 25 | opentelemetry-exporter-otlp-proto-http 26 | opentelemetry-exporter-otlp 27 | opentelemetry-api 28 | 29 | [prerelease] 30 | version=0.56b0.dev 31 | 32 | packages= 33 | opentelemetry-opentracing-shim 34 | opentelemetry-opencensus-shim 35 | opentelemetry-exporter-opencensus 36 | opentelemetry-exporter-prometheus 37 | opentelemetry-distro 38 | opentelemetry-semantic-conventions 39 | opentelemetry-test-utils 40 | tests 41 | 42 | [lintroots] 43 | extraroots=examples/*,scripts/ 44 | subglob=*.py,tests/,test/,src/*,examples/* 45 | 46 | [testroots] 47 | extraroots=examples/*,tests/ 48 | subglob=tests/,test/ 49 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-opencensus/README.rst: -------------------------------------------------------------------------------- 1 | OpenCensus Exporter 2 | =================== 3 | 4 | |pypi| 5 | 6 | .. |pypi| image:: https://badge.fury.io/py/opentelemetry-exporter-opencensus.svg 7 | :target: https://pypi.org/project/opentelemetry-exporter-opencensus/ 8 | 9 | This library allows to export traces using OpenCensus. 10 | 11 | Installation 12 | ------------ 13 | 14 | :: 15 | 16 | pip install opentelemetry-exporter-opencensus 17 | 18 | 19 | References 20 | ---------- 21 | 22 | * `OpenCensus Exporter `_ 23 | * `OpenTelemetry Collector `_ 24 | * `OpenTelemetry `_ 25 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-opencensus/src/opentelemetry/exporter/opencensus/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | """ 16 | The **OpenCensus Exporter** allows to export traces using OpenCensus. 17 | """ 18 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-opencensus/src/opentelemetry/exporter/opencensus/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/exporter/opentelemetry-exporter-opencensus/src/opentelemetry/exporter/opencensus/py.typed -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-opencensus/src/opentelemetry/exporter/opencensus/version/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | __version__ = "0.56b0.dev" 16 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-opencensus/test-requirements.txt: -------------------------------------------------------------------------------- 1 | asgiref==3.7.2 2 | grpcio==1.66.2 3 | importlib-metadata==6.11.0 4 | iniconfig==2.0.0 5 | opencensus-proto==0.1.0 6 | packaging==24.0 7 | pluggy==1.5.0 8 | protobuf==3.20.3 9 | py-cpuinfo==9.0.0 10 | pytest==7.4.4 11 | tomli==2.0.1 12 | typing_extensions==4.10.0 13 | wrapt==1.16.0 14 | zipp==3.19.2 15 | -e opentelemetry-api 16 | -e opentelemetry-sdk 17 | -e tests/opentelemetry-test-utils 18 | -e opentelemetry-semantic-conventions 19 | -e exporter/opentelemetry-exporter-opencensus 20 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-opencensus/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/exporter/opentelemetry-exporter-opencensus/tests/__init__.py -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-otlp-proto-common/README.rst: -------------------------------------------------------------------------------- 1 | OpenTelemetry Protobuf Encoding 2 | =============================== 3 | 4 | |pypi| 5 | 6 | .. |pypi| image:: https://badge.fury.io/py/opentelemetry-exporter-otlp-proto-common.svg 7 | :target: https://pypi.org/project/opentelemetry-exporter-otlp-proto-common/ 8 | 9 | This library is provided as a convenience to encode to Protobuf. Currently used by: 10 | 11 | * opentelemetry-exporter-otlp-proto-grpc 12 | * opentelemetry-exporter-otlp-proto-http 13 | 14 | 15 | Installation 16 | ------------ 17 | 18 | :: 19 | 20 | pip install opentelemetry-exporter-otlp-proto-common 21 | 22 | 23 | References 24 | ---------- 25 | 26 | * `OpenTelemetry `_ 27 | * `OpenTelemetry Protocol Specification `_ 28 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-otlp-proto-common/src/opentelemetry/exporter/otlp/proto/common/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | 16 | from opentelemetry.exporter.otlp.proto.common.version import __version__ 17 | 18 | __all__ = ["__version__"] 19 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-otlp-proto-common/src/opentelemetry/exporter/otlp/proto/common/_log_encoder.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | 16 | from opentelemetry.exporter.otlp.proto.common._internal._log_encoder import ( 17 | encode_logs, 18 | ) 19 | 20 | __all__ = ["encode_logs"] 21 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-otlp-proto-common/src/opentelemetry/exporter/otlp/proto/common/metrics_encoder.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | 16 | from opentelemetry.exporter.otlp.proto.common._internal.metrics_encoder import ( 17 | encode_metrics, 18 | ) 19 | 20 | __all__ = ["encode_metrics"] 21 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-otlp-proto-common/src/opentelemetry/exporter/otlp/proto/common/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/exporter/opentelemetry-exporter-otlp-proto-common/src/opentelemetry/exporter/otlp/proto/common/py.typed -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-otlp-proto-common/src/opentelemetry/exporter/otlp/proto/common/trace_encoder.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | 16 | from opentelemetry.exporter.otlp.proto.common._internal.trace_encoder import ( 17 | encode_spans, 18 | ) 19 | 20 | __all__ = ["encode_spans"] 21 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-otlp-proto-common/src/opentelemetry/exporter/otlp/proto/common/version/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | __version__ = "1.35.0.dev" 16 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-otlp-proto-common/test-requirements.txt: -------------------------------------------------------------------------------- 1 | asgiref==3.7.2 2 | importlib-metadata==6.11.0 3 | iniconfig==2.0.0 4 | packaging==24.0 5 | pluggy==1.5.0 6 | protobuf==5.26.1 7 | py-cpuinfo==9.0.0 8 | pytest==7.4.4 9 | tomli==2.0.1 10 | typing_extensions==4.10.0 11 | wrapt==1.16.0 12 | zipp==3.19.2 13 | -e opentelemetry-api 14 | -e opentelemetry-sdk 15 | -e opentelemetry-semantic-conventions 16 | -e tests/opentelemetry-test-utils 17 | -e opentelemetry-proto 18 | -e exporter/opentelemetry-exporter-otlp-proto-common 19 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-otlp-proto-common/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/exporter/opentelemetry-exporter-otlp-proto-common/tests/__init__.py -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-otlp-proto-grpc/README.rst: -------------------------------------------------------------------------------- 1 | OpenTelemetry Collector Protobuf over gRPC Exporter 2 | =================================================== 3 | 4 | |pypi| 5 | 6 | .. |pypi| image:: https://badge.fury.io/py/opentelemetry-exporter-otlp-proto-grpc.svg 7 | :target: https://pypi.org/project/opentelemetry-exporter-otlp-proto-grpc/ 8 | 9 | This library allows to export data to the OpenTelemetry Collector using the OpenTelemetry Protocol using Protobuf over gRPC. 10 | 11 | Installation 12 | ------------ 13 | 14 | :: 15 | 16 | pip install opentelemetry-exporter-otlp-proto-grpc 17 | 18 | 19 | References 20 | ---------- 21 | 22 | * `OpenTelemetry Collector Exporter `_ 23 | * `OpenTelemetry Collector `_ 24 | * `OpenTelemetry `_ 25 | * `OpenTelemetry Protocol Specification `_ 26 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-otlp-proto-grpc/benchmark-requirements.txt: -------------------------------------------------------------------------------- 1 | pytest-benchmark==4.0.0 2 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/py.typed -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/version/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | __version__ = "1.35.0.dev" 16 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-otlp-proto-grpc/test-requirements.txt: -------------------------------------------------------------------------------- 1 | asgiref==3.7.2 2 | googleapis-common-protos==1.63.2 3 | grpcio==1.66.2 4 | importlib-metadata==6.11.0 5 | iniconfig==2.0.0 6 | packaging==24.0 7 | pluggy==1.5.0 8 | protobuf==5.26.1 9 | py-cpuinfo==9.0.0 10 | pytest==7.4.4 11 | tomli==2.0.1 12 | typing_extensions==4.10.0 13 | wrapt==1.16.0 14 | zipp==3.19.2 15 | -e opentelemetry-api 16 | -e tests/opentelemetry-test-utils 17 | -e exporter/opentelemetry-exporter-otlp-proto-common 18 | -e opentelemetry-proto 19 | -e opentelemetry-sdk 20 | -e opentelemetry-semantic-conventions 21 | -e exporter/opentelemetry-exporter-otlp-proto-grpc 22 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-otlp-proto-grpc/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/__init__.py -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-otlp-proto-grpc/tests/fixtures/test-client-cert.pem: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/fixtures/test-client-cert.pem -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-otlp-proto-grpc/tests/fixtures/test-client-key.pem: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/fixtures/test-client-key.pem -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-otlp-proto-grpc/tests/fixtures/test.cert: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/fixtures/test.cert -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-otlp-proto-grpc/tests/logs/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/logs/__init__.py -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-otlp-proto-http/README.rst: -------------------------------------------------------------------------------- 1 | OpenTelemetry Collector Protobuf over HTTP Exporter 2 | =================================================== 3 | 4 | |pypi| 5 | 6 | .. |pypi| image:: https://badge.fury.io/py/opentelemetry-exporter-otlp-proto-http.svg 7 | :target: https://pypi.org/project/opentelemetry-exporter-otlp-proto-http/ 8 | 9 | This library allows to export data to the OpenTelemetry Collector using the OpenTelemetry Protocol using Protobuf over HTTP. 10 | 11 | Installation 12 | ------------ 13 | 14 | :: 15 | 16 | pip install opentelemetry-exporter-otlp-proto-http 17 | 18 | 19 | References 20 | ---------- 21 | 22 | * `OpenTelemetry Collector Exporter `_ 23 | * `OpenTelemetry Collector `_ 24 | * `OpenTelemetry `_ 25 | * `OpenTelemetry Protocol Specification `_ 26 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/py.typed -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-otlp-proto-http/src/opentelemetry/exporter/otlp/proto/http/version/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | __version__ = "1.35.0.dev" 16 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-otlp-proto-http/test-requirements.txt: -------------------------------------------------------------------------------- 1 | asgiref==3.7.2 2 | certifi==2024.7.4 3 | charset-normalizer==3.3.2 4 | googleapis-common-protos==1.63.2 5 | idna==3.7 6 | importlib-metadata==6.11.0 7 | iniconfig==2.0.0 8 | packaging==24.0 9 | pluggy==1.5.0 10 | protobuf==5.26.1 11 | py-cpuinfo==9.0.0 12 | pytest==7.4.4 13 | PyYAML==6.0.1 14 | requests==2.32.3 15 | responses==0.24.1 16 | tomli==2.0.1 17 | typing_extensions==4.10.0 18 | urllib3==2.2.2 19 | wrapt==1.16.0 20 | zipp==3.19.2 21 | -e opentelemetry-api 22 | -e tests/opentelemetry-test-utils 23 | -e exporter/opentelemetry-exporter-otlp-proto-common 24 | -e opentelemetry-proto 25 | -e opentelemetry-sdk 26 | -e opentelemetry-semantic-conventions 27 | -e exporter/opentelemetry-exporter-otlp-proto-http 28 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-otlp-proto-http/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/exporter/opentelemetry-exporter-otlp-proto-http/tests/__init__.py -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-otlp-proto-http/tests/metrics/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/exporter/opentelemetry-exporter-otlp-proto-http/tests/metrics/__init__.py -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-otlp/README.rst: -------------------------------------------------------------------------------- 1 | OpenTelemetry Collector Exporters 2 | ================================= 3 | 4 | |pypi| 5 | 6 | .. |pypi| image:: https://badge.fury.io/py/opentelemetry-exporter-otlp.svg 7 | :target: https://pypi.org/project/opentelemetry-exporter-otlp/ 8 | 9 | This library is provided as a convenience to install all supported OpenTelemetry Collector Exporters. Currently it installs: 10 | 11 | * opentelemetry-exporter-otlp-proto-grpc 12 | * opentelemetry-exporter-otlp-proto-http 13 | 14 | In the future, additional packages will be available: 15 | * opentelemetry-exporter-otlp-json-http 16 | 17 | To avoid unnecessary dependencies, users should install the specific package once they've determined their 18 | preferred serialization and protocol method. 19 | 20 | Installation 21 | ------------ 22 | 23 | :: 24 | 25 | pip install opentelemetry-exporter-otlp 26 | 27 | 28 | References 29 | ---------- 30 | 31 | * `OpenTelemetry Collector Exporter `_ 32 | * `OpenTelemetry Collector `_ 33 | * `OpenTelemetry `_ 34 | * `OpenTelemetry Protocol Specification `_ 35 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/py.typed -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/version/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | __version__ = "1.35.0.dev" 16 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-otlp/test-requirements.txt: -------------------------------------------------------------------------------- 1 | asgiref==3.7.2 2 | importlib-metadata==6.11.0 3 | iniconfig==2.0.0 4 | packaging==24.0 5 | pluggy==1.5.0 6 | py-cpuinfo==9.0.0 7 | pytest==7.4.4 8 | tomli==2.0.1 9 | typing_extensions==4.10.0 10 | wrapt==1.16.0 11 | zipp==3.19.2 12 | -e opentelemetry-api 13 | -e tests/opentelemetry-test-utils 14 | -e exporter/opentelemetry-exporter-otlp-proto-common 15 | -e exporter/opentelemetry-exporter-otlp-proto-grpc 16 | -e exporter/opentelemetry-exporter-otlp-proto-http 17 | -e opentelemetry-proto 18 | -e opentelemetry-sdk 19 | -e opentelemetry-semantic-conventions 20 | -e exporter/opentelemetry-exporter-otlp 21 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-otlp/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/exporter/opentelemetry-exporter-otlp/tests/__init__.py -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-prometheus/README.rst: -------------------------------------------------------------------------------- 1 | OpenTelemetry Prometheus Exporter 2 | ================================= 3 | 4 | |pypi| 5 | 6 | .. |pypi| image:: https://badge.fury.io/py/opentelemetry-exporter-prometheus.svg 7 | :target: https://pypi.org/project/opentelemetry-exporter-prometheus/ 8 | 9 | This library allows to export metrics data to `Prometheus `_. 10 | 11 | Installation 12 | ------------ 13 | 14 | :: 15 | 16 | pip install opentelemetry-exporter-prometheus 17 | 18 | References 19 | ---------- 20 | 21 | * `OpenTelemetry Prometheus Exporter `_ 22 | * `Prometheus `_ 23 | * `OpenTelemetry Project `_ 24 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-prometheus/src/opentelemetry/exporter/prometheus/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/exporter/opentelemetry-exporter-prometheus/src/opentelemetry/exporter/prometheus/py.typed -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-prometheus/src/opentelemetry/exporter/prometheus/version/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | __version__ = "0.56b0.dev" 16 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-prometheus/test-requirements.txt: -------------------------------------------------------------------------------- 1 | asgiref==3.7.2 2 | importlib-metadata==6.11.0 3 | iniconfig==2.0.0 4 | packaging==24.0 5 | pluggy==1.5.0 6 | prometheus_client==0.20.0 7 | py-cpuinfo==9.0.0 8 | pytest==7.4.4 9 | tomli==2.0.1 10 | typing_extensions==4.10.0 11 | wrapt==1.16.0 12 | zipp==3.19.2 13 | -e opentelemetry-api 14 | -e opentelemetry-sdk 15 | -e tests/opentelemetry-test-utils 16 | -e opentelemetry-semantic-conventions 17 | -e exporter/opentelemetry-exporter-prometheus 18 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-prometheus/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-zipkin-json/CHANGELOG.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/exporter/opentelemetry-exporter-zipkin-json/CHANGELOG.md -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-zipkin-json/README.rst: -------------------------------------------------------------------------------- 1 | OpenTelemetry Zipkin JSON Exporter 2 | ================================== 3 | 4 | |pypi| 5 | 6 | .. |pypi| image:: https://badge.fury.io/py/opentelemetry-exporter-zipkin-json.svg 7 | :target: https://pypi.org/project/opentelemetry-exporter-zipkin-json/ 8 | 9 | This library allows export of tracing data to `Zipkin `_ using JSON 10 | for serialization. 11 | 12 | Installation 13 | ------------ 14 | 15 | :: 16 | 17 | pip install opentelemetry-exporter-zipkin-json 18 | 19 | 20 | References 21 | ---------- 22 | 23 | * `OpenTelemetry Zipkin Exporter `_ 24 | * `Zipkin `_ 25 | * `OpenTelemetry Project `_ 26 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-zipkin-json/src/opentelemetry/exporter/zipkin/json/version/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | __version__ = "1.35.0.dev" 16 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-zipkin-json/src/opentelemetry/exporter/zipkin/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/exporter/opentelemetry-exporter-zipkin-json/src/opentelemetry/exporter/zipkin/py.typed -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-zipkin-json/test-requirements.txt: -------------------------------------------------------------------------------- 1 | asgiref==3.7.2 2 | certifi==2024.7.4 3 | charset-normalizer==3.3.2 4 | idna==3.7 5 | importlib-metadata==6.11.0 6 | iniconfig==2.0.0 7 | packaging==24.0 8 | pluggy==1.5.0 9 | py-cpuinfo==9.0.0 10 | pytest==7.4.4 11 | requests==2.32.3 12 | tomli==2.0.1 13 | typing_extensions==4.10.0 14 | urllib3==2.2.2 15 | wrapt==1.16.0 16 | zipp==3.19.2 17 | -e opentelemetry-api 18 | -e opentelemetry-sdk 19 | -e opentelemetry-semantic-conventions 20 | -e tests/opentelemetry-test-utils 21 | -e exporter/opentelemetry-exporter-zipkin-json 22 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-zipkin-json/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-zipkin-json/tests/encoder/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/exporter/opentelemetry-exporter-zipkin-json/tests/encoder/__init__.py -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-zipkin-proto-http/CHANGELOG.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/exporter/opentelemetry-exporter-zipkin-proto-http/CHANGELOG.md -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-zipkin-proto-http/README.rst: -------------------------------------------------------------------------------- 1 | OpenTelemetry Zipkin Protobuf Exporter 2 | ====================================== 3 | 4 | |pypi| 5 | 6 | .. |pypi| image:: https://badge.fury.io/py/opentelemetry-exporter-zipkin-proto-http.svg 7 | :target: https://pypi.org/project/opentelemetry-exporter-zipkin-proto-http/ 8 | 9 | This library allows export of tracing data to `Zipkin `_ using Protobuf 10 | for serialization. 11 | 12 | Installation 13 | ------------ 14 | 15 | :: 16 | 17 | pip install opentelemetry-exporter-zipkin-proto-http 18 | 19 | 20 | References 21 | ---------- 22 | 23 | * `OpenTelemetry Zipkin Exporter `_ 24 | * `Zipkin `_ 25 | * `OpenTelemetry Project `_ 26 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-zipkin-proto-http/src/opentelemetry/exporter/zipkin/proto/http/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/exporter/opentelemetry-exporter-zipkin-proto-http/src/opentelemetry/exporter/zipkin/proto/http/py.typed -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-zipkin-proto-http/src/opentelemetry/exporter/zipkin/proto/http/v2/gen/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/exporter/opentelemetry-exporter-zipkin-proto-http/src/opentelemetry/exporter/zipkin/proto/http/v2/gen/__init__.py -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-zipkin-proto-http/src/opentelemetry/exporter/zipkin/proto/http/version/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | __version__ = "1.35.0.dev" 16 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-zipkin-proto-http/test-requirements.txt: -------------------------------------------------------------------------------- 1 | asgiref==3.7.2 2 | certifi==2024.7.4 3 | charset-normalizer==3.3.2 4 | idna==3.7 5 | importlib-metadata==6.11.0 6 | iniconfig==2.0.0 7 | packaging==24.0 8 | pluggy==1.5.0 9 | protobuf==3.20.3 10 | py-cpuinfo==9.0.0 11 | pytest==7.4.4 12 | requests==2.32.3 13 | tomli==2.0.1 14 | typing_extensions==4.10.0 15 | urllib3==2.2.2 16 | wrapt==1.16.0 17 | zipp==3.19.2 18 | -e opentelemetry-api 19 | -e exporter/opentelemetry-exporter-zipkin-json 20 | -e opentelemetry-sdk 21 | -e tests/opentelemetry-test-utils 22 | -e opentelemetry-semantic-conventions 23 | -e exporter/opentelemetry-exporter-zipkin-proto-http 24 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-zipkin-proto-http/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-zipkin-proto-http/tests/encoder/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/exporter/opentelemetry-exporter-zipkin-proto-http/tests/encoder/__init__.py -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-zipkin/README.rst: -------------------------------------------------------------------------------- 1 | OpenTelemetry Zipkin Exporter 2 | ============================= 3 | 4 | |pypi| 5 | 6 | .. |pypi| image:: https://badge.fury.io/py/opentelemetry-exporter-zipkin.svg 7 | :target: https://pypi.org/project/opentelemetry-exporter-zipkin/ 8 | 9 | This library is provided as a convenience to install all supported OpenTelemetry Zipkin Exporters. Currently it installs: 10 | * opentelemetry-exporter-zipkin-json 11 | * opentelemetry-exporter-zipkin-proto-http 12 | 13 | In the future, additional packages may be available: 14 | * opentelemetry-exporter-zipkin-thrift 15 | 16 | To avoid unnecessary dependencies, users should install the specific package once they've determined their 17 | preferred serialization method. 18 | 19 | Installation 20 | ------------ 21 | 22 | :: 23 | 24 | pip install opentelemetry-exporter-zipkin 25 | 26 | 27 | References 28 | ---------- 29 | 30 | * `OpenTelemetry Zipkin Exporter `_ 31 | * `Zipkin `_ 32 | * `OpenTelemetry Project `_ 33 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-zipkin/src/opentelemetry/exporter/zipkin/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/exporter/opentelemetry-exporter-zipkin/src/opentelemetry/exporter/zipkin/py.typed -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-zipkin/src/opentelemetry/exporter/zipkin/version/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | __version__ = "1.35.0.dev" 16 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-zipkin/test-requirements.txt: -------------------------------------------------------------------------------- 1 | asgiref==3.7.2 2 | importlib-metadata==6.11.0 3 | iniconfig==2.0.0 4 | packaging==24.0 5 | pluggy==1.5.0 6 | py-cpuinfo==9.0.0 7 | pytest==7.4.4 8 | tomli==2.0.1 9 | typing_extensions==4.10.0 10 | wrapt==1.16.0 11 | zipp==3.19.2 12 | -e opentelemetry-api 13 | -e exporter/opentelemetry-exporter-zipkin-json 14 | -e exporter/opentelemetry-exporter-zipkin-proto-http 15 | -e opentelemetry-sdk 16 | -e opentelemetry-semantic-conventions 17 | -e exporter/opentelemetry-exporter-zipkin 18 | -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-zipkin/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/exporter/opentelemetry-exporter-zipkin/tests/__init__.py -------------------------------------------------------------------------------- /exporter/opentelemetry-exporter-zipkin/tests/test_zipkin.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import unittest 16 | 17 | from opentelemetry.exporter.zipkin import json 18 | from opentelemetry.exporter.zipkin.proto import http 19 | 20 | 21 | class TestZipkinExporter(unittest.TestCase): 22 | def test_constructors(self): 23 | try: 24 | json.ZipkinExporter() 25 | http.ZipkinExporter() 26 | except Exception as exc: # pylint: disable=broad-exception-caught 27 | self.assertIsNone(exc) 28 | -------------------------------------------------------------------------------- /gen-requirements.txt: -------------------------------------------------------------------------------- 1 | # Use caution when bumping this version to ensure compatibility with the currently supported protobuf version. 2 | # Pinning this to the oldest grpcio version that supports protobuf 5 helps avoid RuntimeWarning messages 3 | # from the generated protobuf code and ensures continued stability for newer grpcio versions. 4 | grpcio-tools==1.63.2 5 | mypy-protobuf~=3.5.0 6 | -------------------------------------------------------------------------------- /opentelemetry-api/README.rst: -------------------------------------------------------------------------------- 1 | OpenTelemetry Python API 2 | ============================================================================ 3 | 4 | |pypi| 5 | 6 | .. |pypi| image:: https://badge.fury.io/py/opentelemetry-api.svg 7 | :target: https://pypi.org/project/opentelemetry-api/ 8 | 9 | Installation 10 | ------------ 11 | 12 | :: 13 | 14 | pip install opentelemetry-api 15 | 16 | References 17 | ---------- 18 | 19 | * `OpenTelemetry Project `_ 20 | -------------------------------------------------------------------------------- /opentelemetry-api/src/opentelemetry/_events/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-api/src/opentelemetry/_events/py.typed -------------------------------------------------------------------------------- /opentelemetry-api/src/opentelemetry/_logs/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-api/src/opentelemetry/_logs/py.typed -------------------------------------------------------------------------------- /opentelemetry-api/src/opentelemetry/attributes/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-api/src/opentelemetry/attributes/py.typed -------------------------------------------------------------------------------- /opentelemetry-api/src/opentelemetry/baggage/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-api/src/opentelemetry/baggage/py.typed -------------------------------------------------------------------------------- /opentelemetry-api/src/opentelemetry/context/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-api/src/opentelemetry/context/py.typed -------------------------------------------------------------------------------- /opentelemetry-api/src/opentelemetry/environment_variables/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-api/src/opentelemetry/environment_variables/py.typed -------------------------------------------------------------------------------- /opentelemetry-api/src/opentelemetry/metrics/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-api/src/opentelemetry/metrics/py.typed -------------------------------------------------------------------------------- /opentelemetry-api/src/opentelemetry/propagate/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-api/src/opentelemetry/propagate/py.typed -------------------------------------------------------------------------------- /opentelemetry-api/src/opentelemetry/propagators/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-api/src/opentelemetry/propagators/py.typed -------------------------------------------------------------------------------- /opentelemetry-api/src/opentelemetry/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-api/src/opentelemetry/py.typed -------------------------------------------------------------------------------- /opentelemetry-api/src/opentelemetry/trace/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-api/src/opentelemetry/trace/py.typed -------------------------------------------------------------------------------- /opentelemetry-api/src/opentelemetry/util/_importlib_metadata.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # FIXME: Use importlib.metadata when support for 3.11 is dropped if the rest of 16 | # the supported versions at that time have the same API. 17 | from importlib_metadata import ( # type: ignore 18 | Distribution, 19 | EntryPoint, 20 | EntryPoints, 21 | PackageNotFoundError, 22 | distributions, 23 | entry_points, 24 | requires, 25 | version, 26 | ) 27 | 28 | __all__ = [ 29 | "entry_points", 30 | "version", 31 | "EntryPoint", 32 | "EntryPoints", 33 | "requires", 34 | "Distribution", 35 | "distributions", 36 | "PackageNotFoundError", 37 | ] 38 | -------------------------------------------------------------------------------- /opentelemetry-api/src/opentelemetry/util/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-api/src/opentelemetry/util/py.typed -------------------------------------------------------------------------------- /opentelemetry-api/src/opentelemetry/version/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | __version__ = "1.35.0.dev" 16 | -------------------------------------------------------------------------------- /opentelemetry-api/src/opentelemetry/version/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-api/src/opentelemetry/version/py.typed -------------------------------------------------------------------------------- /opentelemetry-api/test-requirements.txt: -------------------------------------------------------------------------------- 1 | asgiref==3.7.2 2 | importlib-metadata==8.5.0 ; python_version < "3.9" 3 | importlib-metadata==8.7.0 ; python_version >= "3.9" 4 | iniconfig==2.0.0 5 | packaging==24.0 6 | pluggy==1.5.0 7 | py-cpuinfo==9.0.0 8 | pytest==7.4.4 9 | tomli==2.0.1 10 | typing_extensions==4.10.0 11 | wrapt==1.16.0 12 | zipp==3.20.2 13 | -e opentelemetry-sdk 14 | -e opentelemetry-semantic-conventions 15 | -e tests/opentelemetry-test-utils 16 | -e opentelemetry-api 17 | -------------------------------------------------------------------------------- /opentelemetry-api/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /opentelemetry-api/tests/context/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-api/tests/context/__init__.py -------------------------------------------------------------------------------- /opentelemetry-api/tests/context/propagation/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-api/tests/context/propagation/__init__.py -------------------------------------------------------------------------------- /opentelemetry-api/tests/distributedcontext/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /opentelemetry-api/tests/events/test_event.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | from opentelemetry._events import Event 4 | 5 | 6 | class TestEvent(unittest.TestCase): 7 | def test_event(self): 8 | event = Event("example", 123, attributes={"key": "value"}) 9 | self.assertEqual(event.name, "example") 10 | self.assertEqual(event.timestamp, 123) 11 | self.assertEqual( 12 | event.attributes, {"key": "value", "event.name": "example"} 13 | ) 14 | 15 | def test_event_name_copied_in_attributes(self): 16 | event = Event("name", 123) 17 | self.assertEqual(event.attributes, {"event.name": "name"}) 18 | 19 | def test_event_name_has_precedence_over_attributes(self): 20 | event = Event("name", 123, attributes={"event.name": "attr value"}) 21 | self.assertEqual(event.attributes, {"event.name": "name"}) 22 | -------------------------------------------------------------------------------- /opentelemetry-api/tests/logs/test_log_record.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import unittest 16 | from unittest.mock import patch 17 | 18 | from opentelemetry._logs import LogRecord 19 | 20 | OBSERVED_TIMESTAMP = "OBSERVED_TIMESTAMP" 21 | 22 | 23 | class TestLogRecord(unittest.TestCase): 24 | @patch("opentelemetry._logs._internal.time_ns") 25 | def test_log_record_observed_timestamp_default(self, time_ns_mock): # type: ignore 26 | time_ns_mock.return_value = OBSERVED_TIMESTAMP 27 | self.assertEqual(LogRecord().observed_timestamp, OBSERVED_TIMESTAMP) 28 | -------------------------------------------------------------------------------- /opentelemetry-api/tests/mypysmoke.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import opentelemetry.trace 16 | 17 | 18 | def dummy_check_mypy_returntype() -> opentelemetry.trace.TracerProvider: 19 | return opentelemetry.trace.get_tracer_provider() 20 | -------------------------------------------------------------------------------- /opentelemetry-api/tests/trace/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /opentelemetry-proto/src/opentelemetry/proto/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-proto/src/opentelemetry/proto/__init__.py -------------------------------------------------------------------------------- /opentelemetry-proto/src/opentelemetry/proto/collector/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-proto/src/opentelemetry/proto/collector/__init__.py -------------------------------------------------------------------------------- /opentelemetry-proto/src/opentelemetry/proto/collector/metrics/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-proto/src/opentelemetry/proto/collector/metrics/__init__.py -------------------------------------------------------------------------------- /opentelemetry-proto/src/opentelemetry/proto/collector/metrics/v1/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-proto/src/opentelemetry/proto/collector/metrics/v1/__init__.py -------------------------------------------------------------------------------- /opentelemetry-proto/src/opentelemetry/proto/collector/trace/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-proto/src/opentelemetry/proto/collector/trace/__init__.py -------------------------------------------------------------------------------- /opentelemetry-proto/src/opentelemetry/proto/collector/trace/v1/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-proto/src/opentelemetry/proto/collector/trace/v1/__init__.py -------------------------------------------------------------------------------- /opentelemetry-proto/src/opentelemetry/proto/common/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-proto/src/opentelemetry/proto/common/__init__.py -------------------------------------------------------------------------------- /opentelemetry-proto/src/opentelemetry/proto/common/v1/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-proto/src/opentelemetry/proto/common/v1/__init__.py -------------------------------------------------------------------------------- /opentelemetry-proto/src/opentelemetry/proto/metrics/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-proto/src/opentelemetry/proto/metrics/__init__.py -------------------------------------------------------------------------------- /opentelemetry-proto/src/opentelemetry/proto/metrics/v1/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-proto/src/opentelemetry/proto/metrics/v1/__init__.py -------------------------------------------------------------------------------- /opentelemetry-proto/src/opentelemetry/proto/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-proto/src/opentelemetry/proto/py.typed -------------------------------------------------------------------------------- /opentelemetry-proto/src/opentelemetry/proto/resource/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-proto/src/opentelemetry/proto/resource/__init__.py -------------------------------------------------------------------------------- /opentelemetry-proto/src/opentelemetry/proto/resource/v1/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-proto/src/opentelemetry/proto/resource/v1/__init__.py -------------------------------------------------------------------------------- /opentelemetry-proto/src/opentelemetry/proto/trace/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-proto/src/opentelemetry/proto/trace/__init__.py -------------------------------------------------------------------------------- /opentelemetry-proto/src/opentelemetry/proto/trace/v1/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-proto/src/opentelemetry/proto/trace/v1/__init__.py -------------------------------------------------------------------------------- /opentelemetry-proto/src/opentelemetry/proto/version/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | __version__ = "1.35.0.dev" 16 | -------------------------------------------------------------------------------- /opentelemetry-proto/test-requirements.txt: -------------------------------------------------------------------------------- 1 | asgiref==3.7.2 2 | importlib-metadata==6.11.0 3 | iniconfig==2.0.0 4 | packaging==24.0 5 | pluggy==1.5.0 6 | protobuf==5.26.1 7 | py-cpuinfo==9.0.0 8 | pytest==7.4.4 9 | tomli==2.0.1 10 | typing_extensions==4.10.0 11 | wrapt==1.16.0 12 | zipp==3.19.2 13 | -e opentelemetry-proto 14 | -------------------------------------------------------------------------------- /opentelemetry-proto/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-proto/tests/__init__.py -------------------------------------------------------------------------------- /opentelemetry-proto/tests/test_proto.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # type: ignore 15 | 16 | from importlib.util import find_spec 17 | from unittest import TestCase 18 | 19 | 20 | class TestInstrumentor(TestCase): 21 | def test_proto(self): 22 | if find_spec("opentelemetry.proto") is None: 23 | self.fail("opentelemetry-proto not installed") 24 | -------------------------------------------------------------------------------- /opentelemetry-sdk/README.rst: -------------------------------------------------------------------------------- 1 | OpenTelemetry Python SDK 2 | ============================================================================ 3 | 4 | |pypi| 5 | 6 | .. |pypi| image:: https://badge.fury.io/py/opentelemetry-sdk.svg 7 | :target: https://pypi.org/project/opentelemetry-sdk/ 8 | 9 | Installation 10 | ------------ 11 | 12 | :: 13 | 14 | pip install opentelemetry-sdk 15 | 16 | References 17 | ---------- 18 | 19 | * `OpenTelemetry Project `_ 20 | -------------------------------------------------------------------------------- /opentelemetry-sdk/benchmark-requirements.txt: -------------------------------------------------------------------------------- 1 | pytest-benchmark==4.0.0 2 | -------------------------------------------------------------------------------- /opentelemetry-sdk/benchmarks/logs/test_benchmark_logging_handler.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | import pytest 4 | 5 | from opentelemetry.sdk._logs import LoggerProvider, LoggingHandler 6 | from opentelemetry.sdk._logs.export import ( 7 | InMemoryLogExporter, 8 | SimpleLogRecordProcessor, 9 | ) 10 | 11 | 12 | def _set_up_logging_handler(level): 13 | logger_provider = LoggerProvider() 14 | exporter = InMemoryLogExporter() 15 | processor = SimpleLogRecordProcessor(exporter=exporter) 16 | logger_provider.add_log_record_processor(processor) 17 | handler = LoggingHandler(level=level, logger_provider=logger_provider) 18 | return handler 19 | 20 | 21 | def _create_logger(handler, name): 22 | logger = logging.getLogger(name) 23 | logger.addHandler(handler) 24 | return logger 25 | 26 | 27 | @pytest.mark.parametrize("num_loggers", [1, 10, 100, 1000]) 28 | def test_simple_get_logger_different_names(benchmark, num_loggers): 29 | handler = _set_up_logging_handler(level=logging.DEBUG) 30 | loggers = [ 31 | _create_logger(handler, str(f"logger_{i}")) for i in range(num_loggers) 32 | ] 33 | 34 | def benchmark_get_logger(): 35 | for index in range(1000): 36 | loggers[index % num_loggers].warning("test message") 37 | 38 | benchmark(benchmark_get_logger) 39 | -------------------------------------------------------------------------------- /opentelemetry-sdk/src/opentelemetry/sdk/__init__.pyi: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | """ 16 | The OpenTelemetry SDK package is an implementation of the OpenTelemetry 17 | API 18 | """ 19 | -------------------------------------------------------------------------------- /opentelemetry-sdk/src/opentelemetry/sdk/_logs/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | 16 | from opentelemetry.sdk._logs._internal import ( 17 | LogData, 18 | LogDroppedAttributesWarning, 19 | Logger, 20 | LoggerProvider, 21 | LoggingHandler, 22 | LogLimits, 23 | LogRecord, 24 | LogRecordProcessor, 25 | ) 26 | 27 | __all__ = [ 28 | "LogData", 29 | "Logger", 30 | "LoggerProvider", 31 | "LoggingHandler", 32 | "LogLimits", 33 | "LogRecord", 34 | "LogRecordProcessor", 35 | "LogDroppedAttributesWarning", 36 | ] 37 | -------------------------------------------------------------------------------- /opentelemetry-sdk/src/opentelemetry/sdk/_logs/export/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from opentelemetry.sdk._logs._internal.export import ( 16 | BatchLogRecordProcessor, 17 | ConsoleLogExporter, 18 | LogExporter, 19 | LogExportResult, 20 | SimpleLogRecordProcessor, 21 | ) 22 | 23 | # The point module is not in the export directory to avoid a circular import. 24 | from opentelemetry.sdk._logs._internal.export.in_memory_log_exporter import ( 25 | InMemoryLogExporter, 26 | ) 27 | 28 | __all__ = [ 29 | "BatchLogRecordProcessor", 30 | "ConsoleLogExporter", 31 | "LogExporter", 32 | "LogExportResult", 33 | "SimpleLogRecordProcessor", 34 | "InMemoryLogExporter", 35 | ] 36 | -------------------------------------------------------------------------------- /opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/exceptions.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | 16 | class MetricsTimeoutError(Exception): 17 | """Raised when a metrics function times out""" 18 | -------------------------------------------------------------------------------- /opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/exponential_histogram/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/exponential_histogram/__init__.py -------------------------------------------------------------------------------- /opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/exponential_histogram/mapping/errors.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | 16 | class MappingUnderflowError(Exception): 17 | """ 18 | Raised when computing the lower boundary of an index that maps into a 19 | denormal floating point value. 20 | """ 21 | 22 | 23 | class MappingOverflowError(Exception): 24 | """ 25 | Raised when computing the lower boundary of an index that maps into +inf. 26 | """ 27 | -------------------------------------------------------------------------------- /opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/sdk_configuration.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # pylint: disable=unused-import 16 | 17 | from dataclasses import dataclass 18 | from typing import Sequence 19 | 20 | # This kind of import is needed to avoid Sphinx errors. 21 | import opentelemetry.sdk.metrics 22 | import opentelemetry.sdk.resources 23 | 24 | 25 | @dataclass 26 | class SdkConfiguration: 27 | exemplar_filter: "opentelemetry.sdk.metrics.ExemplarFilter" 28 | resource: "opentelemetry.sdk.resources.Resource" 29 | metric_readers: Sequence["opentelemetry.sdk.metrics.MetricReader"] 30 | views: Sequence["opentelemetry.sdk.metrics.View"] 31 | -------------------------------------------------------------------------------- /opentelemetry-sdk/src/opentelemetry/sdk/metrics/view/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from opentelemetry.sdk.metrics._internal.aggregation import ( 16 | Aggregation, 17 | DefaultAggregation, 18 | DropAggregation, 19 | ExplicitBucketHistogramAggregation, 20 | ExponentialBucketHistogramAggregation, 21 | LastValueAggregation, 22 | SumAggregation, 23 | ) 24 | from opentelemetry.sdk.metrics._internal.view import View 25 | 26 | __all__ = [ 27 | "Aggregation", 28 | "DefaultAggregation", 29 | "DropAggregation", 30 | "ExplicitBucketHistogramAggregation", 31 | "ExponentialBucketHistogramAggregation", 32 | "LastValueAggregation", 33 | "SumAggregation", 34 | "View", 35 | ] 36 | -------------------------------------------------------------------------------- /opentelemetry-sdk/src/opentelemetry/sdk/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-sdk/src/opentelemetry/sdk/py.typed -------------------------------------------------------------------------------- /opentelemetry-sdk/src/opentelemetry/sdk/version/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | __version__ = "1.35.0.dev" 16 | -------------------------------------------------------------------------------- /opentelemetry-sdk/test-requirements.txt: -------------------------------------------------------------------------------- 1 | asgiref==3.7.2 2 | flaky==3.7.0 3 | importlib-metadata==6.11.0 4 | iniconfig==2.0.0 5 | packaging==24.0 6 | pluggy==1.5.0 7 | psutil==5.9.6; sys_platform != 'win32' 8 | py-cpuinfo==9.0.0 9 | pytest==7.4.4 10 | tomli==2.0.1 11 | typing_extensions==4.10.0 12 | wrapt==1.16.0 13 | zipp==3.19.2 14 | -e tests/opentelemetry-test-utils 15 | -e opentelemetry-api 16 | -e opentelemetry-semantic-conventions 17 | -e opentelemetry-sdk -------------------------------------------------------------------------------- /opentelemetry-sdk/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /opentelemetry-sdk/tests/conftest.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from os import environ 16 | 17 | from opentelemetry.environment_variables import OTEL_PYTHON_CONTEXT 18 | 19 | 20 | def pytest_sessionstart(session): 21 | # pylint: disable=unused-argument 22 | environ[OTEL_PYTHON_CONTEXT] = "contextvars_context" 23 | 24 | 25 | def pytest_sessionfinish(session): 26 | # pylint: disable=unused-argument 27 | environ.pop(OTEL_PYTHON_CONTEXT) 28 | -------------------------------------------------------------------------------- /opentelemetry-sdk/tests/context/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-sdk/tests/context/__init__.py -------------------------------------------------------------------------------- /opentelemetry-sdk/tests/error_handler/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-sdk/tests/error_handler/__init__.py -------------------------------------------------------------------------------- /opentelemetry-sdk/tests/events/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /opentelemetry-sdk/tests/logs/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /opentelemetry-sdk/tests/resources/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-sdk/tests/resources/__init__.py -------------------------------------------------------------------------------- /opentelemetry-sdk/tests/shared_internal/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /opentelemetry-sdk/tests/trace/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /opentelemetry-sdk/tests/trace/export/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /opentelemetry-sdk/tests/trace/propagation/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-sdk/tests/trace/propagation/__init__.py -------------------------------------------------------------------------------- /opentelemetry-sdk/tests/trace/test_globals.py: -------------------------------------------------------------------------------- 1 | # type:ignore 2 | import unittest 3 | from logging import WARNING 4 | 5 | from opentelemetry import trace 6 | from opentelemetry.sdk.trace import TracerProvider # type:ignore 7 | 8 | 9 | class TestGlobals(unittest.TestCase): 10 | def test_tracer_provider_override_warning(self): 11 | """trace.set_tracer_provider should throw a warning when overridden""" 12 | trace.set_tracer_provider(TracerProvider()) 13 | tracer_provider = trace.get_tracer_provider() 14 | with self.assertLogs(level=WARNING) as test: 15 | trace.set_tracer_provider(TracerProvider()) 16 | self.assertEqual( 17 | test.output, 18 | [ 19 | ( 20 | "WARNING:opentelemetry.trace:Overriding of current " 21 | "TracerProvider is not allowed" 22 | ) 23 | ], 24 | ) 25 | self.assertIs(tracer_provider, trace.get_tracer_provider()) 26 | -------------------------------------------------------------------------------- /opentelemetry-semantic-conventions/src/opentelemetry/semconv/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-semantic-conventions/src/opentelemetry/semconv/__init__.py -------------------------------------------------------------------------------- /opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/az_attributes.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from typing import Final 16 | 17 | AZ_NAMESPACE: Final = "az.namespace" 18 | """ 19 | [Azure Resource Provider Namespace](https://learn.microsoft.com/azure/azure-resource-manager/management/azure-services-resource-providers) as recognized by the client. 20 | """ 21 | 22 | AZ_SERVICE_REQUEST_ID: Final = "az.service_request_id" 23 | """ 24 | The unique identifier of the service request. It's generated by the Azure service and returned with the response. 25 | """ 26 | -------------------------------------------------------------------------------- /opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/client_attributes.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from typing import Final 16 | 17 | CLIENT_ADDRESS: Final = "client.address" 18 | """ 19 | Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.client_attributes.CLIENT_ADDRESS`. 20 | """ 21 | 22 | CLIENT_PORT: Final = "client.port" 23 | """ 24 | Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.client_attributes.CLIENT_PORT`. 25 | """ 26 | -------------------------------------------------------------------------------- /opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/cpython_attributes.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from enum import Enum 16 | from typing import Final 17 | 18 | CPYTHON_GC_GENERATION: Final = "cpython.gc.generation" 19 | """ 20 | Value of the garbage collector collection generation. 21 | """ 22 | 23 | 24 | class CPythonGCGenerationValues(Enum): 25 | GENERATION_0 = 0 26 | """Generation 0.""" 27 | GENERATION_1 = 1 28 | """Generation 1.""" 29 | GENERATION_2 = 2 30 | """Generation 2.""" 31 | -------------------------------------------------------------------------------- /opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/destination_attributes.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from typing import Final 16 | 17 | DESTINATION_ADDRESS: Final = "destination.address" 18 | """ 19 | Destination address - domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. 20 | Note: When observed from the source side, and when communicating through an intermediary, `destination.address` SHOULD represent the destination address behind any intermediaries, for example proxies, if it's available. 21 | """ 22 | 23 | DESTINATION_PORT: Final = "destination.port" 24 | """ 25 | Destination port number. 26 | """ 27 | -------------------------------------------------------------------------------- /opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/disk_attributes.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from enum import Enum 16 | from typing import Final 17 | 18 | DISK_IO_DIRECTION: Final = "disk.io.direction" 19 | """ 20 | The disk IO operation direction. 21 | """ 22 | 23 | 24 | class DiskIoDirectionValues(Enum): 25 | READ = "read" 26 | """read.""" 27 | WRITE = "write" 28 | """write.""" 29 | -------------------------------------------------------------------------------- /opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/dns_attributes.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from typing import Final 16 | 17 | DNS_QUESTION_NAME: Final = "dns.question.name" 18 | """ 19 | The name being queried. 20 | Note: If the name field contains non-printable characters (below 32 or above 126), those characters should be represented as escaped base 10 integers (\\DDD). Back slashes and quotes should be escaped. Tabs, carriage returns, and line feeds should be converted to \\t, \\r, and \\n respectively. 21 | """ 22 | -------------------------------------------------------------------------------- /opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/elasticsearch_attributes.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from typing import Final 16 | 17 | ELASTICSEARCH_NODE_NAME: Final = "elasticsearch.node.name" 18 | """ 19 | Represents the human-readable identifier of the node/instance to which a request was routed. 20 | """ 21 | -------------------------------------------------------------------------------- /opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/event_attributes.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from typing import Final 16 | 17 | EVENT_NAME: Final = "event.name" 18 | """ 19 | Deprecated: Replaced by EventName top-level field on the LogRecord. 20 | """ 21 | -------------------------------------------------------------------------------- /opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/heroku_attributes.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from typing import Final 16 | 17 | HEROKU_APP_ID: Final = "heroku.app.id" 18 | """ 19 | Unique identifier for the application. 20 | """ 21 | 22 | HEROKU_RELEASE_COMMIT: Final = "heroku.release.commit" 23 | """ 24 | Commit hash for the current release. 25 | """ 26 | 27 | HEROKU_RELEASE_CREATION_TIMESTAMP: Final = "heroku.release.creation_timestamp" 28 | """ 29 | Time and date the release was created. 30 | """ 31 | -------------------------------------------------------------------------------- /opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/linux_attributes.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from enum import Enum 16 | from typing import Final 17 | 18 | LINUX_MEMORY_SLAB_STATE: Final = "linux.memory.slab.state" 19 | """ 20 | The Linux Slab memory state. 21 | """ 22 | 23 | 24 | class LinuxMemorySlabStateValues(Enum): 25 | RECLAIMABLE = "reclaimable" 26 | """reclaimable.""" 27 | UNRECLAIMABLE = "unreclaimable" 28 | """unreclaimable.""" 29 | -------------------------------------------------------------------------------- /opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/oci_attributes.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from typing import Final 16 | 17 | OCI_MANIFEST_DIGEST: Final = "oci.manifest.digest" 18 | """ 19 | The digest of the OCI image manifest. For container images specifically is the digest by which the container image is known. 20 | Note: Follows [OCI Image Manifest Specification](https://github.com/opencontainers/image-spec/blob/main/manifest.md), and specifically the [Digest property](https://github.com/opencontainers/image-spec/blob/main/descriptor.md#digests). 21 | An example can be found in [Example Image Manifest](https://github.com/opencontainers/image-spec/blob/main/manifest.md#example-image-manifest). 22 | """ 23 | -------------------------------------------------------------------------------- /opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/opentracing_attributes.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from enum import Enum 16 | from typing import Final 17 | 18 | OPENTRACING_REF_TYPE: Final = "opentracing.ref_type" 19 | """ 20 | Parent-child Reference type. 21 | Note: The causal relationship between a child Span and a parent Span. 22 | """ 23 | 24 | 25 | class OpentracingRefTypeValues(Enum): 26 | CHILD_OF = "child_of" 27 | """The parent Span depends on the child Span in some capacity.""" 28 | FOLLOWS_FROM = "follows_from" 29 | """The parent Span doesn't depend in any way on the result of the child Span.""" 30 | -------------------------------------------------------------------------------- /opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/other_attributes.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from enum import Enum 16 | from typing import Final 17 | 18 | from typing_extensions import deprecated 19 | 20 | STATE: Final = "state" 21 | """ 22 | Deprecated: Replaced by `db.client.connection.state`. 23 | """ 24 | 25 | 26 | @deprecated( 27 | "The attribute state is deprecated - Replaced by `db.client.connection.state`" 28 | ) 29 | class StateValues(Enum): 30 | IDLE = "idle" 31 | """idle.""" 32 | USED = "used" 33 | """used.""" 34 | -------------------------------------------------------------------------------- /opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/peer_attributes.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from typing import Final 16 | 17 | PEER_SERVICE: Final = "peer.service" 18 | """ 19 | The [`service.name`](/docs/resource/README.md#service) of the remote service. SHOULD be equal to the actual `service.name` resource attribute of the remote service if any. 20 | """ 21 | -------------------------------------------------------------------------------- /opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/pool_attributes.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from typing import Final 16 | 17 | POOL_NAME: Final = "pool.name" 18 | """ 19 | Deprecated: Replaced by `db.client.connection.pool.name`. 20 | """ 21 | -------------------------------------------------------------------------------- /opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/server_attributes.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from typing import Final 16 | 17 | SERVER_ADDRESS: Final = "server.address" 18 | """ 19 | Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.server_attributes.SERVER_ADDRESS`. 20 | """ 21 | 22 | SERVER_PORT: Final = "server.port" 23 | """ 24 | Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.server_attributes.SERVER_PORT`. 25 | """ 26 | -------------------------------------------------------------------------------- /opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/session_attributes.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from typing import Final 16 | 17 | SESSION_ID: Final = "session.id" 18 | """ 19 | A unique id to identify a session. 20 | """ 21 | 22 | SESSION_PREVIOUS_ID: Final = "session.previous_id" 23 | """ 24 | The previous `session.id` for this user, when known. 25 | """ 26 | -------------------------------------------------------------------------------- /opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/source_attributes.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from typing import Final 16 | 17 | SOURCE_ADDRESS: Final = "source.address" 18 | """ 19 | Source address - domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. 20 | Note: When observed from the destination side, and when communicating through an intermediary, `source.address` SHOULD represent the source address behind any intermediaries, for example proxies, if it's available. 21 | """ 22 | 23 | SOURCE_PORT: Final = "source.port" 24 | """ 25 | Source port number. 26 | """ 27 | -------------------------------------------------------------------------------- /opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/thread_attributes.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from typing import Final 16 | 17 | THREAD_ID: Final = "thread.id" 18 | """ 19 | Current "managed" thread ID (as opposed to OS thread ID). 20 | """ 21 | 22 | THREAD_NAME: Final = "thread.name" 23 | """ 24 | Current thread name. 25 | """ 26 | -------------------------------------------------------------------------------- /opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/webengine_attributes.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from typing import Final 16 | 17 | WEBENGINE_DESCRIPTION: Final = "webengine.description" 18 | """ 19 | Additional description of the web engine (e.g. detailed version and edition information). 20 | """ 21 | 22 | WEBENGINE_NAME: Final = "webengine.name" 23 | """ 24 | The name of the web engine. 25 | """ 26 | 27 | WEBENGINE_VERSION: Final = "webengine.version" 28 | """ 29 | The version of the web engine. 30 | """ 31 | -------------------------------------------------------------------------------- /opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/dns_metrics.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | 16 | from typing import Final 17 | 18 | from opentelemetry.metrics import Histogram, Meter 19 | 20 | DNS_LOOKUP_DURATION: Final = "dns.lookup.duration" 21 | """ 22 | Measures the time taken to perform a DNS lookup 23 | Instrument: histogram 24 | Unit: s 25 | """ 26 | 27 | 28 | def create_dns_lookup_duration(meter: Meter) -> Histogram: 29 | """Measures the time taken to perform a DNS lookup""" 30 | return meter.create_histogram( 31 | name=DNS_LOOKUP_DURATION, 32 | description="Measures the time taken to perform a DNS lookup.", 33 | unit="s", 34 | ) 35 | -------------------------------------------------------------------------------- /opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/__init__.py -------------------------------------------------------------------------------- /opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/service_attributes.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from typing import Final 16 | 17 | SERVICE_NAME: Final = "service.name" 18 | """ 19 | Logical name of the service. 20 | Note: MUST be the same for all instances of horizontally scaled services. If the value was not specified, SDKs MUST fallback to `unknown_service:` concatenated with [`process.executable.name`](process.md), e.g. `unknown_service:bash`. If `process.executable.name` is not available, the value MUST be set to `unknown_service`. 21 | """ 22 | 23 | SERVICE_VERSION: Final = "service.version" 24 | """ 25 | The version string of the service API or implementation. The format is not defined by these conventions. 26 | """ 27 | -------------------------------------------------------------------------------- /opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/user_agent_attributes.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from typing import Final 16 | 17 | USER_AGENT_ORIGINAL: Final = "user_agent.original" 18 | """ 19 | Value of the [HTTP User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) header sent by the client. 20 | """ 21 | -------------------------------------------------------------------------------- /opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/db_metrics.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | 16 | from typing import Final 17 | 18 | DB_CLIENT_OPERATION_DURATION: Final = "db.client.operation.duration" 19 | """ 20 | Duration of database client operations 21 | Instrument: histogram 22 | Unit: s 23 | Note: Batch operations SHOULD be recorded as a single operation. 24 | """ 25 | -------------------------------------------------------------------------------- /opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/http_metrics.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | 16 | from typing import Final 17 | 18 | HTTP_CLIENT_REQUEST_DURATION: Final = "http.client.request.duration" 19 | """ 20 | Duration of HTTP client requests 21 | Instrument: histogram 22 | Unit: s 23 | """ 24 | 25 | 26 | HTTP_SERVER_REQUEST_DURATION: Final = "http.server.request.duration" 27 | """ 28 | Duration of HTTP server requests 29 | Instrument: histogram 30 | Unit: s 31 | """ 32 | -------------------------------------------------------------------------------- /opentelemetry-semantic-conventions/src/opentelemetry/semconv/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-semantic-conventions/src/opentelemetry/semconv/py.typed -------------------------------------------------------------------------------- /opentelemetry-semantic-conventions/src/opentelemetry/semconv/version/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | __version__ = "0.56b0.dev" 16 | -------------------------------------------------------------------------------- /opentelemetry-semantic-conventions/test-requirements.txt: -------------------------------------------------------------------------------- 1 | asgiref==3.7.2 2 | importlib-metadata==6.11.0 3 | iniconfig==2.0.0 4 | packaging==24.0 5 | pluggy==1.5.0 6 | py-cpuinfo==9.0.0 7 | pytest==7.4.4 8 | tomli==2.0.1 9 | typing_extensions==4.10.0 10 | wrapt==1.16.0 11 | zipp==3.19.2 12 | -e opentelemetry-api 13 | -e opentelemetry-semantic-conventions 14 | -------------------------------------------------------------------------------- /opentelemetry-semantic-conventions/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/opentelemetry-semantic-conventions/tests/__init__.py -------------------------------------------------------------------------------- /opentelemetry-semantic-conventions/tests/test_semconv.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # type: ignore 15 | 16 | from importlib.util import find_spec 17 | from unittest import TestCase 18 | 19 | 20 | class TestSemanticConventions(TestCase): 21 | def test_semantic_conventions(self): 22 | if find_spec("opentelemetry.semconv") is None: 23 | self.fail("opentelemetry-semantic-conventions not installed") 24 | -------------------------------------------------------------------------------- /propagator/opentelemetry-propagator-b3/README.rst: -------------------------------------------------------------------------------- 1 | OpenTelemetry B3 Propagator 2 | =========================== 3 | 4 | |pypi| 5 | 6 | .. |pypi| image:: https://badge.fury.io/py/opentelemetry-propagator-b3.svg 7 | :target: https://pypi.org/project/opentelemetry-propagator-b3/ 8 | 9 | This library provides a propagator for the B3 format 10 | 11 | Installation 12 | ------------ 13 | 14 | :: 15 | 16 | pip install opentelemetry-propagator-b3 17 | 18 | 19 | References 20 | ---------- 21 | 22 | * `OpenTelemetry `_ 23 | * `B3 format `_ 24 | -------------------------------------------------------------------------------- /propagator/opentelemetry-propagator-b3/benchmark-requirements.txt: -------------------------------------------------------------------------------- 1 | pytest-benchmark==4.0.0 2 | -------------------------------------------------------------------------------- /propagator/opentelemetry-propagator-b3/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/propagator/opentelemetry-propagator-b3/py.typed -------------------------------------------------------------------------------- /propagator/opentelemetry-propagator-b3/src/opentelemetry/propagators/b3/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/propagator/opentelemetry-propagator-b3/src/opentelemetry/propagators/b3/py.typed -------------------------------------------------------------------------------- /propagator/opentelemetry-propagator-b3/src/opentelemetry/propagators/b3/version/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | __version__ = "1.35.0.dev" 16 | -------------------------------------------------------------------------------- /propagator/opentelemetry-propagator-b3/test-requirements.txt: -------------------------------------------------------------------------------- 1 | asgiref==3.7.2 2 | importlib-metadata==6.11.0 3 | iniconfig==2.0.0 4 | packaging==24.0 5 | pluggy==1.5.0 6 | py-cpuinfo==9.0.0 7 | pytest==7.4.4 8 | tomli==2.0.1 9 | typing_extensions==4.10.0 10 | wrapt==1.16.0 11 | zipp==3.19.2 12 | -e opentelemetry-api 13 | -e opentelemetry-sdk 14 | -e opentelemetry-semantic-conventions 15 | -e propagator/opentelemetry-propagator-b3 16 | -------------------------------------------------------------------------------- /propagator/opentelemetry-propagator-b3/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /propagator/opentelemetry-propagator-jaeger/README.rst: -------------------------------------------------------------------------------- 1 | OpenTelemetry Jaeger Propagator 2 | =============================== 3 | 4 | |pypi| 5 | 6 | .. |pypi| image:: https://badge.fury.io/py/opentelemetry-propagator-jaeger.svg 7 | :target: https://pypi.org/project/opentelemetry-propagator-jaeger/ 8 | 9 | This library provides a propagator for the Jaeger format 10 | 11 | Installation 12 | ------------ 13 | 14 | :: 15 | 16 | pip install opentelemetry-propagator-jaeger 17 | 18 | 19 | References 20 | ---------- 21 | 22 | * `OpenTelemetry `_ 23 | * `Jaeger format `_ 24 | -------------------------------------------------------------------------------- /propagator/opentelemetry-propagator-jaeger/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/propagator/opentelemetry-propagator-jaeger/py.typed -------------------------------------------------------------------------------- /propagator/opentelemetry-propagator-jaeger/src/opentelemetry/propagators/jaeger/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/propagator/opentelemetry-propagator-jaeger/src/opentelemetry/propagators/jaeger/py.typed -------------------------------------------------------------------------------- /propagator/opentelemetry-propagator-jaeger/src/opentelemetry/propagators/jaeger/version/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | __version__ = "1.35.0.dev" 16 | -------------------------------------------------------------------------------- /propagator/opentelemetry-propagator-jaeger/test-requirements.txt: -------------------------------------------------------------------------------- 1 | asgiref==3.7.2 2 | importlib-metadata==6.11.0 3 | iniconfig==2.0.0 4 | packaging==24.0 5 | pluggy==1.5.0 6 | py-cpuinfo==9.0.0 7 | pytest==7.4.4 8 | tomli==2.0.1 9 | typing_extensions==4.10.0 10 | wrapt==1.16.0 11 | zipp==3.19.2 12 | -e opentelemetry-api 13 | -e opentelemetry-sdk 14 | -e opentelemetry-semantic-conventions 15 | -e tests/opentelemetry-test-utils 16 | -e propagator/opentelemetry-propagator-jaeger 17 | -------------------------------------------------------------------------------- /propagator/opentelemetry-propagator-jaeger/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /scripts/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # This script builds wheels for the API, SDK, and extension packages in the 4 | # dist/ dir, to be uploaded to PyPI. 5 | 6 | set -ev 7 | 8 | # Get the latest versions of packaging tools 9 | python3 -m pip install --upgrade pip build setuptools wheel 10 | 11 | BASEDIR=$(dirname "$(readlink -f "$(dirname $0)")") 12 | DISTDIR=dist 13 | 14 | ( 15 | cd $BASEDIR 16 | mkdir -p $DISTDIR 17 | rm -rf ${DISTDIR:?}/* 18 | 19 | for d in opentelemetry-api/ opentelemetry-sdk/ opentelemetry-proto/ opentelemetry-semantic-conventions/ exporter/*/ shim/*/ propagator/*/ tests/opentelemetry-test-utils/; do 20 | ( 21 | echo "building $d" 22 | cd "$d" 23 | # Some ext directories (such as docker tests) are not intended to be 24 | # packaged. Verify the intent by looking for a pyproject.toml. 25 | if [ -f pyproject.toml ]; then 26 | python3 -m build --outdir "$BASEDIR/dist/" 27 | fi 28 | ) 29 | done 30 | ) 31 | -------------------------------------------------------------------------------- /scripts/coverage.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | function cov { 6 | if [ ${TOX_ENV_NAME:0:4} == "py34" ] 7 | then 8 | pytest \ 9 | --ignore-glob=instrumentation/opentelemetry-instrumentation-opentracing-shim/tests/testbed/* \ 10 | --cov ${1} \ 11 | --cov-append \ 12 | --cov-branch \ 13 | --cov-report='' \ 14 | ${1} 15 | else 16 | pytest \ 17 | --cov ${1} \ 18 | --cov-append \ 19 | --cov-branch \ 20 | --cov-report='' \ 21 | ${1} 22 | fi 23 | } 24 | 25 | coverage erase 26 | 27 | cov opentelemetry-api 28 | cov opentelemetry-sdk 29 | cov exporter/opentelemetry-exporter-datadog 30 | cov instrumentation/opentelemetry-instrumentation-flask 31 | cov instrumentation/opentelemetry-instrumentation-requests 32 | cov instrumentation/opentelemetry-instrumentation-opentracing-shim 33 | cov util/opentelemetry-util-http 34 | cov exporter/opentelemetry-exporter-zipkin 35 | 36 | 37 | cov instrumentation/opentelemetry-instrumentation-aiohttp-client 38 | cov instrumentation/opentelemetry-instrumentation-asgi 39 | 40 | coverage report --show-missing 41 | coverage xml 42 | -------------------------------------------------------------------------------- /scripts/generate_website_docs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # this script generates the documentation required for 5 | # opentelemetry.io 6 | 7 | pip install -r docs-requirements.txt 8 | 9 | TMP_DIR=/tmp/python_otel_docs 10 | rm -Rf ${TMP_DIR} 11 | 12 | sphinx-build -M jekyll ./docs ${TMP_DIR} 13 | -------------------------------------------------------------------------------- /scripts/semconv/.gitignore: -------------------------------------------------------------------------------- 1 | opentelemetry-specification -------------------------------------------------------------------------------- /shim/opentelemetry-opencensus-shim/README.rst: -------------------------------------------------------------------------------- 1 | OpenCensus Shim for OpenTelemetry 2 | ================================== 3 | 4 | |pypi| 5 | 6 | .. |pypi| image:: https://badge.fury.io/py/opentelemetry-opencensus-shim.svg 7 | :target: https://pypi.org/project/opentelemetry-opencensus-shim/ 8 | 9 | Installation 10 | ------------ 11 | 12 | :: 13 | 14 | pip install opentelemetry-opencensus-shim 15 | 16 | References 17 | ---------- 18 | 19 | * `OpenCensus Shim for OpenTelemetry `_ 20 | * `OpenTelemetry Project `_ 21 | -------------------------------------------------------------------------------- /shim/opentelemetry-opencensus-shim/src/opentelemetry/shim/opencensus/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/shim/opentelemetry-opencensus-shim/src/opentelemetry/shim/opencensus/py.typed -------------------------------------------------------------------------------- /shim/opentelemetry-opencensus-shim/src/opentelemetry/shim/opencensus/version/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | __version__ = "0.56b0.dev" 16 | -------------------------------------------------------------------------------- /shim/opentelemetry-opencensus-shim/test-requirements.txt: -------------------------------------------------------------------------------- 1 | asgiref==3.7.2 2 | cachetools==5.3.3 3 | certifi==2024.7.4 4 | charset-normalizer==3.3.2 5 | google-api-core==2.17.1 6 | google-auth==2.28.1 7 | googleapis-common-protos==1.63.2 8 | grpcio==1.66.2 9 | idna==3.7 10 | importlib-metadata==6.11.0 11 | iniconfig==2.0.0 12 | opencensus==0.11.1 13 | opencensus-context==0.1.3 14 | opencensus-proto==0.1.0 15 | packaging==24.0 16 | pluggy==1.5.0 17 | protobuf==3.20.3 18 | py-cpuinfo==9.0.0 19 | pyasn1==0.5.1 20 | pyasn1-modules==0.3.0 21 | pytest==7.4.4 22 | requests==2.32.3 23 | rsa==4.9 24 | six==1.16.0 25 | tomli==2.0.1 26 | typing_extensions==4.10.0 27 | urllib3==2.2.2 28 | wrapt==1.16.0 29 | zipp==3.19.2 30 | -e opentelemetry-api 31 | -e opentelemetry-sdk 32 | -e tests/opentelemetry-test-utils 33 | -e opentelemetry-semantic-conventions 34 | -e shim/opentelemetry-opencensus-shim 35 | -------------------------------------------------------------------------------- /shim/opentelemetry-opencensus-shim/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/shim/opentelemetry-opencensus-shim/tests/__init__.py -------------------------------------------------------------------------------- /shim/opentelemetry-opentracing-shim/README.rst: -------------------------------------------------------------------------------- 1 | OpenTracing Shim for OpenTelemetry 2 | ================================== 3 | 4 | |pypi| 5 | 6 | .. |pypi| image:: https://badge.fury.io/py/opentelemetry-opentracing-shim.svg 7 | :target: https://pypi.org/project/opentelemetry-opentracing-shim/ 8 | 9 | Installation 10 | ------------ 11 | 12 | :: 13 | 14 | pip install opentelemetry-opentracing-shim 15 | 16 | References 17 | ---------- 18 | 19 | * `OpenTracing Shim for OpenTelemetry `_ 20 | * `OpenTelemetry Project `_ 21 | -------------------------------------------------------------------------------- /shim/opentelemetry-opentracing-shim/src/opentelemetry/shim/opentracing_shim/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/shim/opentelemetry-opentracing-shim/src/opentelemetry/shim/opentracing_shim/py.typed -------------------------------------------------------------------------------- /shim/opentelemetry-opentracing-shim/src/opentelemetry/shim/opentracing_shim/version/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | __version__ = "0.56b0.dev" 16 | -------------------------------------------------------------------------------- /shim/opentelemetry-opentracing-shim/test-requirements.txt: -------------------------------------------------------------------------------- 1 | asgiref==3.7.2 2 | importlib-metadata==6.11.0 3 | iniconfig==2.0.0 4 | opentracing==2.4.0 5 | packaging==24.0 6 | pluggy==1.5.0 7 | py-cpuinfo==9.0.0 8 | pytest==7.4.4 9 | tomli==2.0.1 10 | typing_extensions==4.10.0 11 | wrapt==1.16.0 12 | zipp==3.19.2 13 | -e opentelemetry-api 14 | -e opentelemetry-sdk 15 | -e tests/opentelemetry-test-utils 16 | -e opentelemetry-semantic-conventions 17 | -e shim/opentelemetry-opentracing-shim 18 | -------------------------------------------------------------------------------- /shim/opentelemetry-opentracing-shim/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/shim/opentelemetry-opentracing-shim/tests/__init__.py -------------------------------------------------------------------------------- /shim/opentelemetry-opentracing-shim/tests/testbed/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/shim/opentelemetry-opentracing-shim/tests/testbed/__init__.py -------------------------------------------------------------------------------- /shim/opentelemetry-opentracing-shim/tests/testbed/otel_ot_shim_tracer.py: -------------------------------------------------------------------------------- 1 | import opentelemetry.shim.opentracing_shim as opentracingshim 2 | from opentelemetry.sdk import trace 3 | from opentelemetry.sdk.trace.export import SimpleSpanProcessor 4 | from opentelemetry.sdk.trace.export.in_memory_span_exporter import ( 5 | InMemorySpanExporter, 6 | ) 7 | 8 | 9 | class MockTracer(opentracingshim.TracerShim): 10 | """Wrapper of `opentracingshim.TracerShim`. 11 | 12 | MockTracer extends `opentracingshim.TracerShim` by adding a in memory 13 | span exporter that can be used to get the list of finished spans.""" 14 | 15 | def __init__(self): 16 | tracer_provider = trace.TracerProvider() 17 | oteltracer = tracer_provider.get_tracer(__name__) 18 | super().__init__(oteltracer) 19 | exporter = InMemorySpanExporter() 20 | span_processor = SimpleSpanProcessor(exporter) 21 | tracer_provider.add_span_processor(span_processor) 22 | 23 | self.exporter = exporter 24 | 25 | def finished_spans(self): 26 | return self.exporter.get_finished_spans() 27 | -------------------------------------------------------------------------------- /shim/opentelemetry-opentracing-shim/tests/testbed/test_active_span_replacement/README.rst: -------------------------------------------------------------------------------- 1 | 2 | Active Span replacement example. 3 | ================================ 4 | 5 | This example shows a ``Span`` being created and then passed to an asynchronous task, which will temporary activate it to finish its processing, and further restore the previously active ``Span``. 6 | 7 | ``threading`` implementation: 8 | 9 | .. code-block:: python 10 | 11 | # Create a new Span for this task 12 | with self.tracer.start_active_span("task"): 13 | 14 | with self.tracer.scope_manager.activate(span, True): 15 | # Simulate work strictly related to the initial Span 16 | pass 17 | 18 | # Use the task span as parent of a new subtask 19 | with self.tracer.start_active_span("subtask"): 20 | pass 21 | -------------------------------------------------------------------------------- /shim/opentelemetry-opentracing-shim/tests/testbed/test_active_span_replacement/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/shim/opentelemetry-opentracing-shim/tests/testbed/test_active_span_replacement/__init__.py -------------------------------------------------------------------------------- /shim/opentelemetry-opentracing-shim/tests/testbed/test_client_server/README.rst: -------------------------------------------------------------------------------- 1 | 2 | Client-Server example. 3 | ====================== 4 | 5 | This example shows a ``Span`` created by a ``Client``, which will send a ``Message`` / ``SpanContext`` to a ``Server``, which will in turn extract such context and use it as parent of a new (server-side) ``Span``. 6 | 7 | ``Client.send()`` is used to send messages and inject the ``SpanContext`` using the ``TEXT_MAP`` format, and ``Server.process()`` will process received messages and will extract the context used as parent. 8 | 9 | .. code-block:: python 10 | 11 | def send(self): 12 | with self.tracer.start_active_span("send") as scope: 13 | scope.span.set_tag(tags.SPAN_KIND, tags.SPAN_KIND_RPC_CLIENT) 14 | 15 | message = {} 16 | self.tracer.inject(scope.span.context, 17 | opentracing.Format.TEXT_MAP, 18 | message) 19 | self.queue.put(message) 20 | -------------------------------------------------------------------------------- /shim/opentelemetry-opentracing-shim/tests/testbed/test_client_server/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/shim/opentelemetry-opentracing-shim/tests/testbed/test_client_server/__init__.py -------------------------------------------------------------------------------- /shim/opentelemetry-opentracing-shim/tests/testbed/test_common_request_handler/README.rst: -------------------------------------------------------------------------------- 1 | 2 | Common Request Handler example. 3 | =============================== 4 | 5 | This example shows a ``Span`` used with ``RequestHandler``, which is used as a middleware (as in web frameworks) to manage a new ``Span`` per operation through its ``before_request()`` / ``after_response()`` methods. 6 | 7 | Implementation details: 8 | 9 | 10 | * For ``threading``, no active ``Span`` is consumed as the tasks may be run concurrently on different threads, and an explicit ``SpanContext`` has to be saved to be used as parent. 11 | 12 | RequestHandler implementation: 13 | 14 | .. code-block:: python 15 | 16 | def before_request(self, request, request_context): 17 | 18 | # If we should ignore the active Span, use any passed SpanContext 19 | # as the parent. Else, use the active one. 20 | span = self.tracer.start_span("send", 21 | child_of=self.context, 22 | ignore_active_span=True) 23 | 24 | -------------------------------------------------------------------------------- /shim/opentelemetry-opentracing-shim/tests/testbed/test_common_request_handler/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/shim/opentelemetry-opentracing-shim/tests/testbed/test_common_request_handler/__init__.py -------------------------------------------------------------------------------- /shim/opentelemetry-opentracing-shim/tests/testbed/test_late_span_finish/README.rst: -------------------------------------------------------------------------------- 1 | 2 | Late Span finish example. 3 | ========================= 4 | 5 | This example shows a ``Span`` for a top-level operation, with independent, unknown lifetime, acting as parent of a few asynchronous subtasks (which must re-activate it but not finish it). 6 | 7 | .. code-block:: python 8 | 9 | # Fire away a few subtasks, passing a parent Span whose lifetime 10 | # is not tied at all to the children. 11 | def submit_subtasks(self, parent_span): 12 | def task(name, interval): 13 | with self.tracer.scope_manager.activate(parent_span, False): 14 | with self.tracer.start_active_span(name): 15 | time.sleep(interval) 16 | 17 | self.executor.submit(task, "task1", 0.1) 18 | self.executor.submit(task, "task2", 0.3) 19 | -------------------------------------------------------------------------------- /shim/opentelemetry-opentracing-shim/tests/testbed/test_late_span_finish/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/shim/opentelemetry-opentracing-shim/tests/testbed/test_late_span_finish/__init__.py -------------------------------------------------------------------------------- /shim/opentelemetry-opentracing-shim/tests/testbed/test_listener_per_request/README.rst: -------------------------------------------------------------------------------- 1 | 2 | Listener Response example. 3 | ========================== 4 | 5 | This example shows a ``Span`` created upon a message being sent to a ``Client``, and its handling along a related, **not shared** ``ResponseListener`` object with a ``on_response(self, response)`` method to finish it. 6 | 7 | .. code-block:: python 8 | 9 | def _task(self, message, listener): 10 | res = "%s::response" % message 11 | listener.on_response(res) 12 | return res 13 | 14 | def send_sync(self, message): 15 | span = self.tracer.start_span("send") 16 | span.set_tag(tags.SPAN_KIND, tags.SPAN_KIND_RPC_CLIENT) 17 | 18 | listener = ResponseListener(span) 19 | return self.executor.submit(self._task, message, listener).result() 20 | -------------------------------------------------------------------------------- /shim/opentelemetry-opentracing-shim/tests/testbed/test_listener_per_request/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/shim/opentelemetry-opentracing-shim/tests/testbed/test_listener_per_request/__init__.py -------------------------------------------------------------------------------- /shim/opentelemetry-opentracing-shim/tests/testbed/test_listener_per_request/response_listener.py: -------------------------------------------------------------------------------- 1 | class ResponseListener: 2 | def __init__(self, span): 3 | self.span = span 4 | 5 | def on_response(self, res): 6 | del res 7 | self.span.finish() 8 | -------------------------------------------------------------------------------- /shim/opentelemetry-opentracing-shim/tests/testbed/test_multiple_callbacks/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/shim/opentelemetry-opentracing-shim/tests/testbed/test_multiple_callbacks/__init__.py -------------------------------------------------------------------------------- /shim/opentelemetry-opentracing-shim/tests/testbed/test_nested_callbacks/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/shim/opentelemetry-opentracing-shim/tests/testbed/test_nested_callbacks/__init__.py -------------------------------------------------------------------------------- /shim/opentelemetry-opentracing-shim/tests/testbed/test_subtask_span_propagation/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/open-telemetry/opentelemetry-python/36ac612f263f224665865e2ecc692f3c32a66a23/shim/opentelemetry-opentracing-shim/tests/testbed/test_subtask_span_propagation/__init__.py -------------------------------------------------------------------------------- /tests/opentelemetry-docker-tests/tests/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | 3 | services: 4 | otopencensus: 5 | image: rafaeljesus/opencensus-collector:latest 6 | command: --logging-exporter DEBUG 7 | ports: 8 | - "8888:8888" 9 | - "55678:55678" 10 | otcollector: 11 | image: otel/opentelemetry-collector:0.31.0 12 | ports: 13 | - "4317:4317" 14 | - "4318:55681" 15 | -------------------------------------------------------------------------------- /tests/opentelemetry-test-utils/README.rst: -------------------------------------------------------------------------------- 1 | OpenTelemetry Test Utilities 2 | ============================ 3 | 4 | This package provides internal testing utilities for the OpenTelemetry Python project and provides no stability or quality guarantees. 5 | Please do not use it for anything other than writing or running tests for the OpenTelemetry Python project (github.com/open-telemetry/opentelemetry-python). 6 | 7 | 8 | References 9 | ---------- 10 | * `OpenTelemetry Project `_ 11 | -------------------------------------------------------------------------------- /tests/opentelemetry-test-utils/src/opentelemetry/test/version/__init__.py: -------------------------------------------------------------------------------- 1 | __version__ = "0.56b0.dev" 2 | -------------------------------------------------------------------------------- /tests/opentelemetry-test-utils/test-requirements.txt: -------------------------------------------------------------------------------- 1 | asgiref==3.7.2 2 | importlib-metadata==6.11.0 3 | iniconfig==2.0.0 4 | packaging==24.0 5 | pluggy==1.5.0 6 | py-cpuinfo==9.0.0 7 | pytest==7.4.4 8 | tomli==2.0.1 9 | typing_extensions==4.10.0 10 | wrapt==1.16.0 11 | zipp==3.19.2 12 | -e opentelemetry-api 13 | -e opentelemetry-sdk 14 | -e opentelemetry-semantic-conventions 15 | -e tests/opentelemetry-test-utils 16 | -------------------------------------------------------------------------------- /tests/opentelemetry-test-utils/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /tests/opentelemetry-test-utils/tests/test_base.py: -------------------------------------------------------------------------------- 1 | # Copyright The OpenTelemetry Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from opentelemetry.test.test_base import TestBase 16 | 17 | 18 | class TestBaseTestCase(TestBase): 19 | def test_get_sorted_metrics_works_without_metrics(self): 20 | metrics = self.get_sorted_metrics() 21 | self.assertEqual(metrics, []) 22 | --------------------------------------------------------------------------------