@sebspark/otel 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +7 -6
- package/dist/index.mjs +7 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -668,7 +668,7 @@ async function initializeOtel() {
|
|
|
668
668
|
instrumentations: [(0, import_auto_instrumentations_node.getNodeAutoInstrumentations)()],
|
|
669
669
|
resource
|
|
670
670
|
});
|
|
671
|
-
|
|
671
|
+
sdk.start();
|
|
672
672
|
console.log(`[otel] Telemetry initialized for "${serviceName}"`);
|
|
673
673
|
process.on("SIGTERM", async () => {
|
|
674
674
|
console.log("[otel] Shutting down...");
|
|
@@ -693,17 +693,18 @@ async function initializeOtel() {
|
|
|
693
693
|
var import_api4 = require("@opentelemetry/api");
|
|
694
694
|
var import_api_logs2 = require("@opentelemetry/api-logs");
|
|
695
695
|
function getLogger(serviceOverride, extraAttrs = {}, testProvider) {
|
|
696
|
-
if (!isInitialized()) {
|
|
697
|
-
throw new Error(
|
|
698
|
-
"OpenTelemetry is not initialized. Please call initialize() before getting a logger."
|
|
699
|
-
);
|
|
700
|
-
}
|
|
701
696
|
const { systemName, systemVersion, resourceAttributes } = detectTelemetryContext(serviceOverride);
|
|
702
697
|
const defaultAttrs = {
|
|
703
698
|
...resourceAttributes,
|
|
704
699
|
...extraAttrs
|
|
705
700
|
};
|
|
706
701
|
function emit(severityText, body, attrs = {}) {
|
|
702
|
+
if (!isInitialized()) {
|
|
703
|
+
initialize().then(() => {
|
|
704
|
+
emit(severityText, body, attrs);
|
|
705
|
+
});
|
|
706
|
+
return;
|
|
707
|
+
}
|
|
707
708
|
const logger = testProvider ? testProvider.getLogger(systemName, systemVersion) : import_api_logs2.logs.getLogger(systemName, systemVersion);
|
|
708
709
|
const span = import_api4.trace.getSpan(import_api4.context.active());
|
|
709
710
|
const spanContext = span?.spanContext();
|
package/dist/index.mjs
CHANGED
|
@@ -645,7 +645,7 @@ async function initializeOtel() {
|
|
|
645
645
|
instrumentations: [getNodeAutoInstrumentations()],
|
|
646
646
|
resource
|
|
647
647
|
});
|
|
648
|
-
|
|
648
|
+
sdk.start();
|
|
649
649
|
console.log(`[otel] Telemetry initialized for "${serviceName}"`);
|
|
650
650
|
process.on("SIGTERM", async () => {
|
|
651
651
|
console.log("[otel] Shutting down...");
|
|
@@ -670,17 +670,18 @@ async function initializeOtel() {
|
|
|
670
670
|
import { context, trace } from "@opentelemetry/api";
|
|
671
671
|
import { logs as logs2 } from "@opentelemetry/api-logs";
|
|
672
672
|
function getLogger(serviceOverride, extraAttrs = {}, testProvider) {
|
|
673
|
-
if (!isInitialized()) {
|
|
674
|
-
throw new Error(
|
|
675
|
-
"OpenTelemetry is not initialized. Please call initialize() before getting a logger."
|
|
676
|
-
);
|
|
677
|
-
}
|
|
678
673
|
const { systemName, systemVersion, resourceAttributes } = detectTelemetryContext(serviceOverride);
|
|
679
674
|
const defaultAttrs = {
|
|
680
675
|
...resourceAttributes,
|
|
681
676
|
...extraAttrs
|
|
682
677
|
};
|
|
683
678
|
function emit(severityText, body, attrs = {}) {
|
|
679
|
+
if (!isInitialized()) {
|
|
680
|
+
initialize().then(() => {
|
|
681
|
+
emit(severityText, body, attrs);
|
|
682
|
+
});
|
|
683
|
+
return;
|
|
684
|
+
}
|
|
684
685
|
const logger = testProvider ? testProvider.getLogger(systemName, systemVersion) : logs2.getLogger(systemName, systemVersion);
|
|
685
686
|
const span = trace.getSpan(context.active());
|
|
686
687
|
const spanContext = span?.spanContext();
|