Skip to main content

OpenTelemetry instrumentation for PyEQX

Project description

esbm-dis-dfts-pyeqx-opentelemetry

This is part of pyeqx with opentelemetry packages. (package: pyeqx-opentelemetry)

Pre-requisites

Python: 3.12

Dependencies:

  • opentelemetry-api
  • opentelemetry-sdk
  • opentelemetry-exporter-otlp
  • opentelemetry-exporter-prometheus
  • opentelemetry-instrumentation
  • azure-monitor-opentelemetry-exporter
# setup virtual env
python3.12 -m venv .venv

# activate virtual env
source .venv/bin/activate

# install dependencies
pip install opentelemetry-api opentelemetry-distro opentelemetry-sdk opentelemetry-exporter-otlp opentelemetry-exporter-prometheus azure-monitor-opentelemetry-exporter==1.0.0b34

# or
pip install -e .[dev]

# execute opentelemetry bootstrap install (to auto-detect instrumentation and install)
opentelemetry-bootstrap -a install

# install dependencies (If you want to publish)
pip install twine

Environement variables

Create .env file with content below

OTEL_TRACES_EXPORTER=otlp
OTEL_METRICS_EXPORTER=otlp
OTEL_EXPORTER_OTLP_PROTOCOL=grpc
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317

OTEL_PYTHON_LOG_CORRELATION=true
OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true

Tests

By default, just using pytest will run the test with coverage.

pytest

To execute unit test run this command at root of the project

python3 -m unittest discover test -p "**.py"

# or

pytest test/ --cov=src --cov-report=term-missing

To execute test with coverage

pytest test/ --cov=src

[!NOTE] Additional commands for pytest to generate coverage report in another format, you can use this command pytest --cov-report=xml:coverage/coverage.xml to enable watch mode and rerun test when file changes, you can use this command pytest --looponfail to run and with stdout output, you can use this command pytest -s

Build

python3 -m build

Publish

To pypi

python3 -m twine upload --config-file .pypirc dist/*

Remark

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

pyeqx_opentelemetry-0.2.1.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

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

pyeqx_opentelemetry-0.2.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file pyeqx_opentelemetry-0.2.1.tar.gz.

File metadata

  • Download URL: pyeqx_opentelemetry-0.2.1.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for pyeqx_opentelemetry-0.2.1.tar.gz
Algorithm Hash digest
SHA256 b84718dcd6389160afcbbe84fd77cf5ce229958014c0842d8e3f350f68d6b8a7
MD5 7fe911585567647a71452d376b80c68c
BLAKE2b-256 1c32b23308f3a05a8a07b9aeb6167c981ac9fe61d3a77770a9c0e4afcb102597

See more details on using hashes here.

File details

Details for the file pyeqx_opentelemetry-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pyeqx_opentelemetry-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2f1016225b941e26aec55ece94da247d2d6ed1ec9230e96231e66d0e8659e226
MD5 5a12beb352bcc40a95e0bdb2b72d2321
BLAKE2b-256 09f79a1923bea32e79155ff6426e7f03cdac00ae2be7f02cef7c2234e4d4ddc7

See more details on using hashes here.

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