Add your description here
Project description
Uptick-Observability
This repository contains our observability/instrumentation libraries for both django and fastapi projects.
Instrumentation instructions
Instrumenting Django
Django is instrumented primarily via opentelemetry logs/traces. Metrics are not yet supported.
- Manually instrument
settings.py
MIDDLEWARE = [
# ...
"uptick_observability.django.middleware.AccessLoggingMiddleware",
"uptick_observability.django.middleware.UptickSqlCounterDjangoMiddleware",
]
from uptick_observability.django import manually_instrument_django # noqa
from uptick_observability.logging import manually_instrument_logging # noqa
manually_instrument_django()
# By default it will inject the logging django config
manually_instrument_logging()
Instrumenting Django/Dramatiq
- Manually instrument in settings.py
from uptick_observability.dramatiq import manually_instrument_dramatiq # noqa
manually_instrument_dramatiq()
Instrumenting Django/Celery
- Manually instrument in
settings.py
from uptick_observability.celery import manually_instrument_celery # noqa
manually_instrument_celery()
Instrumenting FastAPI
from uptick_observability.fastapi import manually_instrument_fastapi
from uptick_observability.logging import (
DEFAULT_LOGGING_CONFIG_DICT,
manually_instrument_logging,
)
logging.config.dictConfig(DEFAULT_LOGGING_CONFIG_DICT)
manually_instrument_logging()
manually_instrument_fastapi()
# before app is initiated
app = fastapi.FastAPI()
Kubernetes setup / values
Environment variables required:
OTEL_PYTHON_LOG_CORRELATION = "true"
OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED = "true"
OTEL_METRICS_EXPORTER = "none"
OTEL_EXPORTER_OTLP_TIMEOUT=1
OTEL_EXPORTER_OTLP_ENDPOINT = "https://quickwit-otel.onuptick.com/"
OTEL_LOGS_EXPORTER="otlp"
OTEL_TRACES_EXPORTER="otlp"
# Most important one to set. Use a separate name per component; eg: workforce-fg, workforge-bg
# We typically filter all dashboards on a service-name AND THEN DRILL DOWN either on a
# span attribute or a resource name
OTEL_SERVICE_NAME="workforce-fg"
OTEL_RESOURCE_ATTRIBUTES = "release=arafire,environment=production"
# or
OTEL_SERVICE_NAME="logbooks-fg"
OTEL_RESOURCE_ATTRIBUTES = "release=logbooks,environment=production"
Contribution
How do I
-
How do I run test django server locally
mise run django_otel
andmise run dramatiq_otel
andmise run celery_otel
-
How do I view the otel logs Grafana
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
File details
Details for the file uptick_observability-0.1.0.tar.gz
.
File metadata
- Download URL: uptick_observability-0.1.0.tar.gz
- Upload date:
- Size: 57.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c187bc44cd85824f1334d4c120476aa3e82df0f6894499072e7c4d8389f6af7 |
|
MD5 | 3dfcc7b7241c827e481d5c11f37229ab |
|
BLAKE2b-256 | 6c09525388088268e5a4f708d837ec7fde96517064cf24703cd56f4f52ef97a2 |
File details
Details for the file uptick_observability-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: uptick_observability-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f34bd035781fe0ef61f2385317f66bffd3fbb2707efb4d2b2cf98487bc956b7d |
|
MD5 | 68f34ad27bd7daf8d318d65133fdb8d4 |
|
BLAKE2b-256 | 41c40a3adcbddc83c13f67ef95c94d275f51fbc77121a53e86a516e6ae985a5f |