Skip to main content

viktorbarzin-telemetry

The Python client for the viktorbarzin.me telemetry standard: Product events through Segment's segment-analytics-python to our Event pipeline, errors through sentry-sdk to GlitchTip, and logs as one OpenTelemetry-shaped JSON object per line on stdout.

pip install viktorbarzin-telemetry            # events and logs
pip install "viktorbarzin-telemetry[sentry]"  # plus Sentry
import logging
import viktorbarzin_telemetry as telemetry

telemetry.setup_logging(service_name="tv", service_version="1.4.0")
telemetry.configure(
    app="tv",
    write_key=settings.segment_write_key,
    release="1.4.0",
    environment="production",  # or set TELEMETRY_ENVIRONMENT=production
    host=settings.event_pipeline_url,  # or set TELEMETRY_HOST
    dsn=settings.sentry_dsn,  # https://<key>@tv.viktorbarzin.me/_t/x/<project id>
)

with telemetry.log_context(enduser_id=user.sub):
    logging.getLogger(__name__).info("recording started", extra={"channel_id": 4})
    telemetry.track("recording.started", {"channel_id": 4})

telemetry.flush()  # before exit
  • host is the Event pipeline's base URL, from the argument or TELEMETRY_HOST. Inside our cluster it is the event-pipeline Service's URL; elsewhere use telemetry.public_host("tv.viktorbarzin.me"). Production without a host raises ValueError.
  • Nothing is sent unless the environment is production. Invalid events are validated in every environment, dropped and logged as a warning.
  • track takes userId from log_context(enduser_id=...) and anonymousId from log_context(anonymous_id=...), or a fresh random id.
  • EnduserMiddleware(app, resolve_user=...) sets enduser.id per request in any ASGI app. resolve_user gets the ASGI scope and returns the Person's Authentik sub or None, directly or as an awaitable.
  • trace_id and span_id come from the active OpenTelemetry span when opentelemetry-api is installed, else from log_context.
  • The JSON formatter masks the write key, values passed as secrets=, and bearer tokens, Basic credentials, JWTs and PEM blocks.

The standard itself is in the repository README.

Metadata

Release files for viktorbarzin-telemetry 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for viktorbarzin-telemetry 0.1.0
File Size Uploaded Provenance Actions
viktorbarzin_telemetry-0.1.0.tar.gz 15.6 kB With provenance Details for viktorbarzin_telemetry-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for viktorbarzin-telemetry 0.1.0
File Interpreter ABI Platform Actions
viktorbarzin_telemetry-0.1.0-py3-none-any.whl Python 3 none any Details for viktorbarzin_telemetry-0.1.0-py3-none-any.whl

Total release size: 29.2 kB

Release files / viktorbarzin_telemetry-0.1.0.tar.gz

Download URL viktorbarzin_telemetry-0.1.0.tar.gz
Size 15.6 kB
Tags Source
SHA-256 checksum
How to use checksums
85e386bbc832cde734da6bee6a99e12db588ed150571eddd8f16507b70a375b8
BLAKE2b-256 checksum
How to use checksums
719fafd8bb9ebb50b0a5b51d691023a5887a14eefa80f9c38fdfc776e70fdeeb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Release files / viktorbarzin_telemetry-0.1.0-py3-none-any.whl

Download URL viktorbarzin_telemetry-0.1.0-py3-none-any.whl
Size 13.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6f193d0aa84e072877e979e8506b32d3c9c363b530715e3439aa329a9ce0de70
BLAKE2b-256 checksum
How to use checksums
c98189276a9af7e4a50ad3e0fc38457a98865eb324bc0d7abd3eb809617c9180
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Security for viktorbarzin-telemetry 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for viktorbarzin_telemetry-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page