@elasticdash/tracing 0.0.5 → 0.0.7
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 +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -32
- package/dist/index.d.ts +32 -32
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -4,7 +4,7 @@ import { OpenAiUsage } from '@elasticdash/core';
|
|
|
4
4
|
export { LangfuseOtelSpanAttributes, PropagateAttributesParams, propagateAttributes } from '@elasticdash/core';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* Types of observations that can be created in
|
|
7
|
+
* Types of observations that can be created in ElasticDash.
|
|
8
8
|
*
|
|
9
9
|
* - `span`: General-purpose observations for tracking operations, functions, or logical units of work
|
|
10
10
|
* - `generation`: Specialized observations for LLM calls with model parameters, usage, and costs
|
|
@@ -14,7 +14,7 @@ export { LangfuseOtelSpanAttributes, PropagateAttributesParams, propagateAttribu
|
|
|
14
14
|
*/
|
|
15
15
|
type LangfuseObservationType = "span" | "generation" | "event" | "embedding" | "agent" | "tool" | "chain" | "retriever" | "evaluator" | "guardrail";
|
|
16
16
|
/**
|
|
17
|
-
* Severity levels for observations in
|
|
17
|
+
* Severity levels for observations in ElasticDash.
|
|
18
18
|
*
|
|
19
19
|
* Used to categorize the importance or severity of observations:
|
|
20
20
|
* - `DEBUG`: Detailed diagnostic information
|
|
@@ -26,7 +26,7 @@ type LangfuseObservationType = "span" | "generation" | "event" | "embedding" | "
|
|
|
26
26
|
*/
|
|
27
27
|
type ObservationLevel = "DEBUG" | "DEFAULT" | "WARNING" | "ERROR";
|
|
28
28
|
/**
|
|
29
|
-
* Attributes for
|
|
29
|
+
* Attributes for ElasticDash span observations.
|
|
30
30
|
*
|
|
31
31
|
* Spans are used to track operations, functions, or logical units of work.
|
|
32
32
|
* They can contain other spans, generations, or events as children.
|
|
@@ -50,7 +50,7 @@ type LangfuseSpanAttributes = {
|
|
|
50
50
|
environment?: string;
|
|
51
51
|
};
|
|
52
52
|
/**
|
|
53
|
-
* Attributes for
|
|
53
|
+
* Attributes for ElasticDash generation observations.
|
|
54
54
|
*
|
|
55
55
|
* Generations are specialized observations for tracking LLM interactions,
|
|
56
56
|
* including model parameters, usage metrics, costs, and prompt information.
|
|
@@ -74,7 +74,7 @@ type LangfuseGenerationAttributes = LangfuseSpanAttributes & {
|
|
|
74
74
|
costDetails?: {
|
|
75
75
|
[key: string]: number;
|
|
76
76
|
};
|
|
77
|
-
/** Information about the prompt used from
|
|
77
|
+
/** Information about the prompt used from ElasticDash prompt management */
|
|
78
78
|
prompt?: {
|
|
79
79
|
/** Name of the prompt template */
|
|
80
80
|
name: string;
|
|
@@ -93,7 +93,7 @@ type LangfuseEvaluatorAttributes = LangfuseSpanAttributes;
|
|
|
93
93
|
type LangfuseGuardrailAttributes = LangfuseSpanAttributes;
|
|
94
94
|
type LangfuseEmbeddingAttributes = LangfuseGenerationAttributes;
|
|
95
95
|
/**
|
|
96
|
-
* Union type representing any
|
|
96
|
+
* Union type representing any ElasticDash observation attributes.
|
|
97
97
|
*
|
|
98
98
|
* This type is used when you need to accept any type of observation attributes.
|
|
99
99
|
*
|
|
@@ -101,7 +101,7 @@ type LangfuseEmbeddingAttributes = LangfuseGenerationAttributes;
|
|
|
101
101
|
*/
|
|
102
102
|
type LangfuseObservationAttributes = LangfuseSpanAttributes & LangfuseGenerationAttributes & LangfuseEventAttributes & LangfuseAgentAttributes & LangfuseToolAttributes & LangfuseChainAttributes & LangfuseRetrieverAttributes & LangfuseEvaluatorAttributes & LangfuseGuardrailAttributes;
|
|
103
103
|
/**
|
|
104
|
-
* Attributes for
|
|
104
|
+
* Attributes for ElasticDash traces.
|
|
105
105
|
*
|
|
106
106
|
* Traces are the top-level containers that group related observations together.
|
|
107
107
|
* They represent a complete workflow, request, or user interaction.
|
|
@@ -134,9 +134,9 @@ type LangfuseTraceAttributes = {
|
|
|
134
134
|
};
|
|
135
135
|
|
|
136
136
|
/**
|
|
137
|
-
* Union type representing any
|
|
137
|
+
* Union type representing any ElasticDash observation wrapper.
|
|
138
138
|
*
|
|
139
|
-
* This type encompasses all observation types supported by
|
|
139
|
+
* This type encompasses all observation types supported by ElasticDash, providing
|
|
140
140
|
* a unified interface for handling different kinds of traced operations. It's
|
|
141
141
|
* particularly useful for generic functions that work with any observation type.
|
|
142
142
|
*
|
|
@@ -177,7 +177,7 @@ type LangfuseTraceAttributes = {
|
|
|
177
177
|
*/
|
|
178
178
|
type LangfuseObservation = LangfuseSpan | LangfuseGeneration | LangfuseEvent | LangfuseAgent | LangfuseTool | LangfuseChain | LangfuseRetriever | LangfuseEvaluator | LangfuseGuardrail | LangfuseEmbedding;
|
|
179
179
|
/**
|
|
180
|
-
* Parameters for creating a
|
|
180
|
+
* Parameters for creating a ElasticDash observation wrapper.
|
|
181
181
|
*
|
|
182
182
|
* @internal
|
|
183
183
|
*/
|
|
@@ -187,14 +187,14 @@ type LangfuseObservationParams = {
|
|
|
187
187
|
attributes?: LangfuseSpanAttributes | LangfuseGenerationAttributes | LangfuseEventAttributes;
|
|
188
188
|
};
|
|
189
189
|
/**
|
|
190
|
-
* Base class for all
|
|
190
|
+
* Base class for all ElasticDash observation wrappers providing unified functionality.
|
|
191
191
|
*
|
|
192
|
-
* This abstract class serves as the foundation for all observation types in
|
|
192
|
+
* This abstract class serves as the foundation for all observation types in ElasticDash,
|
|
193
193
|
* encapsulating common operations and properties shared across spans, generations,
|
|
194
194
|
* events, and specialized observation types like agents, tools, and chains.
|
|
195
195
|
*
|
|
196
196
|
* ## Core Capabilities
|
|
197
|
-
* - **OpenTelemetry Integration**: Wraps OTEL spans with
|
|
197
|
+
* - **OpenTelemetry Integration**: Wraps OTEL spans with ElasticDash-specific functionality
|
|
198
198
|
* - **Unique Identification**: Provides span ID and trace ID for correlation
|
|
199
199
|
* - **Lifecycle Management**: Handles observation creation, updates, and completion
|
|
200
200
|
* - **Trace Context**: Enables updating trace-level attributes from any observation
|
|
@@ -251,7 +251,7 @@ declare abstract class LangfuseBaseObservation {
|
|
|
251
251
|
/** The trace ID from the OpenTelemetry span context */
|
|
252
252
|
traceId: string;
|
|
253
253
|
constructor(params: LangfuseObservationParams);
|
|
254
|
-
/** Gets the
|
|
254
|
+
/** Gets the ElasticDash OpenTelemetry tracer instance */
|
|
255
255
|
protected get tracer(): _opentelemetry_api.Tracer;
|
|
256
256
|
/**
|
|
257
257
|
* Ends the observation, marking it as complete.
|
|
@@ -1134,7 +1134,7 @@ declare class LangfuseGuardrail extends LangfuseBaseObservation {
|
|
|
1134
1134
|
update(attributes: LangfuseGuardrailAttributes): LangfuseGuardrail;
|
|
1135
1135
|
}
|
|
1136
1136
|
/**
|
|
1137
|
-
* Parameters for creating a
|
|
1137
|
+
* Parameters for creating a ElasticDash generation.
|
|
1138
1138
|
*
|
|
1139
1139
|
* @internal
|
|
1140
1140
|
*/
|
|
@@ -1335,7 +1335,7 @@ declare class LangfuseEmbedding extends LangfuseBaseObservation {
|
|
|
1335
1335
|
update(attributes: LangfuseEmbeddingAttributes): LangfuseEmbedding;
|
|
1336
1336
|
}
|
|
1337
1337
|
/**
|
|
1338
|
-
* Parameters for creating a
|
|
1338
|
+
* Parameters for creating a ElasticDash event.
|
|
1339
1339
|
*
|
|
1340
1340
|
* @internal
|
|
1341
1341
|
*/
|
|
@@ -1345,7 +1345,7 @@ type LangfuseEventParams = {
|
|
|
1345
1345
|
timestamp: TimeInput;
|
|
1346
1346
|
};
|
|
1347
1347
|
/**
|
|
1348
|
-
*
|
|
1348
|
+
* ElasticDash event wrapper for point-in-time observations.
|
|
1349
1349
|
*
|
|
1350
1350
|
* Events represent instantaneous occurrences or log entries within a trace.
|
|
1351
1351
|
* Unlike spans and generations, they don't have duration and are automatically
|
|
@@ -1358,12 +1358,12 @@ declare class LangfuseEvent extends LangfuseBaseObservation {
|
|
|
1358
1358
|
}
|
|
1359
1359
|
|
|
1360
1360
|
/**
|
|
1361
|
-
* Creates OpenTelemetry attributes from
|
|
1361
|
+
* Creates OpenTelemetry attributes from ElasticDash trace attributes.
|
|
1362
1362
|
*
|
|
1363
1363
|
* Converts user-friendly trace attributes into the internal OpenTelemetry
|
|
1364
1364
|
* attribute format required by the span processor.
|
|
1365
1365
|
*
|
|
1366
|
-
* @param attributes -
|
|
1366
|
+
* @param attributes - ElasticDash trace attributes to convert
|
|
1367
1367
|
* @returns OpenTelemetry attributes object with non-null values
|
|
1368
1368
|
*
|
|
1369
1369
|
* @example
|
|
@@ -1387,9 +1387,9 @@ declare function createTraceAttributes({ name, userId, sessionId, version, relea
|
|
|
1387
1387
|
declare function createObservationAttributes(type: LangfuseObservationType, attributes: LangfuseObservationAttributes): Attributes;
|
|
1388
1388
|
|
|
1389
1389
|
/**
|
|
1390
|
-
* Sets an isolated TracerProvider for
|
|
1390
|
+
* Sets an isolated TracerProvider for ElasticDash tracing operations.
|
|
1391
1391
|
*
|
|
1392
|
-
* This allows
|
|
1392
|
+
* This allows ElasticDash to use its own TracerProvider instance, separate from
|
|
1393
1393
|
* the global OpenTelemetry TracerProvider. This is useful for avoiding conflicts
|
|
1394
1394
|
* with other OpenTelemetry instrumentation in the application.
|
|
1395
1395
|
*
|
|
@@ -1432,7 +1432,7 @@ declare function createObservationAttributes(type: LangfuseObservationType, attr
|
|
|
1432
1432
|
*/
|
|
1433
1433
|
declare function setLangfuseTracerProvider(provider: TracerProvider | null): void;
|
|
1434
1434
|
/**
|
|
1435
|
-
* Gets the TracerProvider for
|
|
1435
|
+
* Gets the TracerProvider for ElasticDash tracing operations.
|
|
1436
1436
|
*
|
|
1437
1437
|
* Returns the isolated TracerProvider if one has been set via setLangfuseTracerProvider(),
|
|
1438
1438
|
* otherwise falls back to the global OpenTelemetry TracerProvider.
|
|
@@ -1445,18 +1445,18 @@ declare function setLangfuseTracerProvider(provider: TracerProvider | null): voi
|
|
|
1445
1445
|
* const tracer = provider.getTracer('my-tracer', '1.0.0');
|
|
1446
1446
|
* ```
|
|
1447
1447
|
*
|
|
1448
|
-
* @returns The TracerProvider instance to use for
|
|
1448
|
+
* @returns The TracerProvider instance to use for ElasticDash tracing
|
|
1449
1449
|
* @public
|
|
1450
1450
|
*/
|
|
1451
1451
|
declare function getLangfuseTracerProvider(): TracerProvider;
|
|
1452
1452
|
/**
|
|
1453
|
-
* Gets the OpenTelemetry tracer instance for
|
|
1453
|
+
* Gets the OpenTelemetry tracer instance for ElasticDash.
|
|
1454
1454
|
*
|
|
1455
|
-
* This function returns a tracer specifically configured for
|
|
1455
|
+
* This function returns a tracer specifically configured for ElasticDash
|
|
1456
1456
|
* with the correct tracer name and version. Used internally by all
|
|
1457
|
-
*
|
|
1457
|
+
* ElasticDash tracing functions to ensure consistent trace creation.
|
|
1458
1458
|
*
|
|
1459
|
-
* @returns The
|
|
1459
|
+
* @returns The ElasticDash OpenTelemetry tracer instance
|
|
1460
1460
|
*
|
|
1461
1461
|
* @example
|
|
1462
1462
|
* ```typescript
|
|
@@ -1596,7 +1596,7 @@ declare function updateActiveTrace(attributes: LangfuseTraceAttributes): void;
|
|
|
1596
1596
|
* Updates the currently active observation with new attributes.
|
|
1597
1597
|
*
|
|
1598
1598
|
* This function finds the currently active OpenTelemetry span in the execution context
|
|
1599
|
-
* and updates it with
|
|
1599
|
+
* and updates it with ElasticDash-specific attributes. It supports all observation types
|
|
1600
1600
|
* through TypeScript overloads, providing type safety for attributes based on the
|
|
1601
1601
|
* specified `asType` parameter. If no active span exists, the update is skipped with a warning.
|
|
1602
1602
|
*
|
|
@@ -1770,7 +1770,7 @@ interface ObserveOptions {
|
|
|
1770
1770
|
endOnExit?: boolean;
|
|
1771
1771
|
}
|
|
1772
1772
|
/**
|
|
1773
|
-
* Decorator function that automatically wraps any function with
|
|
1773
|
+
* Decorator function that automatically wraps any function with ElasticDash observability.
|
|
1774
1774
|
*
|
|
1775
1775
|
* This higher-order function creates a traced version of your function that automatically
|
|
1776
1776
|
* handles observation lifecycle, input/output capture, and error tracking. It's perfect
|
|
@@ -2027,8 +2027,8 @@ declare function observe<T extends (...args: any[]) => any>(fn: T, options?: Obs
|
|
|
2027
2027
|
* If empty or falsy, generates a random trace ID.
|
|
2028
2028
|
*
|
|
2029
2029
|
* Using a seed is especially useful when trying to correlate external,
|
|
2030
|
-
* non-W3C compliant IDs with
|
|
2031
|
-
* have a method available for scoring the
|
|
2030
|
+
* non-W3C compliant IDs with ElasticDash trace IDs. This allows you to later
|
|
2031
|
+
* have a method available for scoring the ElasticDash trace given only the
|
|
2032
2032
|
* external ID by regenerating the same trace ID from the external ID.
|
|
2033
2033
|
*
|
|
2034
2034
|
* @returns A Promise that resolves to a 32-character lowercase hexadecimal string suitable for use as an OpenTelemetry trace ID.
|
|
@@ -2054,7 +2054,7 @@ declare function observe<T extends (...args: any[]) => any>(fn: T, options?: Obs
|
|
|
2054
2054
|
* }
|
|
2055
2055
|
* });
|
|
2056
2056
|
*
|
|
2057
|
-
* // Correlating external IDs with
|
|
2057
|
+
* // Correlating external IDs with ElasticDash traces
|
|
2058
2058
|
* const externalId = "ext-12345-67890";
|
|
2059
2059
|
* const traceId = await createTraceId(externalId);
|
|
2060
2060
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { OpenAiUsage } from '@elasticdash/core';
|
|
|
4
4
|
export { LangfuseOtelSpanAttributes, PropagateAttributesParams, propagateAttributes } from '@elasticdash/core';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* Types of observations that can be created in
|
|
7
|
+
* Types of observations that can be created in ElasticDash.
|
|
8
8
|
*
|
|
9
9
|
* - `span`: General-purpose observations for tracking operations, functions, or logical units of work
|
|
10
10
|
* - `generation`: Specialized observations for LLM calls with model parameters, usage, and costs
|
|
@@ -14,7 +14,7 @@ export { LangfuseOtelSpanAttributes, PropagateAttributesParams, propagateAttribu
|
|
|
14
14
|
*/
|
|
15
15
|
type LangfuseObservationType = "span" | "generation" | "event" | "embedding" | "agent" | "tool" | "chain" | "retriever" | "evaluator" | "guardrail";
|
|
16
16
|
/**
|
|
17
|
-
* Severity levels for observations in
|
|
17
|
+
* Severity levels for observations in ElasticDash.
|
|
18
18
|
*
|
|
19
19
|
* Used to categorize the importance or severity of observations:
|
|
20
20
|
* - `DEBUG`: Detailed diagnostic information
|
|
@@ -26,7 +26,7 @@ type LangfuseObservationType = "span" | "generation" | "event" | "embedding" | "
|
|
|
26
26
|
*/
|
|
27
27
|
type ObservationLevel = "DEBUG" | "DEFAULT" | "WARNING" | "ERROR";
|
|
28
28
|
/**
|
|
29
|
-
* Attributes for
|
|
29
|
+
* Attributes for ElasticDash span observations.
|
|
30
30
|
*
|
|
31
31
|
* Spans are used to track operations, functions, or logical units of work.
|
|
32
32
|
* They can contain other spans, generations, or events as children.
|
|
@@ -50,7 +50,7 @@ type LangfuseSpanAttributes = {
|
|
|
50
50
|
environment?: string;
|
|
51
51
|
};
|
|
52
52
|
/**
|
|
53
|
-
* Attributes for
|
|
53
|
+
* Attributes for ElasticDash generation observations.
|
|
54
54
|
*
|
|
55
55
|
* Generations are specialized observations for tracking LLM interactions,
|
|
56
56
|
* including model parameters, usage metrics, costs, and prompt information.
|
|
@@ -74,7 +74,7 @@ type LangfuseGenerationAttributes = LangfuseSpanAttributes & {
|
|
|
74
74
|
costDetails?: {
|
|
75
75
|
[key: string]: number;
|
|
76
76
|
};
|
|
77
|
-
/** Information about the prompt used from
|
|
77
|
+
/** Information about the prompt used from ElasticDash prompt management */
|
|
78
78
|
prompt?: {
|
|
79
79
|
/** Name of the prompt template */
|
|
80
80
|
name: string;
|
|
@@ -93,7 +93,7 @@ type LangfuseEvaluatorAttributes = LangfuseSpanAttributes;
|
|
|
93
93
|
type LangfuseGuardrailAttributes = LangfuseSpanAttributes;
|
|
94
94
|
type LangfuseEmbeddingAttributes = LangfuseGenerationAttributes;
|
|
95
95
|
/**
|
|
96
|
-
* Union type representing any
|
|
96
|
+
* Union type representing any ElasticDash observation attributes.
|
|
97
97
|
*
|
|
98
98
|
* This type is used when you need to accept any type of observation attributes.
|
|
99
99
|
*
|
|
@@ -101,7 +101,7 @@ type LangfuseEmbeddingAttributes = LangfuseGenerationAttributes;
|
|
|
101
101
|
*/
|
|
102
102
|
type LangfuseObservationAttributes = LangfuseSpanAttributes & LangfuseGenerationAttributes & LangfuseEventAttributes & LangfuseAgentAttributes & LangfuseToolAttributes & LangfuseChainAttributes & LangfuseRetrieverAttributes & LangfuseEvaluatorAttributes & LangfuseGuardrailAttributes;
|
|
103
103
|
/**
|
|
104
|
-
* Attributes for
|
|
104
|
+
* Attributes for ElasticDash traces.
|
|
105
105
|
*
|
|
106
106
|
* Traces are the top-level containers that group related observations together.
|
|
107
107
|
* They represent a complete workflow, request, or user interaction.
|
|
@@ -134,9 +134,9 @@ type LangfuseTraceAttributes = {
|
|
|
134
134
|
};
|
|
135
135
|
|
|
136
136
|
/**
|
|
137
|
-
* Union type representing any
|
|
137
|
+
* Union type representing any ElasticDash observation wrapper.
|
|
138
138
|
*
|
|
139
|
-
* This type encompasses all observation types supported by
|
|
139
|
+
* This type encompasses all observation types supported by ElasticDash, providing
|
|
140
140
|
* a unified interface for handling different kinds of traced operations. It's
|
|
141
141
|
* particularly useful for generic functions that work with any observation type.
|
|
142
142
|
*
|
|
@@ -177,7 +177,7 @@ type LangfuseTraceAttributes = {
|
|
|
177
177
|
*/
|
|
178
178
|
type LangfuseObservation = LangfuseSpan | LangfuseGeneration | LangfuseEvent | LangfuseAgent | LangfuseTool | LangfuseChain | LangfuseRetriever | LangfuseEvaluator | LangfuseGuardrail | LangfuseEmbedding;
|
|
179
179
|
/**
|
|
180
|
-
* Parameters for creating a
|
|
180
|
+
* Parameters for creating a ElasticDash observation wrapper.
|
|
181
181
|
*
|
|
182
182
|
* @internal
|
|
183
183
|
*/
|
|
@@ -187,14 +187,14 @@ type LangfuseObservationParams = {
|
|
|
187
187
|
attributes?: LangfuseSpanAttributes | LangfuseGenerationAttributes | LangfuseEventAttributes;
|
|
188
188
|
};
|
|
189
189
|
/**
|
|
190
|
-
* Base class for all
|
|
190
|
+
* Base class for all ElasticDash observation wrappers providing unified functionality.
|
|
191
191
|
*
|
|
192
|
-
* This abstract class serves as the foundation for all observation types in
|
|
192
|
+
* This abstract class serves as the foundation for all observation types in ElasticDash,
|
|
193
193
|
* encapsulating common operations and properties shared across spans, generations,
|
|
194
194
|
* events, and specialized observation types like agents, tools, and chains.
|
|
195
195
|
*
|
|
196
196
|
* ## Core Capabilities
|
|
197
|
-
* - **OpenTelemetry Integration**: Wraps OTEL spans with
|
|
197
|
+
* - **OpenTelemetry Integration**: Wraps OTEL spans with ElasticDash-specific functionality
|
|
198
198
|
* - **Unique Identification**: Provides span ID and trace ID for correlation
|
|
199
199
|
* - **Lifecycle Management**: Handles observation creation, updates, and completion
|
|
200
200
|
* - **Trace Context**: Enables updating trace-level attributes from any observation
|
|
@@ -251,7 +251,7 @@ declare abstract class LangfuseBaseObservation {
|
|
|
251
251
|
/** The trace ID from the OpenTelemetry span context */
|
|
252
252
|
traceId: string;
|
|
253
253
|
constructor(params: LangfuseObservationParams);
|
|
254
|
-
/** Gets the
|
|
254
|
+
/** Gets the ElasticDash OpenTelemetry tracer instance */
|
|
255
255
|
protected get tracer(): _opentelemetry_api.Tracer;
|
|
256
256
|
/**
|
|
257
257
|
* Ends the observation, marking it as complete.
|
|
@@ -1134,7 +1134,7 @@ declare class LangfuseGuardrail extends LangfuseBaseObservation {
|
|
|
1134
1134
|
update(attributes: LangfuseGuardrailAttributes): LangfuseGuardrail;
|
|
1135
1135
|
}
|
|
1136
1136
|
/**
|
|
1137
|
-
* Parameters for creating a
|
|
1137
|
+
* Parameters for creating a ElasticDash generation.
|
|
1138
1138
|
*
|
|
1139
1139
|
* @internal
|
|
1140
1140
|
*/
|
|
@@ -1335,7 +1335,7 @@ declare class LangfuseEmbedding extends LangfuseBaseObservation {
|
|
|
1335
1335
|
update(attributes: LangfuseEmbeddingAttributes): LangfuseEmbedding;
|
|
1336
1336
|
}
|
|
1337
1337
|
/**
|
|
1338
|
-
* Parameters for creating a
|
|
1338
|
+
* Parameters for creating a ElasticDash event.
|
|
1339
1339
|
*
|
|
1340
1340
|
* @internal
|
|
1341
1341
|
*/
|
|
@@ -1345,7 +1345,7 @@ type LangfuseEventParams = {
|
|
|
1345
1345
|
timestamp: TimeInput;
|
|
1346
1346
|
};
|
|
1347
1347
|
/**
|
|
1348
|
-
*
|
|
1348
|
+
* ElasticDash event wrapper for point-in-time observations.
|
|
1349
1349
|
*
|
|
1350
1350
|
* Events represent instantaneous occurrences or log entries within a trace.
|
|
1351
1351
|
* Unlike spans and generations, they don't have duration and are automatically
|
|
@@ -1358,12 +1358,12 @@ declare class LangfuseEvent extends LangfuseBaseObservation {
|
|
|
1358
1358
|
}
|
|
1359
1359
|
|
|
1360
1360
|
/**
|
|
1361
|
-
* Creates OpenTelemetry attributes from
|
|
1361
|
+
* Creates OpenTelemetry attributes from ElasticDash trace attributes.
|
|
1362
1362
|
*
|
|
1363
1363
|
* Converts user-friendly trace attributes into the internal OpenTelemetry
|
|
1364
1364
|
* attribute format required by the span processor.
|
|
1365
1365
|
*
|
|
1366
|
-
* @param attributes -
|
|
1366
|
+
* @param attributes - ElasticDash trace attributes to convert
|
|
1367
1367
|
* @returns OpenTelemetry attributes object with non-null values
|
|
1368
1368
|
*
|
|
1369
1369
|
* @example
|
|
@@ -1387,9 +1387,9 @@ declare function createTraceAttributes({ name, userId, sessionId, version, relea
|
|
|
1387
1387
|
declare function createObservationAttributes(type: LangfuseObservationType, attributes: LangfuseObservationAttributes): Attributes;
|
|
1388
1388
|
|
|
1389
1389
|
/**
|
|
1390
|
-
* Sets an isolated TracerProvider for
|
|
1390
|
+
* Sets an isolated TracerProvider for ElasticDash tracing operations.
|
|
1391
1391
|
*
|
|
1392
|
-
* This allows
|
|
1392
|
+
* This allows ElasticDash to use its own TracerProvider instance, separate from
|
|
1393
1393
|
* the global OpenTelemetry TracerProvider. This is useful for avoiding conflicts
|
|
1394
1394
|
* with other OpenTelemetry instrumentation in the application.
|
|
1395
1395
|
*
|
|
@@ -1432,7 +1432,7 @@ declare function createObservationAttributes(type: LangfuseObservationType, attr
|
|
|
1432
1432
|
*/
|
|
1433
1433
|
declare function setLangfuseTracerProvider(provider: TracerProvider | null): void;
|
|
1434
1434
|
/**
|
|
1435
|
-
* Gets the TracerProvider for
|
|
1435
|
+
* Gets the TracerProvider for ElasticDash tracing operations.
|
|
1436
1436
|
*
|
|
1437
1437
|
* Returns the isolated TracerProvider if one has been set via setLangfuseTracerProvider(),
|
|
1438
1438
|
* otherwise falls back to the global OpenTelemetry TracerProvider.
|
|
@@ -1445,18 +1445,18 @@ declare function setLangfuseTracerProvider(provider: TracerProvider | null): voi
|
|
|
1445
1445
|
* const tracer = provider.getTracer('my-tracer', '1.0.0');
|
|
1446
1446
|
* ```
|
|
1447
1447
|
*
|
|
1448
|
-
* @returns The TracerProvider instance to use for
|
|
1448
|
+
* @returns The TracerProvider instance to use for ElasticDash tracing
|
|
1449
1449
|
* @public
|
|
1450
1450
|
*/
|
|
1451
1451
|
declare function getLangfuseTracerProvider(): TracerProvider;
|
|
1452
1452
|
/**
|
|
1453
|
-
* Gets the OpenTelemetry tracer instance for
|
|
1453
|
+
* Gets the OpenTelemetry tracer instance for ElasticDash.
|
|
1454
1454
|
*
|
|
1455
|
-
* This function returns a tracer specifically configured for
|
|
1455
|
+
* This function returns a tracer specifically configured for ElasticDash
|
|
1456
1456
|
* with the correct tracer name and version. Used internally by all
|
|
1457
|
-
*
|
|
1457
|
+
* ElasticDash tracing functions to ensure consistent trace creation.
|
|
1458
1458
|
*
|
|
1459
|
-
* @returns The
|
|
1459
|
+
* @returns The ElasticDash OpenTelemetry tracer instance
|
|
1460
1460
|
*
|
|
1461
1461
|
* @example
|
|
1462
1462
|
* ```typescript
|
|
@@ -1596,7 +1596,7 @@ declare function updateActiveTrace(attributes: LangfuseTraceAttributes): void;
|
|
|
1596
1596
|
* Updates the currently active observation with new attributes.
|
|
1597
1597
|
*
|
|
1598
1598
|
* This function finds the currently active OpenTelemetry span in the execution context
|
|
1599
|
-
* and updates it with
|
|
1599
|
+
* and updates it with ElasticDash-specific attributes. It supports all observation types
|
|
1600
1600
|
* through TypeScript overloads, providing type safety for attributes based on the
|
|
1601
1601
|
* specified `asType` parameter. If no active span exists, the update is skipped with a warning.
|
|
1602
1602
|
*
|
|
@@ -1770,7 +1770,7 @@ interface ObserveOptions {
|
|
|
1770
1770
|
endOnExit?: boolean;
|
|
1771
1771
|
}
|
|
1772
1772
|
/**
|
|
1773
|
-
* Decorator function that automatically wraps any function with
|
|
1773
|
+
* Decorator function that automatically wraps any function with ElasticDash observability.
|
|
1774
1774
|
*
|
|
1775
1775
|
* This higher-order function creates a traced version of your function that automatically
|
|
1776
1776
|
* handles observation lifecycle, input/output capture, and error tracking. It's perfect
|
|
@@ -2027,8 +2027,8 @@ declare function observe<T extends (...args: any[]) => any>(fn: T, options?: Obs
|
|
|
2027
2027
|
* If empty or falsy, generates a random trace ID.
|
|
2028
2028
|
*
|
|
2029
2029
|
* Using a seed is especially useful when trying to correlate external,
|
|
2030
|
-
* non-W3C compliant IDs with
|
|
2031
|
-
* have a method available for scoring the
|
|
2030
|
+
* non-W3C compliant IDs with ElasticDash trace IDs. This allows you to later
|
|
2031
|
+
* have a method available for scoring the ElasticDash trace given only the
|
|
2032
2032
|
* external ID by regenerating the same trace ID from the external ID.
|
|
2033
2033
|
*
|
|
2034
2034
|
* @returns A Promise that resolves to a 32-character lowercase hexadecimal string suitable for use as an OpenTelemetry trace ID.
|
|
@@ -2054,7 +2054,7 @@ declare function observe<T extends (...args: any[]) => any>(fn: T, options?: Obs
|
|
|
2054
2054
|
* }
|
|
2055
2055
|
* });
|
|
2056
2056
|
*
|
|
2057
|
-
* // Correlating external IDs with
|
|
2057
|
+
* // Correlating external IDs with ElasticDash traces
|
|
2058
2058
|
* const externalId = "ext-12345-67890";
|
|
2059
2059
|
* const traceId = await createTraceId(externalId);
|
|
2060
2060
|
*
|
package/dist/index.mjs
CHANGED
|
@@ -112,7 +112,7 @@ import {
|
|
|
112
112
|
ELASTICDASH_TRACER_NAME
|
|
113
113
|
} from "@elasticdash/core";
|
|
114
114
|
import { trace } from "@opentelemetry/api";
|
|
115
|
-
var ELASTICDASH_GLOBAL_SYMBOL = Symbol.for("
|
|
115
|
+
var ELASTICDASH_GLOBAL_SYMBOL = Symbol.for("elasticdash");
|
|
116
116
|
function createState() {
|
|
117
117
|
return {
|
|
118
118
|
isolatedTracerProvider: null
|
|
@@ -175,7 +175,7 @@ var LangfuseBaseObservation = class {
|
|
|
175
175
|
);
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
|
-
/** Gets the
|
|
178
|
+
/** Gets the ElasticDash OpenTelemetry tracer instance */
|
|
179
179
|
get tracer() {
|
|
180
180
|
return getLangfuseTracer();
|
|
181
181
|
}
|