mirror of
https://github.com/hyperdxio/hyperdx
synced 2026-04-21 13:37:15 +00:00
feat: Attach service version to all internal telemetry (#1891)
## Summary - Bump `@hyperdx/browser` to 0.22.0 and pass `service.version` as an OTel resource attribute to the browser SDK, so all frontend telemetry includes the app version - Inject `OTEL_RESOURCE_ATTRIBUTES=service.version=$CODE_VERSION` in API and all-in-one Dockerfiles (prod) and `.env.development` (dev) so the Node OTel SDK attaches service version to all backend traces, metrics, and logs - Remove the standalone Next.js health endpoint — `/api/health` now proxies through to the API server. The original `/api/health` page was redundant since `/api/config` already serves the same purpose
This commit is contained in:
parent
0d17ff1603
commit
25a3291f57
10 changed files with 26 additions and 16 deletions
6
.changeset/strange-beds-arrive.md
Normal file
6
.changeset/strange-beds-arrive.md
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
"@hyperdx/api": patch
|
||||
"@hyperdx/app": patch
|
||||
---
|
||||
|
||||
feat: Attach service version to all internal telemetry
|
||||
|
|
@ -74,6 +74,7 @@ LABEL org.opencontainers.image.vendor="HyperDX" \
|
|||
ARG CODE_VERSION
|
||||
|
||||
ENV CODE_VERSION=$CODE_VERSION
|
||||
ENV OTEL_RESOURCE_ATTRIBUTES="service.version=$CODE_VERSION"
|
||||
ENV NODE_ENV=production
|
||||
|
||||
# Remove package managers from production image (not needed at runtime)
|
||||
|
|
@ -110,6 +111,7 @@ ARG USER_UID=10001
|
|||
ARG USER_GID=10001
|
||||
|
||||
ENV CODE_VERSION=$CODE_VERSION
|
||||
ENV OTEL_RESOURCE_ATTRIBUTES="service.version=$CODE_VERSION"
|
||||
# Copy from otel collector bases
|
||||
COPY --from=otel_collector_base --chmod=755 /otelcol-contrib /otelcontribcol
|
||||
COPY --from=otel_collector_opampsupervisor_base --chmod=755 /usr/local/bin/opampsupervisor /usr/local/bin/opampsupervisor
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ MINER_API_URL="http://localhost:5123"
|
|||
MONGO_URI="mongodb://localhost:27017/hyperdx"
|
||||
NODE_ENV=development
|
||||
OTEL_SERVICE_NAME="hdx-oss-dev-api"
|
||||
OTEL_RESOURCE_ATTRIBUTES="service.version=dev"
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4318"
|
||||
PORT=${HYPERDX_API_PORT}
|
||||
OPAMP_PORT=${HYPERDX_OPAMP_PORT}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ LABEL org.opencontainers.image.vendor="HyperDX" \
|
|||
ARG CODE_VERSION
|
||||
|
||||
ENV CODE_VERSION=$CODE_VERSION
|
||||
ENV OTEL_RESOURCE_ATTRIBUTES="service.version=$CODE_VERSION"
|
||||
ENV NODE_ENV production
|
||||
|
||||
ARG PORT
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
"@codemirror/lang-sql": "^6.7.0",
|
||||
"@dagrejs/dagre": "^1.1.5",
|
||||
"@hookform/resolvers": "^3.9.0",
|
||||
"@hyperdx/browser": "^0.21.1",
|
||||
"@hyperdx/browser": "^0.22.0",
|
||||
"@hyperdx/common-utils": "^0.16.0",
|
||||
"@hyperdx/node-opentelemetry": "^0.9.0",
|
||||
"@lezer/highlight": "^1.2.0",
|
||||
|
|
|
|||
|
|
@ -141,6 +141,9 @@ export default function MyApp({ Component, pageProps }: AppPropsWithLayout) {
|
|||
consoleCapture: true,
|
||||
maskAllInputs: true,
|
||||
maskAllText: true,
|
||||
otelResourceAttributes: {
|
||||
'service.version': process.env.NEXT_PUBLIC_APP_VERSION,
|
||||
},
|
||||
service: _jsonData.serviceName,
|
||||
// tracePropagationTargets: [new RegExp(hostname ?? 'localhost', 'i')],
|
||||
url: _jsonData.collectorUrl,
|
||||
|
|
|
|||
|
|
@ -16,5 +16,6 @@ export default function handler(
|
|||
apiKey: HDX_EXPORTER_ENABLED ? HDX_API_KEY : undefined,
|
||||
collectorUrl: HDX_COLLECTOR_URL,
|
||||
serviceName: HDX_SERVICE_NAME,
|
||||
appVersion: process.env.NEXT_PUBLIC_APP_VERSION,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
import { NextApiRequest, NextApiResponse } from 'next';
|
||||
|
||||
export default function handler(_req: NextApiRequest, res: NextApiResponse) {
|
||||
res.status(200).json({ status: 'ok' });
|
||||
}
|
||||
|
|
@ -241,4 +241,5 @@ export type NextApiConfigResponseData = {
|
|||
apiKey?: string;
|
||||
collectorUrl: string;
|
||||
serviceName: string;
|
||||
appVersion?: string;
|
||||
};
|
||||
|
|
|
|||
20
yarn.lock
20
yarn.lock
|
|
@ -4309,7 +4309,7 @@ __metadata:
|
|||
"@eslint/compat": "npm:^2.0.0"
|
||||
"@hookform/devtools": "npm:^4.3.1"
|
||||
"@hookform/resolvers": "npm:^3.9.0"
|
||||
"@hyperdx/browser": "npm:^0.21.1"
|
||||
"@hyperdx/browser": "npm:^0.22.0"
|
||||
"@hyperdx/common-utils": "npm:^0.16.0"
|
||||
"@hyperdx/node-opentelemetry": "npm:^0.9.0"
|
||||
"@jedmao/location": "npm:^3.0.0"
|
||||
|
|
@ -4431,13 +4431,13 @@ __metadata:
|
|||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@hyperdx/browser@npm:^0.21.1":
|
||||
version: 0.21.1
|
||||
resolution: "@hyperdx/browser@npm:0.21.1"
|
||||
"@hyperdx/browser@npm:^0.22.0":
|
||||
version: 0.22.0
|
||||
resolution: "@hyperdx/browser@npm:0.22.0"
|
||||
dependencies:
|
||||
"@hyperdx/otel-web": "npm:0.16.2"
|
||||
"@hyperdx/otel-web": "npm:0.16.3"
|
||||
"@hyperdx/otel-web-session-recorder": "npm:0.16.2"
|
||||
checksum: 10c0/4e09a61242018f1732ca63e2c8a289fe8b1caf7bc3386f24f811d2546f27cf3a59a0b5bd2ad3583e51940fe83ae280f44a9f584732ab40791b1ca6699839123c
|
||||
checksum: 10c0/b1ee76797344f305033802abb2a755cdcfcd1f7ea2beb58d5bb4deb192b850772b4f7cbdb0903967fbf3ab2bb95e3e700280e61606e306edfd24011cdb93490a
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
|
@ -4594,9 +4594,9 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@hyperdx/otel-web@npm:0.16.2":
|
||||
version: 0.16.2
|
||||
resolution: "@hyperdx/otel-web@npm:0.16.2"
|
||||
"@hyperdx/otel-web@npm:0.16.3":
|
||||
version: 0.16.3
|
||||
resolution: "@hyperdx/otel-web@npm:0.16.3"
|
||||
dependencies:
|
||||
"@babel/runtime": "npm:^7.21.0"
|
||||
"@hyperdx/instrumentation-exception": "npm:^0.1.0"
|
||||
|
|
@ -4616,7 +4616,7 @@ __metadata:
|
|||
lodash: "npm:^4.17.21"
|
||||
shimmer: "npm:^1.2.1"
|
||||
web-vitals: "npm:^3.3.2"
|
||||
checksum: 10c0/f2e43ad530162dcad0cc1f81b0836a1c6c8cd512e07c069165f3c7c67f9051f6002ce4f7a266ca8de9579345064e95af57ace4b46b35d16c85f79b15c96f3353
|
||||
checksum: 10c0/29cc6fd0d2d2037e251846672eba0529f7a28301f45009586b99fe9e2d9235059574f1de0ed209a4cab69a9942eef42cbd1e9bc00bb29d676b9f12f33c1d29c7
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue