Skip to content

Multi-provider observability added - #19

Merged
sourcepirate merged 1 commit into
mainfrom
opencode/issue18-20260907031229
Sep 8, 2026
Merged

sourcepirate merged 1 commit into
mainfrom
opencode/issue18-20260907031229

Conversation

@opencode-agent

@opencode-agent opencode-agent Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Implemented multi-provider observability for the cookiecutter template.

Template configuration (cookiecutter.json:14): Added observability var (comma-separated: none,sentry,datadog,newrelic,opentelemetry,all; legacy include_sentry retained for backward compat with OR checks).

Dependencies ({{ cookiecutter.project_slug }}/pyproject.toml:28,62): Conditional includes for sentry-sdk[django], ddtrace, newrelic, and opentelemetry-* (api/sdk/exporter/instrumentations for django/psycopg/celery/redis) via {% if 'x' in cookiecutter.observability or 'all' ... %} plus legacy include_sentry.

Observability package ({{ cookiecutter.project_slug }}/{{ cookiecutter.project_slug }}/observability/): Created __init__.py (central init_observability), sentry.py (Django+Celery+Redis integrations), datadog.py (ddtrace.patch_all()), newrelic.py (newrelic.agent.initialize()), otel.py (OTLP exporter + Django/Psycopg/Celery/Redis instrumentors). All guarded by env checks and try/except ImportError. Added newrelic.ini and otel-collector-config.yaml (conditional).

Settings (.../settings/production.py:64, local.py:88): Sentry init with traces/profiles, Datadog patch_all, New Relic agent init, OTel TracerProvider + exporters – each in try/except ImportError blocks conditional on Jinja.

App entry (.../wsgi.py:10, asgi.py:10): Early ddtrace.patch_all() and newrelic.agent.initialize() before Django import.

Env/Docker (.env.example:35, docker-compose.yml:65,116,162): Provider-specific env vars (SENTRY_DSN, DD_API_KEY, NEW_RELIC_LICENSE_KEY, OTEL_EXPORTER_OTLP_ENDPOINT) and otel-collector service (only when opentelemetry).

Hook (hooks/post_gen_project.py:98): Added parse_observability() (handles string/list/all, respects legacy flag) and removal logic for unselected provider files (sentry.py, datadog.py, newrelic.py+newrelic.ini, otel.py+otel-collector-config.yaml).

Docs (README.md:22, {{ cookiecutter.project_slug }}/README.md:187, AGENTS.md:15): Documented providers, usage examples (--no-input observability=sentry|datadog|newrelic|opentelemetry|all|comma-list), env vars, SDKs, and generated files.

Validation: pytest tests/test_cookiecutter.py (14 passed), validate_template.py (10 passed), and generation matrix for none,sentry,datadog,newrelic,opentelemetry,all,sentry,datadog verified dependencies, file existence, docker-compose, env, and compile() syntax.

Closes #18

New%20session%20-%202026-09-07T03%3A12%3A29.646Z
opencode session  |  github run

Co-authored-by: sourcepirate <sourcepirate@users.noreply.github.com>
@sourcepirate
sourcepirate merged commit dba6fc4 into main Sep 8, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Explore multiple observablity implementation for the template from different providers.

1 participant