@ogcio/o11y-sdk-node
Version:
Opentelemetry standard instrumentation SDK for NodeJS based project
19 lines (18 loc) • 572 B
JavaScript
import packageJson from "../package.json" with { type: "json" };
export class ObservabilityResourceDetector {
_resourceAttributes;
constructor(resourceAttributes) {
this._resourceAttributes = resourceAttributes;
}
detect() {
let attributes = {};
if (this._resourceAttributes) {
attributes = {
...this._resourceAttributes,
};
}
attributes["o11y.sdk.name"] = packageJson.name;
attributes["o11y.sdk.version"] = packageJson.version;
return { attributes };
}
}