@sebspark/otel 1.0.5 → 1.1.1

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.d.mts CHANGED
@@ -1,3 +1,6 @@
1
+ import * as _opentelemetry_api from '@opentelemetry/api';
2
+ import { trace, SpanOptions } from '@opentelemetry/api';
3
+ export { Context, Counter, Gauge, Histogram, Meter, ObservableCounter, ObservableGauge, ObservableUpDownCounter, Span, SpanStatus, SpanStatusCode, UpDownCounter, context } from '@opentelemetry/api';
1
4
  import { Instrumentation } from '@opentelemetry/instrumentation';
2
5
  import { DnsInstrumentation } from '@opentelemetry/instrumentation-dns';
3
6
  import { ExpressInstrumentation } from '@opentelemetry/instrumentation-express';
@@ -7,8 +10,6 @@ import { NetInstrumentation } from '@opentelemetry/instrumentation-net';
7
10
  import { RedisInstrumentation } from '@opentelemetry/instrumentation-redis';
8
11
  import { SocketIoInstrumentation } from '@opentelemetry/instrumentation-socket.io';
9
12
  import { UndiciInstrumentation } from '@opentelemetry/instrumentation-undici';
10
- import * as _opentelemetry_api from '@opentelemetry/api';
11
- import { trace, SpanOptions } from '@opentelemetry/api';
12
13
 
13
14
  declare const instrumentations: {
14
15
  readonly http: Instrumentation;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,6 @@
1
+ import * as _opentelemetry_api from '@opentelemetry/api';
2
+ import { trace, SpanOptions } from '@opentelemetry/api';
3
+ export { Context, Counter, Gauge, Histogram, Meter, ObservableCounter, ObservableGauge, ObservableUpDownCounter, Span, SpanStatus, SpanStatusCode, UpDownCounter, context } from '@opentelemetry/api';
1
4
  import { Instrumentation } from '@opentelemetry/instrumentation';
2
5
  import { DnsInstrumentation } from '@opentelemetry/instrumentation-dns';
3
6
  import { ExpressInstrumentation } from '@opentelemetry/instrumentation-express';
@@ -7,8 +10,6 @@ import { NetInstrumentation } from '@opentelemetry/instrumentation-net';
7
10
  import { RedisInstrumentation } from '@opentelemetry/instrumentation-redis';
8
11
  import { SocketIoInstrumentation } from '@opentelemetry/instrumentation-socket.io';
9
12
  import { UndiciInstrumentation } from '@opentelemetry/instrumentation-undici';
10
- import * as _opentelemetry_api from '@opentelemetry/api';
11
- import { trace, SpanOptions } from '@opentelemetry/api';
12
13
 
13
14
  declare const instrumentations: {
14
15
  readonly http: Instrumentation;
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
+ context: () => import_api7.context,
33
34
  getLogger: () => getLogger,
34
35
  getMeter: () => getMeter,
35
36
  getTracer: () => getTracer,
@@ -38,6 +39,7 @@ __export(index_exports, {
38
39
  isInitialized: () => isInitialized
39
40
  });
40
41
  module.exports = __toCommonJS(index_exports);
42
+ var import_api7 = require("@opentelemetry/api");
41
43
 
42
44
  // src/instrumentations.ts
43
45
  var import_instrumentation_dns = require("@opentelemetry/instrumentation-dns");
@@ -802,7 +804,7 @@ function getLogger(serviceOverride, extraAttrs = {}) {
802
804
  ...extraAttrs
803
805
  };
804
806
  function emit(severityText, body, attrs = {}) {
805
- if (!isInitialized()) {
807
+ if (!isInitialized() && process.env.NODE_ENV !== "test") {
806
808
  console.warn("OTEL must be initialized before using logger");
807
809
  console.log(`[${severityText}] ${body}`);
808
810
  return;
@@ -850,7 +852,7 @@ function getLogger(serviceOverride, extraAttrs = {}) {
850
852
  // src/metrics.ts
851
853
  var import_api5 = require("@opentelemetry/api");
852
854
  function getMeter(componentNameOverride) {
853
- if (!isInitialized()) {
855
+ if (!isInitialized() && process.env.NODE_ENV !== "test") {
854
856
  console.warn("OTEL must be initialized before using getMeter()");
855
857
  }
856
858
  const { componentName, systemName, systemVersion } = detectTelemetryContext(
@@ -862,7 +864,7 @@ function getMeter(componentNameOverride) {
862
864
  // src/tracer.ts
863
865
  var import_api6 = require("@opentelemetry/api");
864
866
  function getTracer(componentNameOverride) {
865
- if (!isInitialized()) {
867
+ if (!isInitialized() && process.env.NODE_ENV !== "test") {
866
868
  console.warn("OTEL must be initialized before calling getTracer()");
867
869
  }
868
870
  const { componentName, systemName, systemVersion } = detectTelemetryContext(
@@ -948,6 +950,7 @@ var isSpan = (value) => value !== null && value !== void 0 && isFunction(value.s
948
950
  var isSpanOptions = (value) => value !== null && value !== void 0 && (!!value.startTime || !!value.attributes || !!value.kind) && !isSpan(value);
949
951
  // Annotate the CommonJS export names for ESM import in node:
950
952
  0 && (module.exports = {
953
+ context,
951
954
  getLogger,
952
955
  getMeter,
953
956
  getTracer,
package/dist/index.mjs CHANGED
@@ -1,3 +1,8 @@
1
+ // src/index.ts
2
+ import {
3
+ context as context4
4
+ } from "@opentelemetry/api";
5
+
1
6
  // src/instrumentations.ts
2
7
  import { DnsInstrumentation } from "@opentelemetry/instrumentation-dns";
3
8
  import { ExpressInstrumentation } from "@opentelemetry/instrumentation-express";
@@ -787,7 +792,7 @@ function getLogger(serviceOverride, extraAttrs = {}) {
787
792
  ...extraAttrs
788
793
  };
789
794
  function emit(severityText, body, attrs = {}) {
790
- if (!isInitialized()) {
795
+ if (!isInitialized() && process.env.NODE_ENV !== "test") {
791
796
  console.warn("OTEL must be initialized before using logger");
792
797
  console.log(`[${severityText}] ${body}`);
793
798
  return;
@@ -835,7 +840,7 @@ function getLogger(serviceOverride, extraAttrs = {}) {
835
840
  // src/metrics.ts
836
841
  import { metrics as metrics2 } from "@opentelemetry/api";
837
842
  function getMeter(componentNameOverride) {
838
- if (!isInitialized()) {
843
+ if (!isInitialized() && process.env.NODE_ENV !== "test") {
839
844
  console.warn("OTEL must be initialized before using getMeter()");
840
845
  }
841
846
  const { componentName, systemName, systemVersion } = detectTelemetryContext(
@@ -851,7 +856,7 @@ import {
851
856
  trace as trace3
852
857
  } from "@opentelemetry/api";
853
858
  function getTracer(componentNameOverride) {
854
- if (!isInitialized()) {
859
+ if (!isInitialized() && process.env.NODE_ENV !== "test") {
855
860
  console.warn("OTEL must be initialized before calling getTracer()");
856
861
  }
857
862
  const { componentName, systemName, systemVersion } = detectTelemetryContext(
@@ -936,6 +941,7 @@ var isFunction = (value) => typeof value === "function";
936
941
  var isSpan = (value) => value !== null && value !== void 0 && isFunction(value.spanContext) && isFunction(value.end);
937
942
  var isSpanOptions = (value) => value !== null && value !== void 0 && (!!value.startTime || !!value.attributes || !!value.kind) && !isSpan(value);
938
943
  export {
944
+ context4 as context,
939
945
  getLogger,
940
946
  getMeter,
941
947
  getTracer,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sebspark/otel",
3
- "version": "1.0.5",
3
+ "version": "1.1.1",
4
4
  "license": "Apache-2.0",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",