@tigerdata/mcp-boilerplate 0.4.0 → 0.4.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/tracing.d.ts +1 -1
- package/dist/tracing.js +6 -0
- package/package.json +1 -1
package/dist/tracing.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Span, type Tracer } from '@opentelemetry/api';
|
|
2
2
|
import type { GenerateTextResult, ModelMessage } from 'ai';
|
|
3
3
|
export declare const withSpan: <T>(tracer: Tracer, name: string, fn: (span: Span) => Promise<T>) => Promise<T>;
|
|
4
4
|
export declare const addAiResultToSpan: (span: Span, aiResult: GenerateTextResult<any, unknown>, inputMessages: ModelMessage[]) => void;
|
package/dist/tracing.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SpanStatusCode } from '@opentelemetry/api';
|
|
1
2
|
import { log } from './logger.js';
|
|
2
3
|
export const withSpan = async (tracer, name, fn) => {
|
|
3
4
|
return tracer.startActiveSpan(name, async (span) => {
|
|
@@ -6,6 +7,11 @@ export const withSpan = async (tracer, name, fn) => {
|
|
|
6
7
|
}
|
|
7
8
|
catch (error) {
|
|
8
9
|
log.error(`Error in span ${name}`, error);
|
|
10
|
+
span.recordException(error);
|
|
11
|
+
span.setStatus({
|
|
12
|
+
code: SpanStatusCode.ERROR,
|
|
13
|
+
message: error.message,
|
|
14
|
+
});
|
|
9
15
|
throw error;
|
|
10
16
|
}
|
|
11
17
|
finally {
|