Observability Package#160
Conversation
CD summary
|
| service | url | fqdn |
|---|---|---|
| api | open | pr-160-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
| entity-linkage | open | pr-160-entity-linkage.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
| frontend | https://witty-mushroom-017a3dc1e-160.westus2.1.azurestaticapps.net | |
| stitch-llm | open | pr-160-stitch-llm.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
Database (1)
| db_name | postgres_host | postgres_port | postgres_db |
|---|---|---|---|
| pr_160 | stitch-dev.postgres.database.azure.com |
5432 |
pr_160 |
Jobs (2)
| job | image | postgres_db | api_url | auth_mode |
|---|---|---|---|---|
| db-migrations | ghcr.io/rmi/stitch-api:pr-160@sha256:88077ac1408f0147a3c48747b5f8a746db0eaeb4334217b488bbef0eb8f018fe |
pr_160 |
||
| seed | ghcr.io/rmi/stitch-seed:pr-160@sha256:fd02f14ffd1856af400a5ec4a497fb0c182131bacdc17fc5cd684f8f84aa92fc |
https://pr-160-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io/api/v1 |
stitch-client-bearer-token |
Images (4)
| build_time | commit_time | git_sha | image | image_digest |
|---|---|---|---|---|
| 2026-07-06T15:13:22Z | 2026-07-06T15:13:00Z | e67d685 | ghcr.io/rmi/stitch-api:pr-160 |
ghcr.io/rmi/stitch-api:pr-160@sha256:88077ac1408f0147a3c48747b5f8a746db0eaeb4334217b488bbef0eb8f018fe |
| 2026-07-06T15:13:20Z | 2026-07-06T15:13:00Z | e67d685 | ghcr.io/rmi/stitch-entity-linkage:pr-160 |
ghcr.io/rmi/stitch-entity-linkage:pr-160@sha256:5f05d2e936366adf7dc150718c67e66a4c70e86f9b739f5179b517d38c1032eb |
| 2026-07-06T15:13:20Z | 2026-07-06T15:13:00Z | e67d685 | ghcr.io/rmi/stitch-seed:pr-160 |
ghcr.io/rmi/stitch-seed:pr-160@sha256:fd02f14ffd1856af400a5ec4a497fb0c182131bacdc17fc5cd684f8f84aa92fc |
| 2026-07-06T15:13:18Z | 2026-07-06T15:13:00Z | e67d685 | ghcr.io/rmi/stitch-stitch-llm:pr-160 |
ghcr.io/rmi/stitch-stitch-llm:pr-160@sha256:f42d0b5880a72b382145054f7c5fd37a7ad0e5fd5e61474defde4678b8b0238e |
CD summary
|
| service | url | fqdn |
|---|---|---|
| api | open | pr-160-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
| entity-linkage | open | pr-160-entity-linkage.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
| frontend | https://witty-mushroom-017a3dc1e-160.westus2.1.azurestaticapps.net | |
| stitch-llm | open | pr-160-stitch-llm.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
Database (1)
| db_name | postgres_host | postgres_port | postgres_db |
|---|---|---|---|
| pr_160 | stitch-dev.postgres.database.azure.com |
5432 |
pr_160 |
Jobs (1)
| job | image | postgres_db |
|---|---|---|
| db-migrations | ghcr.io/rmi/stitch-api:pr-160@sha256:cbaee76371015e46da1f5713bf2dcf9cdca4360781bbe01121619de93fecd27e |
pr_160 |
Images (4)
| build_time | commit_time | git_sha | image | image_digest |
|---|---|---|---|---|
| 2026-07-06T15:41:28Z | 2026-07-06T15:41:12Z | a773284 | ghcr.io/rmi/stitch-api:pr-160 |
ghcr.io/rmi/stitch-api:pr-160@sha256:cbaee76371015e46da1f5713bf2dcf9cdca4360781bbe01121619de93fecd27e |
| 2026-07-06T15:41:28Z | 2026-07-06T15:41:12Z | a773284 | ghcr.io/rmi/stitch-entity-linkage:pr-160 |
ghcr.io/rmi/stitch-entity-linkage:pr-160@sha256:7ba4075af718671ba1fffa72297bd91fde35b23859932d5985fd5a1e2d602dee |
| 2026-07-06T15:41:28Z | 2026-07-06T15:41:12Z | a773284 | ghcr.io/rmi/stitch-seed:pr-160 |
ghcr.io/rmi/stitch-seed:pr-160@sha256:964e7b9b4a59d6b6a838d82075a4a566a0783a2fa034888599ed2cb77e18c6b2 |
| 2026-07-06T15:41:29Z | 2026-07-06T15:41:12Z | a773284 | ghcr.io/rmi/stitch-stitch-llm:pr-160 |
ghcr.io/rmi/stitch-stitch-llm:pr-160@sha256:48d6f8eed88d5e4960e48500b51f722b531f3b652b1bd5292288e39010f74d3e |
There was a problem hiding this comment.
Pull request overview
This PR extracts shared OpenTelemetry tracing setup into a new reusable stitch-observability package and wires it into the API, entity-linkage, and stitch-llm services to enable consistent end-to-end tracing (including traceparent propagation via httpx instrumentation).
Changes:
- Adds new
packages/stitch-observabilitypackage (settings + tracing config + FastAPI/httpx/SQLAlchemy instrumentation helpers) with unit tests and README. - Replaces the API tracing implementation with a thin shim delegating to
stitch.observability(keeping existing call sites stable) and updates API tracing tests accordingly. - Wires tracing into entity-linkage and stitch-llm apps (startup configuration, FastAPI/httpx instrumentation, and shutdown), and updates workspace/build tooling (uv workspace members, Makefile targets, lockfile).
Reviewed changes
Copilot reviewed 22 out of 23 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| uv.lock | Adds workspace package entry and dependency graph updates (incl. httpx instrumentation). |
| pyproject.toml | Registers packages/stitch-observability as a uv workspace member. |
| PLAN.md | Adds implementation plan/notes for the extraction and wiring work. |
| packages/stitch-observability/tests/test_tracing.py | Adds package-level tests for provider construction, exporter logging, truncation, and settings bounds. |
| packages/stitch-observability/src/stitch/observability/tracing.py | Implements shared tracing configuration, exporters, attribute truncation, and instrumentation helpers. |
| packages/stitch-observability/src/stitch/observability/settings.py | Adds OTelSettings BaseSettings mixin for shared OTEL_* env configuration. |
| packages/stitch-observability/src/stitch/observability/init.py | Re-exports public API surface for the observability package. |
| packages/stitch-observability/README.md | Documents package usage and intended service wiring pattern. |
| packages/stitch-observability/pyproject.toml | Defines package metadata and dependencies for stitch-observability. |
| Makefile | Adds build/test targets for the new package and includes them in aggregate targets/.PHONY. |
| deployments/stitch-llm/src/stitch/llm/settings.py | Switches service settings to inherit OTelSettings. |
| deployments/stitch-llm/src/stitch/llm/main.py | Adds tracing configuration + FastAPI/httpx instrumentation and shutdown in lifespan. |
| deployments/stitch-llm/pyproject.toml | Adds stitch-observability as a dependency and workspace source. |
| deployments/stitch-llm/conftest.py | Disables tracing in test runs via OTEL_TRACES_EXPORTER=none. |
| deployments/entity-linkage/src/stitch/entity_linkage/settings.py | Switches service settings to inherit OTelSettings. |
| deployments/entity-linkage/src/stitch/entity_linkage/main.py | Adds tracing configuration + FastAPI/httpx instrumentation and shutdown in lifespan. |
| deployments/entity-linkage/pyproject.toml | Adds stitch-observability as a dependency and workspace source. |
| deployments/entity-linkage/conftest.py | Disables tracing in test runs via OTEL_TRACES_EXPORTER=none. |
| deployments/api/tests/observability/test_tracing.py | Updates tests for new logger name and improves isolation by patching set_tracer_provider. |
| deployments/api/src/stitch/api/observability/tracing.py | Replaces implementation with a compatibility shim over stitch.observability. |
| deployments/api/src/stitch/api/main.py | Adds _tracer_provider pre-declaration to avoid lifespan NameError edge case. |
| deployments/api/src/stitch/api/db/config.py | Adds comment clarifying engine instrumentation is once-per-process due to @lru_cache. |
| deployments/api/pyproject.toml | Adds stitch-observability as a dependency and workspace source. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
CD summary
|
| service | url | fqdn |
|---|---|---|
| api | open | pr-160-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
| entity-linkage | open | pr-160-entity-linkage.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
| frontend | https://witty-mushroom-017a3dc1e-160.westus2.1.azurestaticapps.net | |
| stitch-llm | open | pr-160-stitch-llm.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
Database (1)
| db_name | postgres_host | postgres_port | postgres_db |
|---|---|---|---|
| pr_160 | stitch-dev.postgres.database.azure.com |
5432 |
pr_160 |
Jobs (1)
| job | image | postgres_db |
|---|---|---|
| db-migrations | ghcr.io/rmi/stitch-api:pr-160@sha256:338293a8a041ebd4a776cf3b60f397e0d54d36c15e1c9ddcc79e676a2b9579ed |
pr_160 |
Images (4)
| build_time | commit_time | git_sha | image | image_digest |
|---|---|---|---|---|
| 2026-07-07T14:46:07Z | 2026-07-07T14:45:50Z | e6c914b | ghcr.io/rmi/stitch-api:pr-160 |
ghcr.io/rmi/stitch-api:pr-160@sha256:338293a8a041ebd4a776cf3b60f397e0d54d36c15e1c9ddcc79e676a2b9579ed |
| 2026-07-07T14:46:11Z | 2026-07-07T14:45:50Z | e6c914b | ghcr.io/rmi/stitch-entity-linkage:pr-160 |
ghcr.io/rmi/stitch-entity-linkage:pr-160@sha256:8631ce09586b4a88c79c4024474d31a394ed9c1d9440523d76f29d0021877aa4 |
| 2026-07-07T14:46:10Z | 2026-07-07T14:45:50Z | e6c914b | ghcr.io/rmi/stitch-seed:pr-160 |
ghcr.io/rmi/stitch-seed:pr-160@sha256:094d4dd2f690169d3f4cb662360b09e467acb38bc98924b9965bc6c403666fda |
| 2026-07-07T14:46:09Z | 2026-07-07T14:45:50Z | e6c914b | ghcr.io/rmi/stitch-stitch-llm:pr-160 |
ghcr.io/rmi/stitch-stitch-llm:pr-160@sha256:950e9c297bbf05d0f2007f8a81b759c9c1da0500391c5e35b4c4589fd96caff9 |
| sampler = ParentBased(root=TraceIdRatioBased(sample_ratio)) | ||
| provider = TracerProvider(resource=resource, sampler=sampler) |
| if exporter == "otlp": | ||
| # endpoint=None lets the exporter fall back to OTEL_EXPORTER_OTLP_ENDPOINT | ||
| # / the localhost default. | ||
| provider.add_span_processor( | ||
| BatchSpanProcessor(OTLPSpanExporter(endpoint=otlp_endpoint)) | ||
| ) | ||
| else: # "console" — log spans to stdout, no sidecar required. | ||
| # SimpleSpanProcessor exports each span synchronously on the request | ||
| # thread. Kept for immediate dev visibility (the otlp/cloud path already | ||
| # batches); switch to BatchSpanProcessor if this hot-path cost matters. | ||
| provider.add_span_processor(SimpleSpanProcessor(LoggingSpanExporter())) |
| event = getattr(record, "event", None) | ||
| if isinstance(event, dict): | ||
| payload.update(event) | ||
|
|
CD summary
|
| service | url | fqdn |
|---|---|---|
| api | open | pr-160-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
| entity-linkage | open | pr-160-entity-linkage.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
| frontend | https://witty-mushroom-017a3dc1e-160.westus2.1.azurestaticapps.net | |
| stitch-llm | open | pr-160-stitch-llm.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
Database (1)
| db_name | postgres_host | postgres_port | postgres_db |
|---|---|---|---|
| pr_160 | stitch-dev.postgres.database.azure.com |
5432 |
pr_160 |
Jobs (1)
| job | image | postgres_db |
|---|---|---|
| db-migrations | ghcr.io/rmi/stitch-api:pr-160@sha256:1801ad9e60afcd4c871eacd0a4c887c8230528f50ac741017c22f4f5f2b0e237 |
pr_160 |
Images (4)
| build_time | commit_time | git_sha | image | image_digest |
|---|---|---|---|---|
| 2026-07-08T08:40:04Z | 2026-07-08T08:39:49Z | 24c0a2f | ghcr.io/rmi/stitch-api:pr-160 |
ghcr.io/rmi/stitch-api:pr-160@sha256:1801ad9e60afcd4c871eacd0a4c887c8230528f50ac741017c22f4f5f2b0e237 |
| 2026-07-08T08:40:04Z | 2026-07-08T08:39:49Z | 24c0a2f | ghcr.io/rmi/stitch-entity-linkage:pr-160 |
ghcr.io/rmi/stitch-entity-linkage:pr-160@sha256:98e17e703b2f5ed356a6845b87f642761a8d20ae4bda5a029e7f7be2193524cc |
| 2026-07-08T08:40:08Z | 2026-07-08T08:39:49Z | 24c0a2f | ghcr.io/rmi/stitch-seed:pr-160 |
ghcr.io/rmi/stitch-seed:pr-160@sha256:1878bb6a23965cdc17e5659bf4814706a6345aa0e01cb2c8ba0644343be50ae2 |
| 2026-07-08T08:40:04Z | 2026-07-08T08:39:49Z | 24c0a2f | ghcr.io/rmi/stitch-stitch-llm:pr-160 |
ghcr.io/rmi/stitch-stitch-llm:pr-160@sha256:6875843bae17f71269de88ebd08d65210ab3733aec5d911bdf3db2a0d00f3aa7 |
CD summary
|
| service | url | fqdn |
|---|---|---|
| api | open | pr-160-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
| entity-linkage | open | pr-160-entity-linkage.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
| frontend | https://witty-mushroom-017a3dc1e-160.westus2.1.azurestaticapps.net | |
| stitch-llm | open | pr-160-stitch-llm.purplegrass-c07d0a94.westus2.azurecontainerapps.io |
Database (1)
| db_name | postgres_host | postgres_port | postgres_db |
|---|---|---|---|
| pr_160 | stitch-dev.postgres.database.azure.com |
5432 |
pr_160 |
Jobs (1)
| job | image | postgres_db |
|---|---|---|
| db-migrations | ghcr.io/rmi/stitch-api:pr-160@sha256:40224ccdeb1a07ab7f1b898638015ff1a74ee08c285067c686e7b24124e6c405 |
pr_160 |
Images (4)
| build_time | commit_time | git_sha | image | image_digest |
|---|---|---|---|---|
| 2026-07-08T09:36:44Z | 2026-07-08T09:36:23Z | 73f3fb9 | ghcr.io/rmi/stitch-api:pr-160 |
ghcr.io/rmi/stitch-api:pr-160@sha256:40224ccdeb1a07ab7f1b898638015ff1a74ee08c285067c686e7b24124e6c405 |
| 2026-07-08T09:36:42Z | 2026-07-08T09:36:23Z | 73f3fb9 | ghcr.io/rmi/stitch-entity-linkage:pr-160 |
ghcr.io/rmi/stitch-entity-linkage:pr-160@sha256:c14ad8afc7923bba43bc6e62bf89f3240d5f8e60bc64071d8a2f096818efb2d8 |
| 2026-07-08T09:36:41Z | 2026-07-08T09:36:23Z | 73f3fb9 | ghcr.io/rmi/stitch-seed:pr-160 |
ghcr.io/rmi/stitch-seed:pr-160@sha256:c947ec4e8d97692fbc42664be959644ceb7d485c3c50b001f1f03b4613b24430 |
| 2026-07-08T09:36:40Z | 2026-07-08T09:36:23Z | 73f3fb9 | ghcr.io/rmi/stitch-stitch-llm:pr-160 |
ghcr.io/rmi/stitch-stitch-llm:pr-160@sha256:9a5a9193290229e82f556d2907c62cb5afde15d034bb45344b28d41bb3eecca4 |
Supersedes #149
Extracts observability functionality into a workspace package, and calls it from the api, entity-linkage, and LLM services.