Skip to main content

OpenStack oslo.log instrumentation for OpenTelemetry

Project description

OpenTelemetry oslo.log Instrumentation

OpenStack oslo.log instrumentation for OpenTelemetry.

oslo.log builds on top of the standard library logging module, so this instrumentor extends opentelemetry-instrumentation-logging. On instrument() it:

  • injects the OpenTelemetry attributes otelTraceID, otelSpanID, otelTraceSampled and otelServiceName onto every log record, so they are available to oslo.log's ContextFormatter format strings;
  • resolves the service name from the (optional) logger_provider so it matches the resource the logs are exported with;
  • installs a LoggingHandler on the root logger so oslo.log records are exported through the OpenTelemetry logs pipeline (disable with enable_log_auto_instrumentation=False).

Usage

from opentelemetry.instrumentation.oslo_log import OsloLogInstrumentor

OsloLogInstrumentor().instrument(logger_provider=logger_provider)

To surface the injected trace context in oslo.log output, reference the fields from logging_context_format_string / logging_default_format_string in your oslo.config:

[DEFAULT]
logging_default_format_string = %(asctime)s %(levelname)s %(name)s [trace_id=%(otelTraceID)s span_id=%(otelSpanID)s] %(message)s
logging_context_format_string = %(asctime)s %(levelname)s %(name)s [%(request_id)s trace_id=%(otelTraceID)s span_id=%(otelSpanID)s] %(message)s

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file opentelemetry_instrumentation_oslo_log-0.2.0.tar.gz.

File metadata

File hashes

Hashes for opentelemetry_instrumentation_oslo_log-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3ac2566593e4c2a6e1a9cc304185d12cdd53134a481eeaaf4aad415e72e264f5
MD5 b61ceca33cfa7cdfb7a48b71729b41a9
BLAKE2b-256 26417578c22209f46b8fe46b7436831330baf0251d378c2b961204b20308a464

See more details on using hashes here.

Provenance

The following attestation bundles were made for opentelemetry_instrumentation_oslo_log-0.2.0.tar.gz:

Publisher: publish-pypi.yml on daipham3213/opentelemetry-openstack

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file opentelemetry_instrumentation_oslo_log-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for opentelemetry_instrumentation_oslo_log-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bdce803c2a8dbb3d6ef2b8c30bc034e53270ca6e1816f8a6c5215418d8f84bc6
MD5 7dfd729b1e5938ab613af8eba6f555ed
BLAKE2b-256 d7e210a0ed3a630e94d47b503066a3600547de538e3e243e6b1d18b2f5bf0578

See more details on using hashes here.

Provenance

The following attestation bundles were made for opentelemetry_instrumentation_oslo_log-0.2.0-py3-none-any.whl:

Publisher: publish-pypi.yml on daipham3213/opentelemetry-openstack

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page