@traceroot-ai/traceroot 0.1.0 → 0.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/README.md +3 -3
- package/dist/constants.d.ts +35 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +47 -2
- package/dist/constants.js.map +1 -1
- package/dist/context.d.ts +16 -2
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +55 -6
- package/dist/context.js.map +1 -1
- package/dist/git_context.d.ts.map +1 -1
- package/dist/git_context.js +11 -6
- package/dist/git_context.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/instrumentation.d.ts.map +1 -1
- package/dist/instrumentation.js.map +1 -1
- package/dist/observe.d.ts +25 -6
- package/dist/observe.d.ts.map +1 -1
- package/dist/observe.js +162 -54
- package/dist/observe.js.map +1 -1
- package/dist/traceroot.d.ts.map +1 -1
- package/dist/traceroot.js +16 -4
- package/dist/traceroot.js.map +1 -1
- package/dist/types.d.ts +21 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
[![Y Combinator][y-combinator-image]][y-combinator-url]
|
|
4
4
|
[![License][license-image]][license-url]
|
|
5
|
+
[![npm][npm-image]][npm-url]
|
|
5
6
|
[![X (Twitter)][twitter-image]][twitter-url]
|
|
6
7
|
[![Discord][discord-image]][discord-url]
|
|
7
8
|
[![Documentation][docs-image]][docs-url]
|
|
8
|
-
[![npm SDK Downloads][npm-sdk-downloads-image]][npm-sdk-downloads-url]
|
|
9
9
|
|
|
10
10
|
# Documentation
|
|
11
11
|
|
|
@@ -19,8 +19,8 @@ Please see the [TypeScript SDK Docs](https://traceroot.ai/docs/tracing/get-start
|
|
|
19
19
|
[docs-url]: https://traceroot.ai/docs/tracing/get-started
|
|
20
20
|
[license-image]: https://img.shields.io/badge/License-Apache%202.0-blue.svg
|
|
21
21
|
[license-url]: https://opensource.org/licenses/Apache-2.0
|
|
22
|
-
[npm-
|
|
23
|
-
[npm-
|
|
22
|
+
[npm-image]: https://img.shields.io/npm/v/%40traceroot-ai%2Ftraceroot?label=traceroot&labelColor=CB3837&color=555555
|
|
23
|
+
[npm-url]: https://www.npmjs.com/package/@traceroot-ai/traceroot
|
|
24
24
|
[twitter-image]: https://img.shields.io/twitter/follow/TracerootAI
|
|
25
25
|
[twitter-url]: https://x.com/TracerootAI
|
|
26
26
|
[y-combinator-image]: https://img.shields.io/badge/Combinator-S25-orange?logo=ycombinator&labelColor=white
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,3 +1,38 @@
|
|
|
1
1
|
export declare const SPAN_METADATA = "traceroot.span.metadata";
|
|
2
2
|
export declare const SPAN_TAGS = "traceroot.span.tags";
|
|
3
|
+
export declare const LLM_MODEL = "traceroot.llm.model";
|
|
4
|
+
export declare const LLM_MODEL_PARAMETERS = "traceroot.llm.model_parameters";
|
|
5
|
+
export declare const LLM_USAGE = "traceroot.llm.usage";
|
|
6
|
+
export declare const LLM_PROMPT = "traceroot.llm.prompt";
|
|
7
|
+
export declare const TRACE_METADATA = "traceroot.trace.metadata";
|
|
8
|
+
export declare const TRACE_TAGS = "traceroot.trace.tags";
|
|
9
|
+
/**
|
|
10
|
+
* All TraceRoot span attribute key constants in one object.
|
|
11
|
+
* Use these instead of hardcoding strings when setting custom span attributes.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* import { SpanAttributes } from '@traceroot-ai/traceroot';
|
|
15
|
+
* span.setAttribute(SpanAttributes.LLM_MODEL, 'gpt-4o');
|
|
16
|
+
*/
|
|
17
|
+
export declare const SpanAttributes: {
|
|
18
|
+
readonly SPAN_TYPE: "traceroot.span.type";
|
|
19
|
+
readonly SPAN_INPUT: "input.value";
|
|
20
|
+
readonly SPAN_OUTPUT: "output.value";
|
|
21
|
+
readonly SPAN_METADATA: "traceroot.span.metadata";
|
|
22
|
+
readonly SPAN_TAGS: "traceroot.span.tags";
|
|
23
|
+
readonly LLM_MODEL: "traceroot.llm.model";
|
|
24
|
+
readonly LLM_MODEL_PARAMETERS: "traceroot.llm.model_parameters";
|
|
25
|
+
readonly LLM_USAGE: "traceroot.llm.usage";
|
|
26
|
+
readonly LLM_PROMPT: "traceroot.llm.prompt";
|
|
27
|
+
readonly TRACE_USER_ID: "user.id";
|
|
28
|
+
readonly TRACE_SESSION_ID: "session.id";
|
|
29
|
+
readonly TRACE_METADATA: "traceroot.trace.metadata";
|
|
30
|
+
readonly TRACE_TAGS: "traceroot.trace.tags";
|
|
31
|
+
readonly GIT_REPO: "traceroot.git.repo";
|
|
32
|
+
readonly GIT_REF: "traceroot.git.ref";
|
|
33
|
+
readonly GIT_SOURCE_FILE: "traceroot.git.source_file";
|
|
34
|
+
readonly GIT_SOURCE_LINE: "traceroot.git.source_line";
|
|
35
|
+
readonly GIT_SOURCE_FUNCTION: "traceroot.git.source_function";
|
|
36
|
+
readonly ENVIRONMENT: "deployment.environment";
|
|
37
|
+
};
|
|
3
38
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa,4BAA4B,CAAC;AACvD,eAAO,MAAM,SAAS,wBAAwB,CAAC;AAG/C,eAAO,MAAM,SAAS,wBAAwB,CAAC;AAC/C,eAAO,MAAM,oBAAoB,mCAAmC,CAAC;AACrE,eAAO,MAAM,SAAS,wBAAwB,CAAC;AAC/C,eAAO,MAAM,UAAU,yBAAyB,CAAC;AAGjD,eAAO,MAAM,cAAc,6BAA6B,CAAC;AACzD,eAAO,MAAM,UAAU,yBAAyB,CAAC;AAEjD;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;CA6BjB,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -1,7 +1,52 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SPAN_TAGS = exports.SPAN_METADATA = void 0;
|
|
4
2
|
// src/constants.ts — TraceRoot-specific span attribute keys
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.SpanAttributes = exports.TRACE_TAGS = exports.TRACE_METADATA = exports.LLM_PROMPT = exports.LLM_USAGE = exports.LLM_MODEL_PARAMETERS = exports.LLM_MODEL = exports.SPAN_TAGS = exports.SPAN_METADATA = void 0;
|
|
5
|
+
// Span-level
|
|
5
6
|
exports.SPAN_METADATA = 'traceroot.span.metadata';
|
|
6
7
|
exports.SPAN_TAGS = 'traceroot.span.tags';
|
|
8
|
+
// LLM-specific
|
|
9
|
+
exports.LLM_MODEL = 'traceroot.llm.model';
|
|
10
|
+
exports.LLM_MODEL_PARAMETERS = 'traceroot.llm.model_parameters';
|
|
11
|
+
exports.LLM_USAGE = 'traceroot.llm.usage';
|
|
12
|
+
exports.LLM_PROMPT = 'traceroot.llm.prompt';
|
|
13
|
+
// Trace-level
|
|
14
|
+
exports.TRACE_METADATA = 'traceroot.trace.metadata';
|
|
15
|
+
exports.TRACE_TAGS = 'traceroot.trace.tags';
|
|
16
|
+
/**
|
|
17
|
+
* All TraceRoot span attribute key constants in one object.
|
|
18
|
+
* Use these instead of hardcoding strings when setting custom span attributes.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* import { SpanAttributes } from '@traceroot-ai/traceroot';
|
|
22
|
+
* span.setAttribute(SpanAttributes.LLM_MODEL, 'gpt-4o');
|
|
23
|
+
*/
|
|
24
|
+
exports.SpanAttributes = {
|
|
25
|
+
// Span-level
|
|
26
|
+
SPAN_TYPE: 'traceroot.span.type',
|
|
27
|
+
SPAN_INPUT: 'input.value', // OpenInference
|
|
28
|
+
SPAN_OUTPUT: 'output.value', // OpenInference
|
|
29
|
+
SPAN_METADATA: // OpenInference
|
|
30
|
+
exports.SPAN_METADATA,
|
|
31
|
+
SPAN_TAGS: exports.SPAN_TAGS,
|
|
32
|
+
// LLM-specific
|
|
33
|
+
LLM_MODEL: exports.LLM_MODEL,
|
|
34
|
+
LLM_MODEL_PARAMETERS: exports.LLM_MODEL_PARAMETERS,
|
|
35
|
+
LLM_USAGE: exports.LLM_USAGE,
|
|
36
|
+
LLM_PROMPT: exports.LLM_PROMPT,
|
|
37
|
+
// Trace-level
|
|
38
|
+
TRACE_USER_ID: 'user.id', // OpenInference
|
|
39
|
+
TRACE_SESSION_ID: 'session.id', // OpenInference
|
|
40
|
+
TRACE_METADATA: // OpenInference
|
|
41
|
+
exports.TRACE_METADATA,
|
|
42
|
+
TRACE_TAGS: exports.TRACE_TAGS,
|
|
43
|
+
// Git context
|
|
44
|
+
GIT_REPO: 'traceroot.git.repo',
|
|
45
|
+
GIT_REF: 'traceroot.git.ref',
|
|
46
|
+
GIT_SOURCE_FILE: 'traceroot.git.source_file',
|
|
47
|
+
GIT_SOURCE_LINE: 'traceroot.git.source_line',
|
|
48
|
+
GIT_SOURCE_FUNCTION: 'traceroot.git.source_function',
|
|
49
|
+
// Deployment
|
|
50
|
+
ENVIRONMENT: 'deployment.environment',
|
|
51
|
+
};
|
|
7
52
|
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";AAAA,4DAA4D;;;AAE5D,aAAa;AACA,QAAA,aAAa,GAAG,yBAAyB,CAAC;AAC1C,QAAA,SAAS,GAAG,qBAAqB,CAAC;AAE/C,eAAe;AACF,QAAA,SAAS,GAAG,qBAAqB,CAAC;AAClC,QAAA,oBAAoB,GAAG,gCAAgC,CAAC;AACxD,QAAA,SAAS,GAAG,qBAAqB,CAAC;AAClC,QAAA,UAAU,GAAG,sBAAsB,CAAC;AAEjD,cAAc;AACD,QAAA,cAAc,GAAG,0BAA0B,CAAC;AAC5C,QAAA,UAAU,GAAG,sBAAsB,CAAC;AAEjD;;;;;;;GAOG;AACU,QAAA,cAAc,GAAG;IAC5B,aAAa;IACb,SAAS,EAAE,qBAAqB;IAChC,UAAU,EAAE,aAAa,EAAE,gBAAgB;IAC3C,WAAW,EAAE,cAAc,EAAE,gBAAgB;IAC7C,aAAa,EADgB,gBAAgB;IAC7C,qBAAa;IACb,SAAS,EAAT,iBAAS;IAET,eAAe;IACf,SAAS,EAAT,iBAAS;IACT,oBAAoB,EAApB,4BAAoB;IACpB,SAAS,EAAT,iBAAS;IACT,UAAU,EAAV,kBAAU;IAEV,cAAc;IACd,aAAa,EAAE,SAAS,EAAE,gBAAgB;IAC1C,gBAAgB,EAAE,YAAY,EAAE,gBAAgB;IAChD,cAAc,EADkB,gBAAgB;IAChD,sBAAc;IACd,UAAU,EAAV,kBAAU;IAEV,cAAc;IACd,QAAQ,EAAE,oBAAoB;IAC9B,OAAO,EAAE,mBAAmB;IAC5B,eAAe,EAAE,2BAA2B;IAC5C,eAAe,EAAE,2BAA2B;IAC5C,mBAAmB,EAAE,+BAA+B;IAEpD,aAAa;IACb,WAAW,EAAE,wBAAwB;CAC7B,CAAC"}
|
package/dist/context.d.ts
CHANGED
|
@@ -1,20 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Sets
|
|
2
|
+
* Sets attributes on the currently active span.
|
|
3
3
|
* No-op when called outside an active span.
|
|
4
|
+
*
|
|
5
|
+
* LLM-specific attributes (model, modelParameters, usage, prompt) are useful
|
|
6
|
+
* for instrumenting custom or unsupported LLM providers.
|
|
4
7
|
*/
|
|
5
8
|
export declare function updateCurrentSpan(attrs: {
|
|
6
9
|
input?: unknown;
|
|
7
10
|
output?: unknown;
|
|
8
11
|
metadata?: Record<string, unknown>;
|
|
12
|
+
/** Rename the span after creation. */
|
|
13
|
+
name?: string;
|
|
14
|
+
/** LLM model name (e.g. 'gpt-4o', 'claude-3-opus'). */
|
|
15
|
+
model?: string;
|
|
16
|
+
/** LLM model parameters (e.g. { temperature: 0.7, max_tokens: 1024 }). */
|
|
17
|
+
modelParameters?: Record<string, unknown>;
|
|
18
|
+
/** Token usage (e.g. { inputTokens: 100, outputTokens: 50 }). */
|
|
19
|
+
usage?: Record<string, number>;
|
|
20
|
+
/** Prompt / messages sent to the LLM. */
|
|
21
|
+
prompt?: unknown;
|
|
9
22
|
}): void;
|
|
10
23
|
/**
|
|
11
|
-
* Sets trace-level association attributes (user, session, tags) on the
|
|
24
|
+
* Sets trace-level association attributes (user, session, tags, metadata) on the
|
|
12
25
|
* currently active span. No-op when called outside an active span.
|
|
13
26
|
*/
|
|
14
27
|
export declare function updateCurrentTrace(attrs: {
|
|
15
28
|
userId?: string;
|
|
16
29
|
sessionId?: string;
|
|
17
30
|
tags?: string[];
|
|
31
|
+
metadata?: Record<string, unknown>;
|
|
18
32
|
}): void;
|
|
19
33
|
/**
|
|
20
34
|
* Returns the trace ID of the currently active span, or undefined if no span is active.
|
package/dist/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAkBA;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE;IACvC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,sCAAsC;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,iEAAiE;IACjE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,yCAAyC;IACzC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,GAAG,IAAI,CAoDP;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE;IACxC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,GAAG,IAAI,CAwBP;AAOD;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,GAAG,SAAS,CAEtD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,SAAS,CAErD"}
|
package/dist/context.js
CHANGED
|
@@ -9,34 +9,73 @@ const api_1 = require("@opentelemetry/api");
|
|
|
9
9
|
const openinference_semantic_conventions_1 = require("@arizeai/openinference-semantic-conventions");
|
|
10
10
|
const constants_1 = require("./constants");
|
|
11
11
|
/**
|
|
12
|
-
* Sets
|
|
12
|
+
* Sets attributes on the currently active span.
|
|
13
13
|
* No-op when called outside an active span.
|
|
14
|
+
*
|
|
15
|
+
* LLM-specific attributes (model, modelParameters, usage, prompt) are useful
|
|
16
|
+
* for instrumenting custom or unsupported LLM providers.
|
|
14
17
|
*/
|
|
15
18
|
function updateCurrentSpan(attrs) {
|
|
16
19
|
const span = api_1.trace.getActiveSpan();
|
|
17
20
|
if (!span)
|
|
18
21
|
return;
|
|
22
|
+
if (attrs.name !== undefined) {
|
|
23
|
+
span.updateName(attrs.name);
|
|
24
|
+
}
|
|
19
25
|
if (attrs.input !== undefined) {
|
|
20
26
|
try {
|
|
21
27
|
span.setAttribute(openinference_semantic_conventions_1.INPUT_VALUE, JSON.stringify(attrs.input));
|
|
22
28
|
}
|
|
23
|
-
catch {
|
|
29
|
+
catch {
|
|
30
|
+
/* non-serializable */
|
|
31
|
+
}
|
|
24
32
|
}
|
|
25
33
|
if (attrs.output !== undefined) {
|
|
26
34
|
try {
|
|
27
35
|
span.setAttribute(openinference_semantic_conventions_1.OUTPUT_VALUE, JSON.stringify(attrs.output));
|
|
28
36
|
}
|
|
29
|
-
catch {
|
|
37
|
+
catch {
|
|
38
|
+
/* non-serializable */
|
|
39
|
+
}
|
|
30
40
|
}
|
|
31
41
|
if (attrs.metadata !== undefined) {
|
|
32
42
|
try {
|
|
33
43
|
span.setAttribute(constants_1.SPAN_METADATA, JSON.stringify(attrs.metadata));
|
|
34
44
|
}
|
|
35
|
-
catch {
|
|
45
|
+
catch {
|
|
46
|
+
/* non-serializable */
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (attrs.model !== undefined) {
|
|
50
|
+
span.setAttribute(constants_1.LLM_MODEL, attrs.model);
|
|
51
|
+
}
|
|
52
|
+
if (attrs.modelParameters !== undefined) {
|
|
53
|
+
try {
|
|
54
|
+
span.setAttribute(constants_1.LLM_MODEL_PARAMETERS, JSON.stringify(attrs.modelParameters));
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
/* non-serializable */
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (attrs.usage !== undefined) {
|
|
61
|
+
try {
|
|
62
|
+
span.setAttribute(constants_1.LLM_USAGE, JSON.stringify(attrs.usage));
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
/* non-serializable */
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (attrs.prompt !== undefined) {
|
|
69
|
+
try {
|
|
70
|
+
span.setAttribute(constants_1.LLM_PROMPT, JSON.stringify(attrs.prompt));
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
/* non-serializable */
|
|
74
|
+
}
|
|
36
75
|
}
|
|
37
76
|
}
|
|
38
77
|
/**
|
|
39
|
-
* Sets trace-level association attributes (user, session, tags) on the
|
|
78
|
+
* Sets trace-level association attributes (user, session, tags, metadata) on the
|
|
40
79
|
* currently active span. No-op when called outside an active span.
|
|
41
80
|
*/
|
|
42
81
|
function updateCurrentTrace(attrs) {
|
|
@@ -53,7 +92,17 @@ function updateCurrentTrace(attrs) {
|
|
|
53
92
|
try {
|
|
54
93
|
span.setAttribute(constants_1.SPAN_TAGS, JSON.stringify(attrs.tags));
|
|
55
94
|
}
|
|
56
|
-
catch {
|
|
95
|
+
catch {
|
|
96
|
+
/* non-serializable */
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (attrs.metadata !== undefined) {
|
|
100
|
+
try {
|
|
101
|
+
span.setAttribute(constants_1.TRACE_METADATA, JSON.stringify(attrs.metadata));
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
/* non-serializable */
|
|
105
|
+
}
|
|
57
106
|
}
|
|
58
107
|
}
|
|
59
108
|
function activeSpanContext() {
|
package/dist/context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":";;AAyBA,8CAkEC;AAMD,gDA6BC;AAUD,8CAEC;AAKD,4CAEC;AAjJD,iBAAiB;AACjB,4CAA2C;AAC3C,oGAKqD;AACrD,2CAQqB;AAErB;;;;;;GAMG;AACH,SAAgB,iBAAiB,CAAC,KAcjC;IACC,MAAM,IAAI,GAAG,WAAK,CAAC,aAAa,EAAE,CAAC;IACnC,IAAI,CAAC,IAAI;QAAE,OAAO;IAElB,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,EA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AAC,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;QACpE,CAAC;QAAC,MAAM,CAAC;YACP,sBAAsB;QACxB,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,iBAAiB;IACxB,MAAM,IAAI,GAAG,WAAK,CAAC,aAAa,EAAE,CAAC;IACnC,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AAC/C,CAAC;AAED;;GAEG;AACH,SAAgB,iBAAiB;IAC/B,OAAO,iBAAiB,EAAE,EAAE,OAAO,CAAC;AACtC,CAAC;AAED;;GAEG;AACH,SAAgB,gBAAgB;IAC9B,OAAO,iBAAiB,EAAE,EAAE,MAAM,CAAC;AACrC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git_context.d.ts","sourceRoot":"","sources":["../src/git_context.ts"],"names":[],"mappings":"AAKA,wBAAgB,UAAU,IAAI,MAAM,GAAG,SAAS,CAW/C;AAWD;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"git_context.d.ts","sourceRoot":"","sources":["../src/git_context.ts"],"names":[],"mappings":"AAKA,wBAAgB,UAAU,IAAI,MAAM,GAAG,SAAS,CAW/C;AAWD;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAiC5E;AAED,sDAAsD;AACtD,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,CAsB/F"}
|
package/dist/git_context.js
CHANGED
|
@@ -47,14 +47,19 @@ function autoDetectGitContext() {
|
|
|
47
47
|
gitRepo = match[1].replace(/\/$/, '');
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
catch {
|
|
50
|
+
catch {
|
|
51
|
+
/* git unavailable */
|
|
52
|
+
}
|
|
51
53
|
try {
|
|
52
|
-
gitRef =
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
gitRef =
|
|
55
|
+
(0, node_child_process_1.execSync)('git rev-parse HEAD', {
|
|
56
|
+
encoding: 'utf8',
|
|
57
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
58
|
+
}).trim() || undefined;
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
/* git unavailable */
|
|
56
62
|
}
|
|
57
|
-
catch { /* git unavailable */ }
|
|
58
63
|
// Warm the git root cache now so the first observe() call doesn't shell out.
|
|
59
64
|
getGitRoot();
|
|
60
65
|
return { gitRepo, gitRef };
|
package/dist/git_context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git_context.js","sourceRoot":"","sources":["../src/git_context.ts"],"names":[],"mappings":";;AAKA,gCAWC;AAeD,
|
|
1
|
+
{"version":3,"file":"git_context.js","sourceRoot":"","sources":["../src/git_context.ts"],"names":[],"mappings":";;AAKA,gCAWC;AAeD,oDAiCC;AAGD,sDAEC;AAMD,sDAsBC;AAjGD,qBAAqB;AACrB,2DAA8C;AAE9C,IAAI,aAAa,GAAkB,IAAI,CAAC,CAAC,uCAAuC;AAEhF,SAAgB,UAAU;IACxB,IAAI,aAAa,KAAK,IAAI;QAAE,OAAO,aAAa,IAAI,SAAS,CAAC;IAC9D,IAAI,CAAC;QACH,aAAa,GAAG,IAAA,6BAAQ,EAAC,+BAA+B,EAAE;YACxD,QAAQ,EAAE,MAAM;YAChB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;SAChC,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|
export { observe } from './observe';
|
|
3
|
-
export { updateCurrentSpan, updateCurrentTrace, getCurrentTraceId, getCurrentSpanId } from './context';
|
|
3
|
+
export { updateCurrentSpan, updateCurrentTrace, getCurrentTraceId, getCurrentSpanId, } from './context';
|
|
4
4
|
export { usingAttributes } from './usingAttributes';
|
|
5
|
+
export { SpanAttributes } from './constants';
|
|
5
6
|
export type { SpanType, ObserveOptions, InitializeOptions } from './types';
|
|
6
7
|
export type { UsingAttributesOptions } from './usingAttributes';
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC3E,YAAY,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.usingAttributes = exports.getCurrentSpanId = exports.getCurrentTraceId = exports.updateCurrentTrace = exports.updateCurrentSpan = exports.observe = exports.TraceRoot = void 0;
|
|
3
|
+
exports.SpanAttributes = exports.usingAttributes = exports.getCurrentSpanId = exports.getCurrentTraceId = exports.updateCurrentTrace = exports.updateCurrentSpan = exports.observe = exports.TraceRoot = void 0;
|
|
4
4
|
// src/index.ts
|
|
5
5
|
var traceroot_1 = require("./traceroot");
|
|
6
6
|
Object.defineProperty(exports, "TraceRoot", { enumerable: true, get: function () { return traceroot_1.TraceRoot; } });
|
|
@@ -13,4 +13,6 @@ Object.defineProperty(exports, "getCurrentTraceId", { enumerable: true, get: fun
|
|
|
13
13
|
Object.defineProperty(exports, "getCurrentSpanId", { enumerable: true, get: function () { return context_1.getCurrentSpanId; } });
|
|
14
14
|
var usingAttributes_1 = require("./usingAttributes");
|
|
15
15
|
Object.defineProperty(exports, "usingAttributes", { enumerable: true, get: function () { return usingAttributes_1.usingAttributes; } });
|
|
16
|
+
var constants_1 = require("./constants");
|
|
17
|
+
Object.defineProperty(exports, "SpanAttributes", { enumerable: true, get: function () { return constants_1.SpanAttributes; } });
|
|
16
18
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,eAAe;AACf,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,eAAe;AACf,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,qCAKmB;AAJjB,4GAAA,iBAAiB,OAAA;AACjB,6GAAA,kBAAkB,OAAA;AAClB,4GAAA,iBAAiB,OAAA;AACjB,2GAAA,gBAAgB,OAAA;AAElB,qDAAoD;AAA3C,kHAAA,eAAe,OAAA;AACxB,yCAA6C;AAApC,2GAAA,cAAc,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.d.ts","sourceRoot":"","sources":["../src/instrumentation.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"instrumentation.d.ts","sourceRoot":"","sources":["../src/instrumentation.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,iBAAiB,EAAE,iBAAiB,CAAC,mBAAmB,CAAC,GACxD,IAAI,CAsDN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../src/instrumentation.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../src/instrumentation.ts"],"names":[],"mappings":";;AAkBA,oDAwDC;AA1ED,yBAAyB;AACzB,oEAA0E;AAC1E,8GAA4F;AAC5F,0GAAwF;AACxF,4HAAwG;AACxG,8GAA4F;AAC5F,wGAAsF;AAGtF;;;;;;;;GAQG;AACH,SAAgB,oBAAoB,CAClC,iBAAyD;IAEzD,IAAI,iBAAiB,KAAK,SAAS,EAAE,CAAC;QACpC,6DAA6D;QAC7D,4CAA4C;QAC5C,IAAA,0CAAwB,EAAC;YACvB,gBAAgB,EAAE;gBAChB,IAAI,4DAAqB,EAAE;gBAC3B,IAAI,kEAAwB,EAAE;gBAC9B,IAAI,kEAAwB,EAAE;gBAC9B,IAAI,8EAA6B,EAAE;gBACnC,IAAI,8DAAsB,EAAE;aAC7B;SACF,CAAC,CAAC;QACH,OAAO;IACT,CAAC;IAED,MAAM,MAAM,GAMN,EAAE,CAAC;IAET,IAAI,iBAAiB,CAAC,MAAM,EAAE,CAAC;QAC7B,MAAM,KAAK,GAAG,IAAI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 -1,13 +1,32 @@
|
|
|
1
1
|
import { ObserveOptions } from './types';
|
|
2
2
|
/**
|
|
3
|
-
* Wraps fn() in an OpenTelemetry span, capturing input
|
|
4
|
-
*
|
|
5
|
-
* via AsyncLocalStorage context propagation.
|
|
3
|
+
* Wraps fn(...args) in an OpenTelemetry span, auto-capturing arguments as input
|
|
4
|
+
* and the return value as output using OpenInference semconv.
|
|
6
5
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* API: observe(options, fn, ...args)
|
|
7
|
+
* - Input is auto-captured from args (single arg → direct value, multiple → array).
|
|
8
|
+
* Pass captureInput: false to suppress.
|
|
9
|
+
* - Output is auto-captured from the return value (pass captureOutput: false to suppress).
|
|
10
|
+
* - If fn is an async generator function, the span stays open until the generator is
|
|
11
|
+
* exhausted and all yielded items are collected as output.
|
|
12
|
+
* - Nested calls automatically become child spans via AsyncLocalStorage context propagation.
|
|
13
|
+
* - Works as a no-op if TraceRoot is not initialized. Auto-initializes if TRACEROOT_API_KEY is set.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* // Auto-capture args as input, return value as output:
|
|
17
|
+
* const result = await observe({ name: 'search', type: 'tool' }, search, query, k);
|
|
18
|
+
*
|
|
19
|
+
* // Zero-arg thunk (backward compat — no input captured):
|
|
20
|
+
* const result = await observe({ name: 'work' }, async () => doWork());
|
|
21
|
+
*
|
|
22
|
+
* // Suppress PII input or large output:
|
|
23
|
+
* await observe({ name: 'handle', captureInput: false, captureOutput: false }, fn, arg);
|
|
24
|
+
*
|
|
25
|
+
* // Associate with a session/user:
|
|
26
|
+
* await observe({ name: 'chat', sessionId: 'sess-123', userId: 'user-abc' }, handler, msg);
|
|
9
27
|
*/
|
|
10
|
-
export declare function observe<T>(options: ObserveOptions, fn: () => T
|
|
28
|
+
export declare function observe<A extends unknown[], T>(options: ObserveOptions, fn: (...args: A) => AsyncGenerator<T>, ...args: A): AsyncGenerator<T>;
|
|
29
|
+
export declare function observe<A extends unknown[], T>(options: ObserveOptions, fn: (...args: A) => T | Promise<T>, ...args: A): Promise<T>;
|
|
11
30
|
/** @internal — reset module state between tests */
|
|
12
31
|
export declare function _resetObserveState(): void;
|
|
13
32
|
//# sourceMappingURL=observe.d.ts.map
|
package/dist/observe.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observe.d.ts","sourceRoot":"","sources":["../src/observe.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"observe.d.ts","sourceRoot":"","sources":["../src/observe.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,cAAc,EAAY,MAAM,SAAS,CAAC;AAiCnD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,wBAAgB,OAAO,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,CAAC,EAC5C,OAAO,EAAE,cAAc,EACvB,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,cAAc,CAAC,CAAC,CAAC,EACrC,GAAG,IAAI,EAAE,CAAC,GACT,cAAc,CAAC,CAAC,CAAC,CAAC;AAGrB,wBAAgB,OAAO,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,CAAC,EAC5C,OAAO,EAAE,cAAc,EACvB,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAClC,GAAG,IAAI,EAAE,CAAC,GACT,OAAO,CAAC,CAAC,CAAC,CAAC;AAoKd,mDAAmD;AACnD,wBAAgB,kBAAkB,IAAI,IAAI,CAGzC"}
|
package/dist/observe.js
CHANGED
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.observe = observe;
|
|
4
37
|
exports._resetObserveState = _resetObserveState;
|
|
@@ -18,75 +51,58 @@ const SPAN_KIND_MAP = {
|
|
|
18
51
|
// Cached once after the first call; the tracer name never changes.
|
|
19
52
|
let _tracer;
|
|
20
53
|
let _hasWarnedUninit = false;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
54
|
+
const AsyncGeneratorFunction = Object.getPrototypeOf(async function* () { })
|
|
55
|
+
.constructor;
|
|
56
|
+
/** Returns true if fn is declared as `async function*` — without calling it. */
|
|
57
|
+
function isAsyncGeneratorFunction(fn) {
|
|
58
|
+
return typeof fn === 'function' && fn instanceof AsyncGeneratorFunction;
|
|
59
|
+
}
|
|
60
|
+
/** Serialize a value for a span attribute, returning undefined on failure. */
|
|
61
|
+
function trySerialize(value) {
|
|
62
|
+
try {
|
|
63
|
+
return JSON.stringify(value);
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
// Implementation
|
|
70
|
+
function observe(options, fn, ...args) {
|
|
30
71
|
const name = options.name ?? (fn.name || 'anonymous');
|
|
31
72
|
_tracer ??= api_1.trace.getTracer('traceroot-ts');
|
|
73
|
+
if (isAsyncGeneratorFunction(fn)) {
|
|
74
|
+
return _observeAsyncGenerator(name, options, fn, args);
|
|
75
|
+
}
|
|
76
|
+
return _observeRegular(name, options, fn, args);
|
|
77
|
+
}
|
|
78
|
+
/** Handle a regular (non-generator) function. fn is called inside the span. */
|
|
79
|
+
async function _observeRegular(name, options, fn, args) {
|
|
80
|
+
if (process.env['TRACEROOT_API_KEY']) {
|
|
81
|
+
const { TraceRoot } = await Promise.resolve().then(() => __importStar(require('./traceroot')));
|
|
82
|
+
if (!TraceRoot.isInitialized())
|
|
83
|
+
TraceRoot.initialize();
|
|
84
|
+
}
|
|
85
|
+
_tracer ??= api_1.trace.getTracer('traceroot-ts');
|
|
32
86
|
return _tracer.startActiveSpan(name, async (span) => {
|
|
33
87
|
if (!span.isRecording()) {
|
|
34
88
|
if (!_hasWarnedUninit) {
|
|
35
89
|
_hasWarnedUninit = true;
|
|
36
90
|
console.warn('[TraceRoot] observe() called but TraceRoot.initialize() was not called. Spans will not be recorded.');
|
|
37
91
|
}
|
|
38
|
-
// No-op path: just run fn() and return.
|
|
39
92
|
try {
|
|
40
|
-
return await fn();
|
|
93
|
+
return await fn(...args);
|
|
41
94
|
}
|
|
42
95
|
finally {
|
|
43
96
|
span.end();
|
|
44
97
|
}
|
|
45
98
|
}
|
|
46
99
|
try {
|
|
47
|
-
span
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if (options.input !== undefined) {
|
|
54
|
-
try {
|
|
55
|
-
span.setAttribute(openinference_semantic_conventions_1.INPUT_VALUE, JSON.stringify(options.input));
|
|
56
|
-
}
|
|
57
|
-
catch {
|
|
58
|
-
// Non-serializable input — skip attribute
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
if (options.metadata !== undefined) {
|
|
62
|
-
try {
|
|
63
|
-
span.setAttribute(constants_1.SPAN_METADATA, JSON.stringify(options.metadata));
|
|
64
|
-
}
|
|
65
|
-
catch {
|
|
66
|
-
// Non-serializable metadata — skip
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
if (options.tags !== undefined) {
|
|
70
|
-
try {
|
|
71
|
-
span.setAttribute(constants_1.SPAN_TAGS, JSON.stringify(options.tags));
|
|
72
|
-
}
|
|
73
|
-
catch {
|
|
74
|
-
// Non-serializable tags — skip
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
const loc = (0, git_context_1.captureSourceLocation)();
|
|
78
|
-
if (loc.file !== undefined)
|
|
79
|
-
span.setAttribute('traceroot.git.source_file', loc.file);
|
|
80
|
-
if (loc.line !== undefined)
|
|
81
|
-
span.setAttribute('traceroot.git.source_line', loc.line);
|
|
82
|
-
if (loc.functionName !== undefined)
|
|
83
|
-
span.setAttribute('traceroot.git.source_function', loc.functionName);
|
|
84
|
-
const result = await fn();
|
|
85
|
-
try {
|
|
86
|
-
span.setAttribute(openinference_semantic_conventions_1.OUTPUT_VALUE, JSON.stringify(result));
|
|
87
|
-
}
|
|
88
|
-
catch {
|
|
89
|
-
// Non-serializable output — skip attribute
|
|
100
|
+
_applyCommonAttributes(span, options, args);
|
|
101
|
+
const result = await fn(...args);
|
|
102
|
+
if (options.captureOutput !== false) {
|
|
103
|
+
const serialized = trySerialize(result);
|
|
104
|
+
if (serialized !== undefined)
|
|
105
|
+
span.setAttribute(openinference_semantic_conventions_1.OUTPUT_VALUE, serialized);
|
|
90
106
|
}
|
|
91
107
|
return result;
|
|
92
108
|
}
|
|
@@ -100,6 +116,98 @@ async function observe(options, fn) {
|
|
|
100
116
|
}
|
|
101
117
|
});
|
|
102
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* Handle an async generator fn: manually manage the span so it stays open
|
|
121
|
+
* across yields. Returns an AsyncGenerator the caller can iterate.
|
|
122
|
+
*/
|
|
123
|
+
async function* _observeAsyncGenerator(name, options, fn, args) {
|
|
124
|
+
if (process.env['TRACEROOT_API_KEY']) {
|
|
125
|
+
const { TraceRoot } = await Promise.resolve().then(() => __importStar(require('./traceroot')));
|
|
126
|
+
if (!TraceRoot.isInitialized())
|
|
127
|
+
TraceRoot.initialize();
|
|
128
|
+
}
|
|
129
|
+
_tracer ??= api_1.trace.getTracer('traceroot-ts');
|
|
130
|
+
const span = _tracer.startSpan(name);
|
|
131
|
+
if (!span.isRecording()) {
|
|
132
|
+
if (!_hasWarnedUninit) {
|
|
133
|
+
_hasWarnedUninit = true;
|
|
134
|
+
console.warn('[TraceRoot] observe() called but TraceRoot.initialize() was not called. Spans will not be recorded.');
|
|
135
|
+
}
|
|
136
|
+
yield* fn(...args);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
_applyCommonAttributes(span, options, args);
|
|
140
|
+
// Activate the span in the OTel context so that updateCurrentSpan() and
|
|
141
|
+
// nested observe() calls inside the generator body target the correct span.
|
|
142
|
+
// We must wrap each .next() call in context.with() because AsyncLocalStorage
|
|
143
|
+
// does not preserve context across generator yield boundaries when resumed
|
|
144
|
+
// from outside the original run scope.
|
|
145
|
+
const spanCtx = api_1.trace.setSpan(api_1.context.active(), span);
|
|
146
|
+
const innerGen = fn(...args);
|
|
147
|
+
const collected = [];
|
|
148
|
+
try {
|
|
149
|
+
while (true) {
|
|
150
|
+
const { value, done } = await api_1.context.with(spanCtx, () => innerGen.next());
|
|
151
|
+
if (done)
|
|
152
|
+
break;
|
|
153
|
+
collected.push(value);
|
|
154
|
+
yield value;
|
|
155
|
+
}
|
|
156
|
+
if (options.captureOutput !== false && collected.length > 0) {
|
|
157
|
+
const serialized = trySerialize(collected);
|
|
158
|
+
if (serialized !== undefined)
|
|
159
|
+
span.setAttribute(openinference_semantic_conventions_1.OUTPUT_VALUE, serialized);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
catch (err) {
|
|
163
|
+
span.recordException(err instanceof Error ? err : new Error(String(err)));
|
|
164
|
+
span.setStatus({ code: api_1.SpanStatusCode.ERROR });
|
|
165
|
+
throw err;
|
|
166
|
+
}
|
|
167
|
+
finally {
|
|
168
|
+
span.end();
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Apply attributes common to all span types: kind, ambient context, session/user,
|
|
173
|
+
* input from args, metadata, tags, git source location.
|
|
174
|
+
*/
|
|
175
|
+
function _applyCommonAttributes(span, options, args) {
|
|
176
|
+
span.setAttribute(OPENINFERENCE_SPAN_KIND, SPAN_KIND_MAP[options.type ?? 'span']);
|
|
177
|
+
// Propagate any ambient attributes set by usingAttributes() in the call stack.
|
|
178
|
+
const ctxAttrs = (0, openinference_core_1.getAttributesFromContext)(api_1.context.active());
|
|
179
|
+
if (ctxAttrs && Object.keys(ctxAttrs).length > 0) {
|
|
180
|
+
span.setAttributes(ctxAttrs);
|
|
181
|
+
}
|
|
182
|
+
if (options.sessionId !== undefined)
|
|
183
|
+
span.setAttribute(openinference_semantic_conventions_1.SESSION_ID, options.sessionId);
|
|
184
|
+
if (options.userId !== undefined)
|
|
185
|
+
span.setAttribute(openinference_semantic_conventions_1.USER_ID, options.userId);
|
|
186
|
+
// Auto-capture input from args. Single arg → use directly; multiple → array.
|
|
187
|
+
if (options.captureInput !== false && args.length > 0) {
|
|
188
|
+
const inputValue = args.length === 1 ? args[0] : args;
|
|
189
|
+
const serialized = trySerialize(inputValue);
|
|
190
|
+
if (serialized !== undefined)
|
|
191
|
+
span.setAttribute(openinference_semantic_conventions_1.INPUT_VALUE, serialized);
|
|
192
|
+
}
|
|
193
|
+
if (options.metadata !== undefined) {
|
|
194
|
+
const s = trySerialize(options.metadata);
|
|
195
|
+
if (s !== undefined)
|
|
196
|
+
span.setAttribute(constants_1.SPAN_METADATA, s);
|
|
197
|
+
}
|
|
198
|
+
if (options.tags !== undefined) {
|
|
199
|
+
const s = trySerialize(options.tags);
|
|
200
|
+
if (s !== undefined)
|
|
201
|
+
span.setAttribute(constants_1.SPAN_TAGS, s);
|
|
202
|
+
}
|
|
203
|
+
const loc = (0, git_context_1.captureSourceLocation)();
|
|
204
|
+
if (loc.file !== undefined)
|
|
205
|
+
span.setAttribute('traceroot.git.source_file', loc.file);
|
|
206
|
+
if (loc.line !== undefined)
|
|
207
|
+
span.setAttribute('traceroot.git.source_line', loc.line);
|
|
208
|
+
if (loc.functionName !== undefined)
|
|
209
|
+
span.setAttribute('traceroot.git.source_function', loc.functionName);
|
|
210
|
+
}
|
|
103
211
|
/** @internal — reset module state between tests */
|
|
104
212
|
function _resetObserveState() {
|
|
105
213
|
_tracer = undefined;
|
package/dist/observe.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observe.js","sourceRoot":"","sources":["../src/observe.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"observe.js","sourceRoot":"","sources":["../src/observe.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqFA,0BAaC;AAqJD,gDAGC;AA1PD,iBAAiB;AACjB,4CAA0E;AAC1E,oEAAuE;AACvE,oGAMqD;AACrD,2CAAuD;AAEvD,+CAAsD;AAEtD,MAAM,uBAAuB,GAAG,wDAAmB,CAAC,uBAAuB,CAAC;AAE5E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AC,CAAC,CAAC;IACvD,CAAC;IAED,MAAM,GAAG,GAAG,IAAA,mCAAqB,GAAE,CAAC;IACpC,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS;QAAE,IAAI,CAAC,YAAY,CAAC,2BAA2B,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;IACrF,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS;QAAE,IAAI,CAAC,YAAY,CAAC,2BAA2B,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;IACrF,IAAI,GAAG,CAAC,YAAY,KAAK,SAAS;QAChC,IAAI,CAAC,YAAY,CAAC,+BAA+B,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC;AACzE,CAAC;AAED,mDAAmD;AACnD,SAAgB,kBAAkB;IAChC,OAAO,GAAG,SAAS,CAAC;IACpB,gBAAgB,GAAG,KAAK,CAAC;AAC3B,CAAC"}
|
package/dist/traceroot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"traceroot.d.ts","sourceRoot":"","sources":["../src/traceroot.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"traceroot.d.ts","sourceRoot":"","sources":["../src/traceroot.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAW5C,qBAAa,SAAS;IACpB,OAAO;IAEP,MAAM,CAAC,aAAa,IAAI,OAAO;IAI/B,MAAM,CAAC,UAAU,CAAC,OAAO,GAAE,iBAAsB,GAAG,IAAI;WA4F3C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;WAItB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAMvC;AAED,gBAAgB;AAChB,wBAAgB,gBAAgB,IAAI,IAAI,CAQvC"}
|
package/dist/traceroot.js
CHANGED
|
@@ -20,7 +20,7 @@ class TraceRoot {
|
|
|
20
20
|
return _isInitialized;
|
|
21
21
|
}
|
|
22
22
|
static initialize(options = {}) {
|
|
23
|
-
const enabled = options.enabled ??
|
|
23
|
+
const enabled = options.enabled ?? process.env['TRACEROOT_ENABLED'] !== 'false';
|
|
24
24
|
if (!enabled) {
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
@@ -40,7 +40,9 @@ class TraceRoot {
|
|
|
40
40
|
error: api_1.DiagLogLevel.ERROR,
|
|
41
41
|
};
|
|
42
42
|
api_1.diag.setLogger(new api_1.DiagConsoleLogger(), logLevelMap[options.logLevel ?? 'error'] ?? api_1.DiagLogLevel.ERROR);
|
|
43
|
-
const baseUrl = (options.baseUrl ??
|
|
43
|
+
const baseUrl = (options.baseUrl ??
|
|
44
|
+
process.env['TRACEROOT_HOST_URL'] ??
|
|
45
|
+
DEFAULT_BASE_URL).replace(/\/$/, '');
|
|
44
46
|
const headers = {
|
|
45
47
|
'x-traceroot-sdk-name': processor_1.SDK_NAME,
|
|
46
48
|
'x-traceroot-sdk-version': processor_1.SDK_VERSION,
|
|
@@ -67,9 +69,17 @@ class TraceRoot {
|
|
|
67
69
|
else {
|
|
68
70
|
(0, git_context_1.getGitRoot)(); // warm git root cache for captureSourceLocation without shelling out for repo/ref
|
|
69
71
|
}
|
|
72
|
+
// Flush/batch tuning — env vars take precedence over hardcoded defaults.
|
|
73
|
+
const flushIntervalSec = Number(process.env['TRACEROOT_FLUSH_INTERVAL'] || '5');
|
|
74
|
+
const flushAt = Number(process.env['TRACEROOT_FLUSH_AT'] || '100');
|
|
75
|
+
const timeoutSec = Number(process.env['TRACEROOT_TIMEOUT'] || '30');
|
|
70
76
|
const innerProcessor = options.disableBatch
|
|
71
77
|
? new sdk_trace_base_1.SimpleSpanProcessor(exporter)
|
|
72
|
-
: new sdk_trace_base_1.BatchSpanProcessor(exporter
|
|
78
|
+
: new sdk_trace_base_1.BatchSpanProcessor(exporter, {
|
|
79
|
+
scheduledDelayMillis: flushIntervalSec * 1000,
|
|
80
|
+
maxExportBatchSize: flushAt,
|
|
81
|
+
exportTimeoutMillis: timeoutSec * 1000,
|
|
82
|
+
});
|
|
73
83
|
_provider = new sdk_trace_node_1.NodeTracerProvider();
|
|
74
84
|
_provider.addSpanProcessor(new processor_1.TraceRootSpanProcessor(innerProcessor, { environment, gitRepo, gitRef }));
|
|
75
85
|
_provider.register();
|
|
@@ -77,7 +87,9 @@ class TraceRoot {
|
|
|
77
87
|
_isInitialized = true;
|
|
78
88
|
// forceFlush() is async and keeps the event loop alive via its HTTP export request,
|
|
79
89
|
// so beforeExit + forceFlush() is sufficient — no keepAlive timer needed.
|
|
80
|
-
process.once('beforeExit', () => {
|
|
90
|
+
process.once('beforeExit', () => {
|
|
91
|
+
void _provider?.forceFlush();
|
|
92
|
+
});
|
|
81
93
|
}
|
|
82
94
|
static async flush() {
|
|
83
95
|
await _provider?.forceFlush();
|
package/dist/traceroot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"traceroot.js","sourceRoot":"","sources":["../src/traceroot.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"traceroot.js","sourceRoot":"","sources":["../src/traceroot.ts"],"names":[],"mappings":";;;AAuIA,4CAQC;AA/ID,mBAAmB;AACnB,4CAO4B;AAC5B,wFAA6E;AAC7E,kEAAwF;AACxF,kEAAmE;AAEnE,2CAA4E;AAC5E,uDAAyD;AACzD,uCAA+C;AAC/C,+CAAwF;AAExF,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAEpD,IAAI,cAAc,GAAG,KAAK,CAAC;AAC3B,IAAI,SAAyC,CAAC;AAE9C,MAAa,SAAS;IACpB,gBAAuB,CAAC;IAExB,MAAM,CAAC,aAAa;QAClB,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,UAA6B,EAAE;QAC/C,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,KAAK,OAAO,CAAC;QAChF,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO;QACT,CA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AAI,kCAAsB,CAAC,cAAc,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAC7E,CAAC;QACF,SAAS,CAAC,QAAQ,EAAE,CAAC;QAErB,IAAA,sCAAoB,EAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;QAEhD,cAAc,GAAG,IAAI,CAAC;QACtB,oFAAoF;QACpF,0EAA0E;QAC1E,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,EAAE;YAC9B,KAAK,SAAS,EAAE,UAAU,EAAE,CAAC;QAC/B,CAAC,CAAC,CAAC;IACL,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,KAAK;QAChB,MAAM,SAAS,EAAE,UAAU,EAAE,CAAC;IAChC,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,QAAQ;QACnB,MAAM,SAAS,EAAE,QAAQ,EAAE,CAAC;QAC5B,cAAc,GAAG,KAAK,CAAC;QACvB,SAAS,GAAG,SAAS,CAAC;QACtB,IAAA,4BAAkB,GAAE,CAAC;IACvB,CAAC;CACF;AA7GD,8BA6GC;AAED,gBAAgB;AAChB,SAAgB,gBAAgB;IAC9B,cAAc,GAAG,KAAK,CAAC;IACvB,SAAS,GAAG,SAAS,CAAC;IACtB,IAAA,4BAAkB,GAAE,CAAC;IACrB,IAAA,mCAAqB,GAAE,CAAC;IACxB,WAAK,CAAC,OAAO,EAAE,CAAC;IAChB,aAAO,CAAC,OAAO,EAAE,CAAC;IAClB,iBAAW,CAAC,OAAO,EAAE,CAAC;AACxB,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -4,12 +4,31 @@ export interface ObserveOptions {
|
|
|
4
4
|
name?: string;
|
|
5
5
|
/** Span kind. Defaults to 'span' → openinference.span.kind = 'CHAIN'. */
|
|
6
6
|
type?: SpanType;
|
|
7
|
-
/** Input to record on the span. Explicitly passed — no auto-inference. */
|
|
8
|
-
input?: unknown;
|
|
9
7
|
/** Arbitrary metadata to attach to this span. */
|
|
10
8
|
metadata?: Record<string, unknown>;
|
|
11
9
|
/** Tags to attach to this span. */
|
|
12
10
|
tags?: string[];
|
|
11
|
+
/**
|
|
12
|
+
* Whether to auto-capture function arguments as input.value. Defaults to true.
|
|
13
|
+
* Set to false to suppress input recording (e.g. for PII or non-serializable args).
|
|
14
|
+
* Only applies when args are passed: observe(opts, fn, arg1, arg2).
|
|
15
|
+
*/
|
|
16
|
+
captureInput?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Whether to capture the return value as output.value. Defaults to true.
|
|
19
|
+
* Set to false to suppress output recording (e.g. for large or sensitive responses).
|
|
20
|
+
*/
|
|
21
|
+
captureOutput?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Session / conversation ID to associate with this span.
|
|
24
|
+
* Equivalent to calling updateCurrentTrace({ sessionId }) inside fn.
|
|
25
|
+
*/
|
|
26
|
+
sessionId?: string;
|
|
27
|
+
/**
|
|
28
|
+
* User ID to associate with this span.
|
|
29
|
+
* Equivalent to calling updateCurrentTrace({ userId }) inside fn.
|
|
30
|
+
*/
|
|
31
|
+
userId?: string;
|
|
13
32
|
}
|
|
14
33
|
export interface InitializeOptions {
|
|
15
34
|
/** API key for TraceRoot. Falls back to TRACEROOT_API_KEY env var. */
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC;AAEzD,MAAM,WAAW,cAAc;IAC7B,wDAAwD;IACxD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yEAAyE;IACzE,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,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6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@traceroot-ai/traceroot",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "TraceRoot TypeScript SDK for AI observability",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"traceroot",
|
|
@@ -52,8 +52,11 @@
|
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@eslint/js": "^9.0.0",
|
|
55
|
+
"@langchain/core": "^1.1.39",
|
|
55
56
|
"@types/node": "^20.0.0",
|
|
57
|
+
"anthropic": "^0.0.0",
|
|
56
58
|
"eslint": "^9.0.0",
|
|
59
|
+
"openai": "^6.33.0",
|
|
57
60
|
"tsx": "^4.19.0",
|
|
58
61
|
"typescript": "^5.5.0",
|
|
59
62
|
"typescript-eslint": "^8.0.0"
|