-
Notifications
You must be signed in to change notification settings - Fork 291
feat(otel): opentelemetry instrumentation #6408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Local setup for opentelemetry collection, export, and dashboards. Sentry setup for opentelemetry compatibility Convert prom-client metrics to otel metrics for HIBP requests
Avoid double-counting db queries
128612b to
14c9c0a
Compare
c183730 to
9ecbac3
Compare
| * (e.g. used by OTEL_RESOURCE_ATTRIBUTES env var: | ||
| * 'k8s.container.name=monitor-api-endpoint,k8s.namespace.name=monitor-stage...') | ||
| * */ | ||
| export function parseKVList(str?: string): Record<string, string> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: should this be in a util type folder?
| import * as Sentry from "@sentry/nextjs"; | ||
|
|
||
| export async function register() { | ||
| console.log( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: would there be any risk of this function getting invoked more than once on reload or how the runtime boots?
| - Prometheus (scrapes metrics for grafana; in GCP environment we use Google-Managed Prometheus) | ||
| - Grafana (visualization) | ||
|
|
||
| To view metrics locally, visit [Grafana](http://localhost:3000/d/monitor-dashboard/monitor?orgId=1). Some default dashboard panels are seeded. To see traces, navigate to the [Explore] pane in Grafana and select the Tempo datasource. Note that the data won't propagate immediately, so wait a minute if you're not seeing expected activity show up. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
praise: Thank you for this write-up! It was helpful in explaining the process and made the setup pretty painless.
| await import("./instrumentation.node"); | ||
| const { nodeSDKBuilder } = await import("./instrumentation.node"); | ||
| console.log("[INSTRUMENTATION] Initializing OTEL..."); | ||
| await nodeSDKBuilder(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this have a try/catch?
Description
Local setup for opentelemetry collection, export, and dashboards.
Sentry setup for opentelemetry compatibility
Convert prom-client metrics to otel metrics for HIBP requests
Example: query for a trace and failure metrics (dev environment)
How to test (local)
docker composenpm run devHow to test (dev env)
Via dev site
explorepane to search for tracesVia curl
hibp_notify_requests_total,hibp_notify_request_failures_total) (you will need to pull the dev hibp notify token in order to make successful requests)