@respan/tracing 1.0.45
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/LICENSE +201 -0
- package/README.md +860 -0
- package/dist/constants/index.d.ts +8 -0
- package/dist/constants/index.js +9 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/contexts/index.d.ts +1 -0
- package/dist/contexts/index.js +2 -0
- package/dist/contexts/index.js.map +1 -0
- package/dist/contexts/span.d.ts +9 -0
- package/dist/contexts/span.js +39 -0
- package/dist/contexts/span.js.map +1 -0
- package/dist/decorators/base.d.ts +32 -0
- package/dist/decorators/base.js +242 -0
- package/dist/decorators/base.js.map +1 -0
- package/dist/decorators/index.d.ts +1 -0
- package/dist/decorators/index.js +2 -0
- package/dist/decorators/index.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/instrumentation/index.d.ts +2 -0
- package/dist/instrumentation/index.js +3 -0
- package/dist/instrumentation/index.js.map +1 -0
- package/dist/instrumentation/loader.d.ts +5 -0
- package/dist/instrumentation/loader.js +104 -0
- package/dist/instrumentation/loader.js.map +1 -0
- package/dist/instrumentation/manager.d.ts +29 -0
- package/dist/instrumentation/manager.js +564 -0
- package/dist/instrumentation/manager.js.map +1 -0
- package/dist/main.d.ts +162 -0
- package/dist/main.js +212 -0
- package/dist/main.js.map +1 -0
- package/dist/processor/composite.d.ts +29 -0
- package/dist/processor/composite.js +106 -0
- package/dist/processor/composite.js.map +1 -0
- package/dist/processor/filtering.d.ts +19 -0
- package/dist/processor/filtering.js +78 -0
- package/dist/processor/filtering.js.map +1 -0
- package/dist/processor/index.d.ts +3 -0
- package/dist/processor/index.js +4 -0
- package/dist/processor/index.js.map +1 -0
- package/dist/processor/manager.d.ts +61 -0
- package/dist/processor/manager.js +111 -0
- package/dist/processor/manager.js.map +1 -0
- package/dist/types/clientTypes.d.ts +188 -0
- package/dist/types/clientTypes.js +22 -0
- package/dist/types/clientTypes.js.map +1 -0
- package/dist/types/decoratorTypes.d.ts +6 -0
- package/dist/types/decoratorTypes.js +2 -0
- package/dist/types/decoratorTypes.js.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.js +4 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/instrumentationTypes.d.ts +25 -0
- package/dist/types/instrumentationTypes.js +82 -0
- package/dist/types/instrumentationTypes.js.map +1 -0
- package/dist/utils/client.d.ts +168 -0
- package/dist/utils/client.js +151 -0
- package/dist/utils/client.js.map +1 -0
- package/dist/utils/context.d.ts +28 -0
- package/dist/utils/context.js +44 -0
- package/dist/utils/context.js.map +1 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.js +8 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/span.d.ts +65 -0
- package/dist/utils/span.js +269 -0
- package/dist/utils/span.js.map +1 -0
- package/dist/utils/spanBuffer.d.ts +94 -0
- package/dist/utils/spanBuffer.js +147 -0
- package/dist/utils/spanBuffer.js.map +1 -0
- package/dist/utils/tracing.d.ts +31 -0
- package/dist/utils/tracing.js +239 -0
- package/dist/utils/tracing.js.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { NodeSDK } from "@opentelemetry/sdk-node";
|
|
2
|
+
import { diag, DiagLogLevel } from "@opentelemetry/api";
|
|
3
|
+
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-proto";
|
|
4
|
+
import { Resource } from "@opentelemetry/resources";
|
|
5
|
+
import { ATTR_SERVICE_NAME } from "@opentelemetry/semantic-conventions";
|
|
6
|
+
import { MultiProcessorManager } from "../processor/manager.js";
|
|
7
|
+
import { RespanCompositeProcessor } from "../processor/composite.js";
|
|
8
|
+
import { getInstrumentations, initInstrumentations, manuallyInitInstrumentations, configureTraceContent } from "../instrumentation/index.js";
|
|
9
|
+
import { shouldSendTraces } from "./context.js";
|
|
10
|
+
// Global SDK instance (singleton)
|
|
11
|
+
let _sdk;
|
|
12
|
+
let _initialized = false;
|
|
13
|
+
let _compositeProcessor;
|
|
14
|
+
/**
|
|
15
|
+
* Helper function to resolve and clean up the base URL
|
|
16
|
+
*/
|
|
17
|
+
export const _resolveBaseURL = (baseURL) => {
|
|
18
|
+
const originalUrl = baseURL;
|
|
19
|
+
// Remove trailing slash if it exists
|
|
20
|
+
if (baseURL.endsWith("/")) {
|
|
21
|
+
baseURL = baseURL.slice(0, -1);
|
|
22
|
+
}
|
|
23
|
+
// Remove trailing /api if it exists
|
|
24
|
+
if (baseURL.endsWith("/api")) {
|
|
25
|
+
baseURL = baseURL.slice(0, -4);
|
|
26
|
+
}
|
|
27
|
+
// Debug logging for URL resolution
|
|
28
|
+
if (originalUrl !== baseURL) {
|
|
29
|
+
console.debug(`[Respan Debug] URL resolved: "${originalUrl}" -> "${baseURL}"`);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
console.debug(`[Respan Debug] URL used as-is: "${baseURL}"`);
|
|
33
|
+
}
|
|
34
|
+
return baseURL;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Initializes the OpenTelemetry SDK with Respan-specific configuration.
|
|
38
|
+
* This sets up the entire tracing pipeline: collection, processing, and export.
|
|
39
|
+
*
|
|
40
|
+
* @param options - Configuration options for the tracing setup
|
|
41
|
+
*/
|
|
42
|
+
export const startTracing = async (options) => {
|
|
43
|
+
// Prevent multiple initializations
|
|
44
|
+
if (_initialized) {
|
|
45
|
+
console.log("[Respan] Tracing already initialized, skipping...");
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const { appName = "respan-app", apiKey = process.env.RESPAN_API_KEY || "", baseURL = process.env.RESPAN_BASE_URL || "https://api.respan.co", logLevel = "error", exporter, headers = {}, propagator, contextManager, silenceInitializationMessage = false, tracingEnabled = true, instrumentModules, traceContent = true, disabledInstrumentations = [], resourceAttributes = {}, spanPostprocessCallback, } = options;
|
|
49
|
+
// Debug logging for configuration
|
|
50
|
+
console.debug("[Respan Debug] Tracing configuration:", {
|
|
51
|
+
appName,
|
|
52
|
+
baseURL,
|
|
53
|
+
logLevel,
|
|
54
|
+
tracingEnabled,
|
|
55
|
+
traceContent,
|
|
56
|
+
hasApiKey: !!apiKey,
|
|
57
|
+
apiKeyLength: apiKey?.length || 0,
|
|
58
|
+
hasInstrumentModules: !!(instrumentModules && Object.keys(instrumentModules).length > 0),
|
|
59
|
+
instrumentModulesKeys: instrumentModules
|
|
60
|
+
? Object.keys(instrumentModules)
|
|
61
|
+
: [],
|
|
62
|
+
customHeaders: Object.keys(headers),
|
|
63
|
+
disabledInstrumentations: disabledInstrumentations || [],
|
|
64
|
+
});
|
|
65
|
+
if (!tracingEnabled) {
|
|
66
|
+
if (!silenceInitializationMessage) {
|
|
67
|
+
console.log("Respan tracing is disabled");
|
|
68
|
+
}
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
// Debug API key validation
|
|
72
|
+
if (!apiKey) {
|
|
73
|
+
console.error("[Respan Debug] WARNING: No API key provided. Traces may be rejected by the server.");
|
|
74
|
+
}
|
|
75
|
+
else if (apiKey.length < 10) {
|
|
76
|
+
console.warn("[Respan Debug] WARNING: API key seems unusually short. Please verify it's correct.");
|
|
77
|
+
}
|
|
78
|
+
// Initialize instrumentations with enhanced error logging
|
|
79
|
+
try {
|
|
80
|
+
if (instrumentModules && Object.keys(instrumentModules).length > 0) {
|
|
81
|
+
console.debug("[Respan Debug] Using manual instrumentation for modules:", Object.keys(instrumentModules));
|
|
82
|
+
await manuallyInitInstrumentations(instrumentModules, disabledInstrumentations);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
console.debug("[Respan Debug] Using automatic instrumentation discovery");
|
|
86
|
+
await initInstrumentations(disabledInstrumentations, false); // false = don't show warnings for auto-discovery
|
|
87
|
+
}
|
|
88
|
+
const instrumentationsList = getInstrumentations();
|
|
89
|
+
console.debug(`[Respan Debug] Total instrumentations ready for SDK: ${instrumentationsList.length}`);
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
console.error("[Respan Debug] Error during instrumentation initialization:", error);
|
|
93
|
+
throw error;
|
|
94
|
+
}
|
|
95
|
+
// Configure trace content for instrumentations
|
|
96
|
+
const shouldCapture = shouldSendTraces() && traceContent;
|
|
97
|
+
configureTraceContent(shouldCapture);
|
|
98
|
+
if (!shouldCapture) {
|
|
99
|
+
console.debug("[Respan Debug] Trace content disabled - sensitive data will not be captured");
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
console.debug("[Respan Debug] Trace content enabled - input/output data will be captured");
|
|
103
|
+
}
|
|
104
|
+
// Set log level using proper DiagLogLevel
|
|
105
|
+
const diagLogLevel = logLevel === "debug"
|
|
106
|
+
? DiagLogLevel.DEBUG
|
|
107
|
+
: logLevel === "info"
|
|
108
|
+
? DiagLogLevel.INFO
|
|
109
|
+
: logLevel === "warn"
|
|
110
|
+
? DiagLogLevel.WARN
|
|
111
|
+
: DiagLogLevel.ERROR;
|
|
112
|
+
console.debug(`[Respan Debug] Setting OpenTelemetry diagnostic log level to: ${logLevel}`);
|
|
113
|
+
diag.setLogger({
|
|
114
|
+
error: (...args) => console.error("[Respan OpenTelemetry]", ...args),
|
|
115
|
+
warn: (...args) => console.warn("[Respan OpenTelemetry]", ...args),
|
|
116
|
+
info: (...args) => console.info("[Respan OpenTelemetry]", ...args),
|
|
117
|
+
debug: (...args) => console.debug("[Respan OpenTelemetry]", ...args),
|
|
118
|
+
verbose: (...args) => console.debug("[Respan OpenTelemetry Verbose]", ...args),
|
|
119
|
+
}, diagLogLevel);
|
|
120
|
+
// Create resource with custom attributes
|
|
121
|
+
const resource = new Resource({
|
|
122
|
+
[ATTR_SERVICE_NAME]: appName,
|
|
123
|
+
...resourceAttributes,
|
|
124
|
+
});
|
|
125
|
+
console.debug("[Respan Debug] Created resource with service name:", appName, "and attributes:", resourceAttributes);
|
|
126
|
+
// Prepare exporter URL and configuration
|
|
127
|
+
const exporterUrl = `${_resolveBaseURL(baseURL)}/api/v1/traces`;
|
|
128
|
+
const exporterHeaders = {
|
|
129
|
+
Authorization: `Bearer ${apiKey}`,
|
|
130
|
+
"Content-Type": "application/x-protobuf",
|
|
131
|
+
...headers,
|
|
132
|
+
};
|
|
133
|
+
console.debug("[Respan Debug] Exporter configuration:", {
|
|
134
|
+
url: exporterUrl,
|
|
135
|
+
headersCount: Object.keys(exporterHeaders).length,
|
|
136
|
+
hasAuth: exporterHeaders.Authorization ? "Yes" : "No",
|
|
137
|
+
customHeaderKeys: Object.keys(headers),
|
|
138
|
+
});
|
|
139
|
+
// Create exporter with enhanced error handling
|
|
140
|
+
const traceExporter = exporter ||
|
|
141
|
+
new OTLPTraceExporter({
|
|
142
|
+
url: exporterUrl,
|
|
143
|
+
headers: exporterHeaders,
|
|
144
|
+
});
|
|
145
|
+
console.debug("[Respan Debug] Created OTLP trace exporter");
|
|
146
|
+
// Initialize multi-processor manager
|
|
147
|
+
const processorManager = new MultiProcessorManager();
|
|
148
|
+
// Add default Respan processor to the manager
|
|
149
|
+
// This ensures backward compatibility: spans without a `processors` attribute
|
|
150
|
+
// automatically go to the default Respan exporter
|
|
151
|
+
processorManager.addProcessor({
|
|
152
|
+
exporter: traceExporter,
|
|
153
|
+
name: "default",
|
|
154
|
+
priority: 0,
|
|
155
|
+
});
|
|
156
|
+
console.debug("[Respan Debug] Added default processor to multi-processor manager (backward compatibility)");
|
|
157
|
+
// Create composite processor that does filtering + routing
|
|
158
|
+
// Flow: SDK -> CompositeProcessor (filters) -> ProcessorManager (routes) -> Individual Processors
|
|
159
|
+
_compositeProcessor = new RespanCompositeProcessor(processorManager, spanPostprocessCallback);
|
|
160
|
+
console.debug("[Respan Debug] Created composite processor - filters spans and routes to multiple processors");
|
|
161
|
+
// Get instrumentations for SDK
|
|
162
|
+
const instrumentationsList = getInstrumentations();
|
|
163
|
+
// Initialize SDK
|
|
164
|
+
console.debug(`[Respan Debug] Initializing NodeSDK with ${instrumentationsList.length} successfully loaded instrumentations:`, instrumentationsList.map((inst) => inst.constructor.name));
|
|
165
|
+
_sdk = new NodeSDK({
|
|
166
|
+
resource,
|
|
167
|
+
spanProcessors: [_compositeProcessor],
|
|
168
|
+
instrumentations: instrumentationsList,
|
|
169
|
+
textMapPropagator: propagator,
|
|
170
|
+
contextManager,
|
|
171
|
+
});
|
|
172
|
+
try {
|
|
173
|
+
console.debug("[Respan Debug] Starting OpenTelemetry SDK...");
|
|
174
|
+
_sdk.start();
|
|
175
|
+
_initialized = true;
|
|
176
|
+
console.debug("[Respan Debug] SDK started successfully");
|
|
177
|
+
if (!silenceInitializationMessage) {
|
|
178
|
+
console.log("Respan tracing initialized successfully");
|
|
179
|
+
console.log(`[Respan Debug] Traces will be sent to: ${exporterUrl}`);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
catch (error) {
|
|
183
|
+
console.error("[Respan Debug] Failed to start OpenTelemetry SDK:", error);
|
|
184
|
+
console.error("[Respan Debug] Error details:", {
|
|
185
|
+
message: error.message,
|
|
186
|
+
stack: error.stack,
|
|
187
|
+
exporterUrl,
|
|
188
|
+
instrumentationCount: instrumentationsList.length,
|
|
189
|
+
});
|
|
190
|
+
throw error;
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* Enhanced error logging for forceFlush
|
|
195
|
+
*/
|
|
196
|
+
export const forceFlush = async () => {
|
|
197
|
+
if (_sdk) {
|
|
198
|
+
try {
|
|
199
|
+
console.debug("[Respan Debug] Shutting down SDK and flushing traces...");
|
|
200
|
+
await _sdk.shutdown();
|
|
201
|
+
console.debug("[Respan Debug] SDK shutdown completed");
|
|
202
|
+
}
|
|
203
|
+
catch (error) {
|
|
204
|
+
console.error("[Respan Debug] Error during SDK shutdown:", error);
|
|
205
|
+
console.error("[Respan Debug] Shutdown error details:", {
|
|
206
|
+
message: error.message,
|
|
207
|
+
stack: error.stack,
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
console.debug("[Respan Debug] No SDK to shutdown");
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* Gets the current SDK instance.
|
|
217
|
+
* Useful for advanced configuration or checking if tracing is initialized.
|
|
218
|
+
*
|
|
219
|
+
* @returns The NodeSDK instance or undefined if not initialized
|
|
220
|
+
*/
|
|
221
|
+
export const getClient = () => {
|
|
222
|
+
return _sdk;
|
|
223
|
+
};
|
|
224
|
+
/**
|
|
225
|
+
* Add a processor to the SDK for routing spans.
|
|
226
|
+
* This allows routing spans to different destinations based on processor names.
|
|
227
|
+
*
|
|
228
|
+
* @param config - Processor configuration
|
|
229
|
+
*/
|
|
230
|
+
export const addProcessorToSDK = (config) => {
|
|
231
|
+
if (!_compositeProcessor) {
|
|
232
|
+
console.error("[Respan] Cannot add processor - SDK not initialized");
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
const processorManager = _compositeProcessor.getProcessorManager();
|
|
236
|
+
processorManager.addProcessor(config);
|
|
237
|
+
console.log(`[Respan] Added processor: ${config.name}`);
|
|
238
|
+
};
|
|
239
|
+
//# sourceMappingURL=tracing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracing.js","sourceRoot":"","sources":["../../src/utils/tracing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC7E,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAExE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EACL,mBAAmB,EACn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C9B,CAAC,CAAC;QACL,CAAC;IACH,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;IACrD,CAAC;AACH,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,GAAwB,EAAE;IACjD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAuB,EAAQ,EAAE;IACjE,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACzB,OAAO,CAAC,KAAK,CAAC,qDAAqD,CAAC,CAAC;QACrE,OAAO;IACT,CAAC;IAED,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,mBAAmB,EAAE,CAAC;IACnE,gBAAgB,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IACtC,OAAO,CAAC,GAAG,CAAC,6BAA6B,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;AAC1D,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@respan/tracing",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "1.0.45",
|
|
5
|
+
"description": "TypeScript support for Respan SDK",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"README.md",
|
|
11
|
+
"LICENSE"
|
|
12
|
+
],
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc",
|
|
18
|
+
"watch:test": "tsc -p tsconfig.test.json --watch",
|
|
19
|
+
"dev": "yarn build && cd examples && yarn dev",
|
|
20
|
+
"examples:install": "cd examples && yarn install",
|
|
21
|
+
"examples:basic": "yarn build && cd examples && yarn basic",
|
|
22
|
+
"examples:advanced": "yarn build && cd examples && yarn dev",
|
|
23
|
+
"test:build": "npm run build && npm pack && npm install ./respan-tracing-*.tgz --no-save && tsx tests/test_build.ts"
|
|
24
|
+
},
|
|
25
|
+
"repository": "https://github.com/respan-ai/respan-sdks.git",
|
|
26
|
+
"author": "Respan <team@respan.ai>",
|
|
27
|
+
"license": "Apache-2.0",
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@respan/respan-sdk": "^1.0.0",
|
|
30
|
+
"@opentelemetry/api": "^1.9.0",
|
|
31
|
+
"@opentelemetry/core": "^1.26.0",
|
|
32
|
+
"@opentelemetry/exporter-trace-otlp-proto": "^0.56.0",
|
|
33
|
+
"@opentelemetry/resources": "^1.26.0",
|
|
34
|
+
"@opentelemetry/sdk-node": "^0.56.0",
|
|
35
|
+
"@opentelemetry/sdk-trace-base": "^1.26.0",
|
|
36
|
+
"@opentelemetry/sdk-trace-node": "^1.26.0",
|
|
37
|
+
"@opentelemetry/semantic-conventions": "^1.27.0",
|
|
38
|
+
"@traceloop/ai-semantic-conventions": "^0.13.0"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@ai-sdk/openai": "^1.3.6",
|
|
42
|
+
"@anthropic-ai/sdk": "0.41.0",
|
|
43
|
+
"@vercel/otel": "^1.10.4",
|
|
44
|
+
"ai": "^4.2.10",
|
|
45
|
+
"dotenv": "^16.4.7",
|
|
46
|
+
"openai": "^4.80.1",
|
|
47
|
+
"ts-node": "^10.9.2",
|
|
48
|
+
"tsx": "^4.19.2",
|
|
49
|
+
"typescript": "^5.7.3",
|
|
50
|
+
"zod": "^3.24.2"
|
|
51
|
+
},
|
|
52
|
+
"optionalDependencies": {
|
|
53
|
+
"@traceloop/instrumentation-anthropic": "^0.22.2",
|
|
54
|
+
"@traceloop/instrumentation-azure": "^0.13.0",
|
|
55
|
+
"@traceloop/instrumentation-bedrock": "^0.13.0",
|
|
56
|
+
"@traceloop/instrumentation-chromadb": "^0.13.0",
|
|
57
|
+
"@traceloop/instrumentation-cohere": "^0.13.0",
|
|
58
|
+
"@traceloop/instrumentation-langchain": "^0.13.0",
|
|
59
|
+
"@traceloop/instrumentation-llamaindex": "^0.13.0",
|
|
60
|
+
"@traceloop/instrumentation-openai": "^0.14.4",
|
|
61
|
+
"@traceloop/instrumentation-pinecone": "^0.13.0",
|
|
62
|
+
"@traceloop/instrumentation-qdrant": "^0.13.0",
|
|
63
|
+
"@traceloop/instrumentation-together": "^0.13.0",
|
|
64
|
+
"@traceloop/instrumentation-vertexai": "^0.13.0"
|
|
65
|
+
},
|
|
66
|
+
"os": [
|
|
67
|
+
"darwin",
|
|
68
|
+
"linux",
|
|
69
|
+
"win32"
|
|
70
|
+
],
|
|
71
|
+
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
|
72
|
+
}
|