feat: Add OpenTelemetry instrumentation with Drizzle ORM support#46
Open
kubiks-bot[bot] wants to merge 2 commits into
Open
feat: Add OpenTelemetry instrumentation with Drizzle ORM support#46kubiks-bot[bot] wants to merge 2 commits into
kubiks-bot[bot] wants to merge 2 commits into
Conversation
- Add @opentelemetry/sdk-node and related packages - Add @kubiks/otel-drizzle for database query tracing - Create instrumentation.ts to initialize OpenTelemetry - Configure OTLP exporter for Kubiks ingestion - Add environment variable configuration - Update entry point to load instrumentation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
⛔ 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. |
|
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. |
- Update build.mjs to include instrumentation.ts as entry point - Update start script to require instrumentation file before index.mjs - This ensures OpenTelemetry SDK is initialized before the Express app starts
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 with automatic Drizzle ORM database query tracing.
Changes
✅ Install OpenTelemetry SDK packages:
@opentelemetry/sdk-node- Core SDK@opentelemetry/auto-instrumentations-node- Auto instrumentation for Node.js@opentelemetry/exporter-trace-otlp-http- OTLP HTTP exporter@kubiks/otel-drizzle- Drizzle ORM-specific instrumentation✅ Create
src/instrumentation.tsto:✅ Update
src/index.tsto import instrumentation first (before other modules)✅ Add
.env.examplewith required OpenTelemetry configuration:OTEL_EXPORTER_OTLP_ENDPOINT- Kubiks ingestion endpointOTEL_EXPORTER_OTLP_HEADERS- API key authenticationOTEL_SERVICE_NAME- Service identifierFeatures
Environment Configuration
Add these environment variables to your
.env:What Gets Traced
Next Steps
Summary by cubic
Add OpenTelemetry to the API server with automatic HTTP and Drizzle ORM tracing, exporting spans to Kubiks via OTLP HTTP. The SDK now starts before Express by preloading
instrumentationin build and start.New Features
@kubiks/otel-drizzle.@opentelemetry/exporter-trace-otlp-http; flush on SIGTERM.src/instrumentation.tsin the build, preload./dist/instrumentation.mjsinstart, and import./instrumentationinsrc/index.ts.Migration
OTEL_EXPORTER_OTLP_ENDPOINT(default https://ingest.kubiks.app),OTEL_EXPORTER_OTLP_HEADERS(x-kubiks-key=YOUR_KUBIKS_API_KEY), andOTEL_SERVICE_NAME.Written for commit 408fd16. Summary will update on new commits.