feat: Add OpenTelemetry instrumentation with Drizzle ORM tracing#47
Open
kubiks-bot[bot] wants to merge 1 commit into
Open
feat: Add OpenTelemetry instrumentation with Drizzle ORM tracing#47kubiks-bot[bot] wants to merge 1 commit into
kubiks-bot[bot] wants to merge 1 commit into
Conversation
- Initialize OpenTelemetry SDK with auto-instrumentations - Add Drizzle ORM instrumentation for database query tracing - Configure OTLP exporter for Kubiks ingest endpoint - Add environment variable configuration template - Instrument Express.js and HTTP layers automatically
⛔ Snyk checks have failed. 2 issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Kilo Code Review could not run — your account is out of credits. Add credits or switch to a free model to enable reviews on this change. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR adds comprehensive OpenTelemetry instrumentation to the API server, enabling distributed tracing and observability with Kubiks.
Changes
@kubiks/otel-drizzle.env.examplewith all required environment variablesNew Files
artifacts/api-server/src/instrumentation.ts- OpenTelemetry SDK initializationartifacts/api-server/.env.example- Environment configuration templateModified Files
artifacts/api-server/src/index.ts- Import instrumentation before app initializationartifacts/api-server/package.json- Added dependencies (installed via pnpm)Dependencies Added
@opentelemetry/sdk-node- Core SDK@opentelemetry/auto-instrumentations-node- Auto-instrumentation for Node.js@opentelemetry/exporter-trace-otlp-http- OTLP HTTP exporter@opentelemetry/api- OpenTelemetry API@opentelemetry/resources- Resource support@opentelemetry/semantic-conventions- Semantic conventions@kubiks/otel-drizzle- Drizzle ORM instrumentationConfiguration
Set these environment variables to enable tracing:
What's Traced
Testing
The instrumentation will automatically:
https://ingest.kubiks.appNo changes required to existing route handlers - instrumentation is transparent!
Summary by cubic
Add OpenTelemetry tracing to the API server with auto-instrumentation for Express/HTTP and Drizzle ORM, exporting spans to Kubiks via OTLP HTTP. Improves observability without changing route code.
New Features
@opentelemetry/sdk-node.expressandhttpvia@opentelemetry/auto-instrumentations-node.@kubiks/otel-drizzle(includesdb.statement).@opentelemetry/exporter-trace-otlp-httptohttps://ingest.kubiks.app../instrumentationbefore app setup to capture all spans..env.examplewith required OTEL/Kubiks variables and graceful SIGTERM flush.Migration
OTEL_SERVICE_NAME,OTEL_EXPORTER_OTLP_ENDPOINT, and eitherOTEL_EXPORTER_OTLP_HEADERSwithx-kubiks-key=...orKUBIKS_API_KEY.Written for commit a35b3fe. Summary will update on new commits.