@elasticdash/tracing 0.0.2 → 0.0.4
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.cjs +6 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +8 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -108,11 +108,11 @@ function _flattenAndSerializeMetadata(metadata, type) {
|
|
|
108
108
|
// src/tracerProvider.ts
|
|
109
109
|
import {
|
|
110
110
|
getGlobalLogger,
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
ELASTICDASH_SDK_VERSION,
|
|
112
|
+
ELASTICDASH_TRACER_NAME
|
|
113
113
|
} from "@elasticdash/core";
|
|
114
114
|
import { trace } from "@opentelemetry/api";
|
|
115
|
-
var
|
|
115
|
+
var ELASTICDASH_GLOBAL_SYMBOL = Symbol.for("langfuse");
|
|
116
116
|
function createState() {
|
|
117
117
|
return {
|
|
118
118
|
isolatedTracerProvider: null
|
|
@@ -128,8 +128,8 @@ function getGlobalState() {
|
|
|
128
128
|
);
|
|
129
129
|
return initialState;
|
|
130
130
|
}
|
|
131
|
-
if (!g[
|
|
132
|
-
Object.defineProperty(g,
|
|
131
|
+
if (!g[ELASTICDASH_GLOBAL_SYMBOL]) {
|
|
132
|
+
Object.defineProperty(g, ELASTICDASH_GLOBAL_SYMBOL, {
|
|
133
133
|
value: initialState,
|
|
134
134
|
writable: false,
|
|
135
135
|
// lock the slot (not the contents)
|
|
@@ -137,7 +137,7 @@ function getGlobalState() {
|
|
|
137
137
|
enumerable: false
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
|
-
return g[
|
|
140
|
+
return g[ELASTICDASH_GLOBAL_SYMBOL];
|
|
141
141
|
} catch (err) {
|
|
142
142
|
if (err instanceof Error) {
|
|
143
143
|
getGlobalLogger().error(`Failed to access global state: ${err.message}`);
|
|
@@ -157,8 +157,8 @@ function getLangfuseTracerProvider() {
|
|
|
157
157
|
}
|
|
158
158
|
function getLangfuseTracer() {
|
|
159
159
|
return getLangfuseTracerProvider().getTracer(
|
|
160
|
-
|
|
161
|
-
|
|
160
|
+
ELASTICDASH_TRACER_NAME,
|
|
161
|
+
ELASTICDASH_SDK_VERSION
|
|
162
162
|
);
|
|
163
163
|
}
|
|
164
164
|
|