@sebspark/otel 1.0.4 → 1.1.0
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 +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +9 -1
- package/dist/index.mjs +12 -1
- package/package.json +1 -1
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");
|
|
@@ -749,14 +751,18 @@ var getResource = async () => {
|
|
|
749
751
|
import_api3.diag.disable();
|
|
750
752
|
import_api3.diag.setLogger(new import_api3.DiagConsoleLogger(), import_api3.DiagLogLevel.ERROR);
|
|
751
753
|
var initialization;
|
|
754
|
+
var _isInitialized = false;
|
|
752
755
|
async function initialize(...instrumentations2) {
|
|
753
756
|
if (!initialization) {
|
|
754
757
|
initialization = _initialize(instrumentations2);
|
|
758
|
+
initialization.then(() => {
|
|
759
|
+
_isInitialized = true;
|
|
760
|
+
});
|
|
755
761
|
}
|
|
756
762
|
return initialization;
|
|
757
763
|
}
|
|
758
764
|
function isInitialized() {
|
|
759
|
-
return
|
|
765
|
+
return _isInitialized;
|
|
760
766
|
}
|
|
761
767
|
async function _initialize(instrumentations2) {
|
|
762
768
|
try {
|
|
@@ -800,6 +806,7 @@ function getLogger(serviceOverride, extraAttrs = {}) {
|
|
|
800
806
|
function emit(severityText, body, attrs = {}) {
|
|
801
807
|
if (!isInitialized()) {
|
|
802
808
|
console.warn("OTEL must be initialized before using logger");
|
|
809
|
+
console.log(`[${severityText}] ${body}`);
|
|
803
810
|
return;
|
|
804
811
|
}
|
|
805
812
|
const logger = import_api_logs3.logs.getLogger(systemName, systemVersion);
|
|
@@ -943,6 +950,7 @@ var isSpan = (value) => value !== null && value !== void 0 && isFunction(value.s
|
|
|
943
950
|
var isSpanOptions = (value) => value !== null && value !== void 0 && (!!value.startTime || !!value.attributes || !!value.kind) && !isSpan(value);
|
|
944
951
|
// Annotate the CommonJS export names for ESM import in node:
|
|
945
952
|
0 && (module.exports = {
|
|
953
|
+
context,
|
|
946
954
|
getLogger,
|
|
947
955
|
getMeter,
|
|
948
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";
|
|
@@ -734,14 +739,18 @@ var getResource = async () => {
|
|
|
734
739
|
diag.disable();
|
|
735
740
|
diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.ERROR);
|
|
736
741
|
var initialization;
|
|
742
|
+
var _isInitialized = false;
|
|
737
743
|
async function initialize(...instrumentations2) {
|
|
738
744
|
if (!initialization) {
|
|
739
745
|
initialization = _initialize(instrumentations2);
|
|
746
|
+
initialization.then(() => {
|
|
747
|
+
_isInitialized = true;
|
|
748
|
+
});
|
|
740
749
|
}
|
|
741
750
|
return initialization;
|
|
742
751
|
}
|
|
743
752
|
function isInitialized() {
|
|
744
|
-
return
|
|
753
|
+
return _isInitialized;
|
|
745
754
|
}
|
|
746
755
|
async function _initialize(instrumentations2) {
|
|
747
756
|
try {
|
|
@@ -785,6 +794,7 @@ function getLogger(serviceOverride, extraAttrs = {}) {
|
|
|
785
794
|
function emit(severityText, body, attrs = {}) {
|
|
786
795
|
if (!isInitialized()) {
|
|
787
796
|
console.warn("OTEL must be initialized before using logger");
|
|
797
|
+
console.log(`[${severityText}] ${body}`);
|
|
788
798
|
return;
|
|
789
799
|
}
|
|
790
800
|
const logger = logs2.getLogger(systemName, systemVersion);
|
|
@@ -931,6 +941,7 @@ var isFunction = (value) => typeof value === "function";
|
|
|
931
941
|
var isSpan = (value) => value !== null && value !== void 0 && isFunction(value.spanContext) && isFunction(value.end);
|
|
932
942
|
var isSpanOptions = (value) => value !== null && value !== void 0 && (!!value.startTime || !!value.attributes || !!value.kind) && !isSpan(value);
|
|
933
943
|
export {
|
|
944
|
+
context4 as context,
|
|
934
945
|
getLogger,
|
|
935
946
|
getMeter,
|
|
936
947
|
getTracer,
|