Skip to content

Commit

Permalink
feat: add pkg version to resource (node-opentelemetry) (#89)
Browse files Browse the repository at this point in the history
* feat: add pkg version to resource (node-opentelemetry)

* feat: add runtime version

* docs: add changeset

* style: import sorting
  • Loading branch information
wrn14897 authored Feb 26, 2024
1 parent 80f1646 commit c8df2e5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/serious-phones-hide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperdx/node-opentelemetry': patch
---

feat: add pkg + runtime version to resource
12 changes: 9 additions & 3 deletions packages/node-opentelemetry/src/otel.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import { InstrumentationBase } from '@opentelemetry/instrumentation';
import { NodeSDK } from '@opentelemetry/sdk-node';
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-proto';
import { Resource } from '@opentelemetry/resources';
import {
getNodeAutoInstrumentations,
InstrumentationConfigMap,
} from '@opentelemetry/auto-instrumentations-node';

import HyperDXConsoleInstrumentation from './instrumentations/console';
import HyperDXSpanProcessor from './spanProcessor';
import hdx, {
HDX_DEBUG_MODE_ENABLED,
LOG_PREFIX as _LOG_PREFIX,
} from './debug';
import HyperDXConsoleInstrumentation from './instrumentations/console';
import HyperDXSpanProcessor from './spanProcessor';
import { getHyperDXHTTPInstrumentationConfig } from './instrumentations/http';
import { hyperDXGlobalContext } from './context';
import { InstrumentationBase } from '@opentelemetry/instrumentation';
import { version as PKG_VERSION } from '../package.json';

const LOG_PREFIX = `⚠️ ${_LOG_PREFIX}`;

Expand Down Expand Up @@ -67,6 +69,10 @@ export const initSDK = (config: SDKConfig) => {
});

sdk = new NodeSDK({
resource: new Resource({
'hyperdx.distro.version': PKG_VERSION,
'hyperdx.distro.runtime_version': process.versions.node,
}),
// metricReader: metricReader,
...(config.betaMode
? {
Expand Down

0 comments on commit c8df2e5

Please sign in to comment.