@sebspark/otel 1.1.0 → 1.1.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 +5 -3
- package/dist/index.mjs +6 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
SpanStatusCode: () => import_api7.SpanStatusCode,
|
|
33
34
|
context: () => import_api7.context,
|
|
34
35
|
getLogger: () => getLogger,
|
|
35
36
|
getMeter: () => getMeter,
|
|
@@ -804,7 +805,7 @@ function getLogger(serviceOverride, extraAttrs = {}) {
|
|
|
804
805
|
...extraAttrs
|
|
805
806
|
};
|
|
806
807
|
function emit(severityText, body, attrs = {}) {
|
|
807
|
-
if (!isInitialized()) {
|
|
808
|
+
if (!isInitialized() && process.env.NODE_ENV !== "test") {
|
|
808
809
|
console.warn("OTEL must be initialized before using logger");
|
|
809
810
|
console.log(`[${severityText}] ${body}`);
|
|
810
811
|
return;
|
|
@@ -852,7 +853,7 @@ function getLogger(serviceOverride, extraAttrs = {}) {
|
|
|
852
853
|
// src/metrics.ts
|
|
853
854
|
var import_api5 = require("@opentelemetry/api");
|
|
854
855
|
function getMeter(componentNameOverride) {
|
|
855
|
-
if (!isInitialized()) {
|
|
856
|
+
if (!isInitialized() && process.env.NODE_ENV !== "test") {
|
|
856
857
|
console.warn("OTEL must be initialized before using getMeter()");
|
|
857
858
|
}
|
|
858
859
|
const { componentName, systemName, systemVersion } = detectTelemetryContext(
|
|
@@ -864,7 +865,7 @@ function getMeter(componentNameOverride) {
|
|
|
864
865
|
// src/tracer.ts
|
|
865
866
|
var import_api6 = require("@opentelemetry/api");
|
|
866
867
|
function getTracer(componentNameOverride) {
|
|
867
|
-
if (!isInitialized()) {
|
|
868
|
+
if (!isInitialized() && process.env.NODE_ENV !== "test") {
|
|
868
869
|
console.warn("OTEL must be initialized before calling getTracer()");
|
|
869
870
|
}
|
|
870
871
|
const { componentName, systemName, systemVersion } = detectTelemetryContext(
|
|
@@ -950,6 +951,7 @@ var isSpan = (value) => value !== null && value !== void 0 && isFunction(value.s
|
|
|
950
951
|
var isSpanOptions = (value) => value !== null && value !== void 0 && (!!value.startTime || !!value.attributes || !!value.kind) && !isSpan(value);
|
|
951
952
|
// Annotate the CommonJS export names for ESM import in node:
|
|
952
953
|
0 && (module.exports = {
|
|
954
|
+
SpanStatusCode,
|
|
953
955
|
context,
|
|
954
956
|
getLogger,
|
|
955
957
|
getMeter,
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
import {
|
|
3
|
-
context as context4
|
|
3
|
+
context as context4,
|
|
4
|
+
SpanStatusCode as SpanStatusCode4
|
|
4
5
|
} from "@opentelemetry/api";
|
|
5
6
|
|
|
6
7
|
// src/instrumentations.ts
|
|
@@ -792,7 +793,7 @@ function getLogger(serviceOverride, extraAttrs = {}) {
|
|
|
792
793
|
...extraAttrs
|
|
793
794
|
};
|
|
794
795
|
function emit(severityText, body, attrs = {}) {
|
|
795
|
-
if (!isInitialized()) {
|
|
796
|
+
if (!isInitialized() && process.env.NODE_ENV !== "test") {
|
|
796
797
|
console.warn("OTEL must be initialized before using logger");
|
|
797
798
|
console.log(`[${severityText}] ${body}`);
|
|
798
799
|
return;
|
|
@@ -840,7 +841,7 @@ function getLogger(serviceOverride, extraAttrs = {}) {
|
|
|
840
841
|
// src/metrics.ts
|
|
841
842
|
import { metrics as metrics2 } from "@opentelemetry/api";
|
|
842
843
|
function getMeter(componentNameOverride) {
|
|
843
|
-
if (!isInitialized()) {
|
|
844
|
+
if (!isInitialized() && process.env.NODE_ENV !== "test") {
|
|
844
845
|
console.warn("OTEL must be initialized before using getMeter()");
|
|
845
846
|
}
|
|
846
847
|
const { componentName, systemName, systemVersion } = detectTelemetryContext(
|
|
@@ -856,7 +857,7 @@ import {
|
|
|
856
857
|
trace as trace3
|
|
857
858
|
} from "@opentelemetry/api";
|
|
858
859
|
function getTracer(componentNameOverride) {
|
|
859
|
-
if (!isInitialized()) {
|
|
860
|
+
if (!isInitialized() && process.env.NODE_ENV !== "test") {
|
|
860
861
|
console.warn("OTEL must be initialized before calling getTracer()");
|
|
861
862
|
}
|
|
862
863
|
const { componentName, systemName, systemVersion } = detectTelemetryContext(
|
|
@@ -941,6 +942,7 @@ var isFunction = (value) => typeof value === "function";
|
|
|
941
942
|
var isSpan = (value) => value !== null && value !== void 0 && isFunction(value.spanContext) && isFunction(value.end);
|
|
942
943
|
var isSpanOptions = (value) => value !== null && value !== void 0 && (!!value.startTime || !!value.attributes || !!value.kind) && !isSpan(value);
|
|
943
944
|
export {
|
|
945
|
+
SpanStatusCode4 as SpanStatusCode,
|
|
944
946
|
context4 as context,
|
|
945
947
|
getLogger,
|
|
946
948
|
getMeter,
|