braintrust 0.4.1 → 0.4.3
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/dev/dist/index.d.mts +16 -0
- package/dev/dist/index.d.ts +16 -0
- package/dev/dist/index.js +83 -45
- package/dev/dist/index.mjs +67 -29
- package/dist/browser.d.mts +70 -2
- package/dist/browser.d.ts +70 -2
- package/dist/browser.js +125 -50
- package/dist/browser.mjs +105 -30
- package/dist/cli.js +75 -37
- package/dist/index.d.mts +69 -2
- package/dist/index.d.ts +69 -2
- package/dist/index.js +326 -181
- package/dist/index.mjs +215 -70
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3465,7 +3465,6 @@ var init_context = __esm({
|
|
|
3465
3465
|
"src/otel/context.ts"() {
|
|
3466
3466
|
"use strict";
|
|
3467
3467
|
init_logger();
|
|
3468
|
-
init_util();
|
|
3469
3468
|
OTEL_NOT_INSTALLED_MESSAGE = "OpenTelemetry packages are not installed. Install them with: npm install @opentelemetry/api @opentelemetry/sdk-trace-base";
|
|
3470
3469
|
otelTrace = null;
|
|
3471
3470
|
otelContext = null;
|
|
@@ -3528,6 +3527,10 @@ var init_context = __esm({
|
|
|
3528
3527
|
const currentContext = otelContext.active();
|
|
3529
3528
|
let newContext = otelTrace.setSpan(currentContext, wrappedContext);
|
|
3530
3529
|
newContext = newContext.setValue("braintrust_span", span);
|
|
3530
|
+
const parentValue = span._getOtelParent();
|
|
3531
|
+
if (parentValue) {
|
|
3532
|
+
newContext = newContext.setValue("braintrust.parent", parentValue);
|
|
3533
|
+
}
|
|
3531
3534
|
return otelContext.with(newContext, callback);
|
|
3532
3535
|
}
|
|
3533
3536
|
} catch (error2) {
|
|
@@ -3543,34 +3546,6 @@ var init_context = __esm({
|
|
|
3543
3546
|
}
|
|
3544
3547
|
return void 0;
|
|
3545
3548
|
}
|
|
3546
|
-
_getOtelParent(span) {
|
|
3547
|
-
if (!span.parentObjectType || !span.parentObjectId) {
|
|
3548
|
-
return void 0;
|
|
3549
|
-
}
|
|
3550
|
-
try {
|
|
3551
|
-
const parentType = span.parentObjectType;
|
|
3552
|
-
const parentId = span.parentObjectId;
|
|
3553
|
-
if (parentType === 2 /* PROJECT_LOGS */) {
|
|
3554
|
-
const id = typeof parentId === "object" && parentId !== null && "get" in parentId ? (
|
|
3555
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- Type guard ensures object has get method
|
|
3556
|
-
parentId.get()
|
|
3557
|
-
) : parentId;
|
|
3558
|
-
if (typeof id === "string") {
|
|
3559
|
-
return `project_id:${id}`;
|
|
3560
|
-
}
|
|
3561
|
-
} else if (parentType === 1 /* EXPERIMENT */) {
|
|
3562
|
-
const id = typeof parentId === "object" && parentId !== null && "get" in parentId ? (
|
|
3563
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- Type guard ensures object has get method
|
|
3564
|
-
parentId.get()
|
|
3565
|
-
) : parentId;
|
|
3566
|
-
if (typeof id === "string") {
|
|
3567
|
-
return `experiment_id:${id}`;
|
|
3568
|
-
}
|
|
3569
|
-
}
|
|
3570
|
-
} catch {
|
|
3571
|
-
}
|
|
3572
|
-
return void 0;
|
|
3573
|
-
}
|
|
3574
3549
|
};
|
|
3575
3550
|
}
|
|
3576
3551
|
});
|
|
@@ -5272,7 +5247,7 @@ function resetIdGenStateForTests() {
|
|
|
5272
5247
|
state.resetIdGenState();
|
|
5273
5248
|
}
|
|
5274
5249
|
}
|
|
5275
|
-
var BRAINTRUST_ATTACHMENT, EXTERNAL_ATTACHMENT, BRAINTRUST_PARAMS, REDACTION_FIELDS, MaskingError, ContextManager, BraintrustContextManager, NoopSpan, NOOP_SPAN, NOOP_SPAN_PERMALINK, loginSchema, stateNonce, BraintrustState, _globalState, _internalGetGlobalState, FailedHTTPResponse, HTTPConnection, BaseAttachment, Attachment, ExternalAttachment, attachmentMetadataSchema, ReadonlyAttachment, ERR_PERMALINK, Logger, TestBackgroundLogger, BACKGROUND_LOGGER_BASE_SLEEP_TIME_S, HTTPBackgroundLogger, traceable, INTERNAL_BTQL_LIMIT, MAX_BTQL_ITERATIONS, ObjectFetcher, Experiment2, ReadonlyExperiment, executionCounter, SpanImpl, Dataset2, Prompt2, TEST_API_KEY, _exportsForTestingOnly;
|
|
5250
|
+
var BRAINTRUST_ATTACHMENT, EXTERNAL_ATTACHMENT, BRAINTRUST_PARAMS, REDACTION_FIELDS, MaskingError, ContextManager, BraintrustContextManager, NoopSpan, NOOP_SPAN, NOOP_SPAN_PERMALINK, loginSchema, stateNonce, BraintrustState, _globalState, _internalGetGlobalState, FailedHTTPResponse, HTTPConnection, BaseAttachment, Attachment, ExternalAttachment, attachmentMetadataSchema, ReadonlyAttachment, JSONAttachment, ERR_PERMALINK, Logger, TestBackgroundLogger, BACKGROUND_LOGGER_BASE_SLEEP_TIME_S, HTTPBackgroundLogger, traceable, INTERNAL_BTQL_LIMIT, MAX_BTQL_ITERATIONS, ObjectFetcher, Experiment2, ReadonlyExperiment, executionCounter, SpanImpl, Dataset2, Prompt2, TEST_API_KEY, _exportsForTestingOnly;
|
|
5276
5251
|
var init_logger = __esm({
|
|
5277
5252
|
"src/logger.ts"() {
|
|
5278
5253
|
"use strict";
|
|
@@ -5381,6 +5356,9 @@ var init_logger = __esm({
|
|
|
5381
5356
|
state() {
|
|
5382
5357
|
return _internalGetGlobalState();
|
|
5383
5358
|
}
|
|
5359
|
+
_getOtelParent() {
|
|
5360
|
+
return void 0;
|
|
5361
|
+
}
|
|
5384
5362
|
// Custom inspect for Node.js console.log
|
|
5385
5363
|
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
5386
5364
|
return `NoopSpan {
|
|
@@ -6142,6 +6120,44 @@ with a Blob/ArrayBuffer, or run the program on Node.js.`
|
|
|
6142
6120
|
return new LazyValue(download);
|
|
6143
6121
|
}
|
|
6144
6122
|
};
|
|
6123
|
+
JSONAttachment = class extends Attachment {
|
|
6124
|
+
/**
|
|
6125
|
+
* Construct a JSONAttachment from a JSON-serializable object.
|
|
6126
|
+
*
|
|
6127
|
+
* @param data The JSON object to attach. Must be JSON-serializable.
|
|
6128
|
+
* @param options Additional options:
|
|
6129
|
+
* - `filename`: The filename for the attachment (defaults to "data.json")
|
|
6130
|
+
* - `pretty`: Whether to pretty-print the JSON (defaults to false)
|
|
6131
|
+
* - `state`: (Optional) For internal use.
|
|
6132
|
+
*
|
|
6133
|
+
* @example
|
|
6134
|
+
* ```typescript
|
|
6135
|
+
* const largeTranscript = [
|
|
6136
|
+
* { role: "user", content: "..." },
|
|
6137
|
+
* { role: "assistant", content: "..." },
|
|
6138
|
+
* // ... many more messages
|
|
6139
|
+
* ];
|
|
6140
|
+
*
|
|
6141
|
+
* logger.log({
|
|
6142
|
+
* input: {
|
|
6143
|
+
* type: "chat",
|
|
6144
|
+
* transcript: new JSONAttachment(largeTranscript, { filename: "transcript.json" })
|
|
6145
|
+
* }
|
|
6146
|
+
* });
|
|
6147
|
+
* ```
|
|
6148
|
+
*/
|
|
6149
|
+
constructor(data, options) {
|
|
6150
|
+
const { filename = "data.json", pretty = false, state } = options ?? {};
|
|
6151
|
+
const jsonString = pretty ? JSON.stringify(data, null, 2) : JSON.stringify(data);
|
|
6152
|
+
const blob = new Blob([jsonString], { type: "application/json" });
|
|
6153
|
+
super({
|
|
6154
|
+
data: blob,
|
|
6155
|
+
filename,
|
|
6156
|
+
contentType: "application/json",
|
|
6157
|
+
state
|
|
6158
|
+
});
|
|
6159
|
+
}
|
|
6160
|
+
};
|
|
6145
6161
|
ERR_PERMALINK = "https://braintrust.dev/error-generating-link";
|
|
6146
6162
|
Logger = class {
|
|
6147
6163
|
state;
|
|
@@ -6175,6 +6191,9 @@ with a Blob/ArrayBuffer, or run the program on Node.js.`
|
|
|
6175
6191
|
get id() {
|
|
6176
6192
|
return (async () => (await this.project).id)();
|
|
6177
6193
|
}
|
|
6194
|
+
get loggingState() {
|
|
6195
|
+
return this.state;
|
|
6196
|
+
}
|
|
6178
6197
|
parentObjectType() {
|
|
6179
6198
|
return 2 /* PROJECT_LOGS */;
|
|
6180
6199
|
}
|
|
@@ -6888,6 +6907,18 @@ Error: ${errorText}`;
|
|
|
6888
6907
|
return (await this.lazyMetadata.get()).experiment.id;
|
|
6889
6908
|
})();
|
|
6890
6909
|
}
|
|
6910
|
+
get loggingState() {
|
|
6911
|
+
return this.state;
|
|
6912
|
+
}
|
|
6913
|
+
/**
|
|
6914
|
+
* Wait for the experiment ID to be resolved. This is useful for ensuring the ID
|
|
6915
|
+
* is available synchronously in child spans (for OTEL parent attributes).
|
|
6916
|
+
* @internal
|
|
6917
|
+
*/
|
|
6918
|
+
async _waitForId() {
|
|
6919
|
+
await this.lazyId.get().catch(() => {
|
|
6920
|
+
});
|
|
6921
|
+
}
|
|
6891
6922
|
get name() {
|
|
6892
6923
|
return (async () => {
|
|
6893
6924
|
return (await this.lazyMetadata.get()).experiment.name;
|
|
@@ -7144,6 +7175,9 @@ View complete results in Braintrust or run experiment.summarize() again.`
|
|
|
7144
7175
|
return (await this.lazyMetadata.get()).experiment.name;
|
|
7145
7176
|
})();
|
|
7146
7177
|
}
|
|
7178
|
+
get loggingState() {
|
|
7179
|
+
return this.state;
|
|
7180
|
+
}
|
|
7147
7181
|
async getState() {
|
|
7148
7182
|
await this.lazyMetadata.get();
|
|
7149
7183
|
return this.state;
|
|
@@ -7440,6 +7474,42 @@ View complete results in Braintrust or run experiment.summarize() again.`
|
|
|
7440
7474
|
state() {
|
|
7441
7475
|
return this._state;
|
|
7442
7476
|
}
|
|
7477
|
+
/**
|
|
7478
|
+
* Internal method to get the OTEL parent string for this span.
|
|
7479
|
+
* This is used by OtelContextManager to set the braintrust.parent attribute.
|
|
7480
|
+
* @returns A string like "project_id:X" or "experiment_id:X", or undefined if no parent
|
|
7481
|
+
*/
|
|
7482
|
+
_getOtelParent() {
|
|
7483
|
+
if (!this.parentObjectType) {
|
|
7484
|
+
return void 0;
|
|
7485
|
+
}
|
|
7486
|
+
try {
|
|
7487
|
+
if (this.parentObjectType === 2 /* PROJECT_LOGS */) {
|
|
7488
|
+
const syncResult = this.parentObjectId.getSync();
|
|
7489
|
+
const id = syncResult.value;
|
|
7490
|
+
const args = this.parentComputeObjectMetadataArgs;
|
|
7491
|
+
if (id) {
|
|
7492
|
+
return `project_id:${id}`;
|
|
7493
|
+
}
|
|
7494
|
+
const projectName = args?.project_name;
|
|
7495
|
+
if (projectName) {
|
|
7496
|
+
return `project_name:${projectName}`;
|
|
7497
|
+
}
|
|
7498
|
+
} else if (this.parentObjectType === 1 /* EXPERIMENT */) {
|
|
7499
|
+
const syncResult = this.parentObjectId.getSync();
|
|
7500
|
+
const id = syncResult.value;
|
|
7501
|
+
if (!syncResult.resolved) {
|
|
7502
|
+
this.parentObjectId.get().catch(() => {
|
|
7503
|
+
});
|
|
7504
|
+
}
|
|
7505
|
+
if (id) {
|
|
7506
|
+
return `experiment_id:${id}`;
|
|
7507
|
+
}
|
|
7508
|
+
}
|
|
7509
|
+
} catch (e) {
|
|
7510
|
+
}
|
|
7511
|
+
return void 0;
|
|
7512
|
+
}
|
|
7443
7513
|
// Custom inspect for Node.js console.log
|
|
7444
7514
|
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
7445
7515
|
return `SpanImpl {
|
|
@@ -7496,6 +7566,9 @@ View complete results in Braintrust or run experiment.summarize() again.`
|
|
|
7496
7566
|
return (await this.lazyMetadata.get()).project;
|
|
7497
7567
|
})();
|
|
7498
7568
|
}
|
|
7569
|
+
get loggingState() {
|
|
7570
|
+
return this.state;
|
|
7571
|
+
}
|
|
7499
7572
|
async getState() {
|
|
7500
7573
|
await this.lazyMetadata.get();
|
|
7501
7574
|
return this.state;
|
|
@@ -8123,45 +8196,41 @@ var init_version = __esm({
|
|
|
8123
8196
|
}
|
|
8124
8197
|
});
|
|
8125
8198
|
|
|
8126
|
-
// ../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.
|
|
8199
|
+
// ../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.37.0/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/SemanticAttributes.js
|
|
8127
8200
|
var init_SemanticAttributes = __esm({
|
|
8128
|
-
"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.
|
|
8201
|
+
"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.37.0/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/SemanticAttributes.js"() {
|
|
8129
8202
|
"use strict";
|
|
8130
8203
|
}
|
|
8131
8204
|
});
|
|
8132
8205
|
|
|
8133
|
-
// ../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.
|
|
8206
|
+
// ../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.37.0/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/index.js
|
|
8134
8207
|
var init_trace = __esm({
|
|
8135
|
-
"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.
|
|
8208
|
+
"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.37.0/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/index.js"() {
|
|
8136
8209
|
"use strict";
|
|
8137
8210
|
init_SemanticAttributes();
|
|
8138
8211
|
}
|
|
8139
8212
|
});
|
|
8140
8213
|
|
|
8141
|
-
// ../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.
|
|
8214
|
+
// ../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.37.0/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/SemanticResourceAttributes.js
|
|
8142
8215
|
var init_SemanticResourceAttributes = __esm({
|
|
8143
|
-
"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.
|
|
8216
|
+
"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.37.0/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/SemanticResourceAttributes.js"() {
|
|
8144
8217
|
"use strict";
|
|
8145
8218
|
}
|
|
8146
8219
|
});
|
|
8147
8220
|
|
|
8148
|
-
// ../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.
|
|
8221
|
+
// ../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.37.0/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/index.js
|
|
8149
8222
|
var init_resource = __esm({
|
|
8150
|
-
"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.
|
|
8223
|
+
"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.37.0/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/index.js"() {
|
|
8151
8224
|
"use strict";
|
|
8152
8225
|
init_SemanticResourceAttributes();
|
|
8153
8226
|
}
|
|
8154
8227
|
});
|
|
8155
8228
|
|
|
8156
|
-
// ../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.
|
|
8157
|
-
var
|
|
8229
|
+
// ../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.37.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js
|
|
8230
|
+
var ATTR_TELEMETRY_SDK_LANGUAGE, TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS, ATTR_TELEMETRY_SDK_NAME, ATTR_TELEMETRY_SDK_VERSION;
|
|
8158
8231
|
var init_stable_attributes = __esm({
|
|
8159
|
-
"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.
|
|
8232
|
+
"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.37.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js"() {
|
|
8160
8233
|
"use strict";
|
|
8161
|
-
ATTR_EXCEPTION_MESSAGE = "exception.message";
|
|
8162
|
-
ATTR_EXCEPTION_STACKTRACE = "exception.stacktrace";
|
|
8163
|
-
ATTR_EXCEPTION_TYPE = "exception.type";
|
|
8164
|
-
ATTR_SERVICE_NAME = "service.name";
|
|
8165
8234
|
ATTR_TELEMETRY_SDK_LANGUAGE = "telemetry.sdk.language";
|
|
8166
8235
|
TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS = "nodejs";
|
|
8167
8236
|
ATTR_TELEMETRY_SDK_NAME = "telemetry.sdk.name";
|
|
@@ -8169,21 +8238,29 @@ var init_stable_attributes = __esm({
|
|
|
8169
8238
|
}
|
|
8170
8239
|
});
|
|
8171
8240
|
|
|
8172
|
-
// ../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.
|
|
8241
|
+
// ../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.37.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_metrics.js
|
|
8173
8242
|
var init_stable_metrics = __esm({
|
|
8174
|
-
"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.
|
|
8243
|
+
"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.37.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_metrics.js"() {
|
|
8175
8244
|
"use strict";
|
|
8176
8245
|
}
|
|
8177
8246
|
});
|
|
8178
8247
|
|
|
8179
|
-
// ../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.
|
|
8248
|
+
// ../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.37.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_events.js
|
|
8249
|
+
var init_stable_events = __esm({
|
|
8250
|
+
"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.37.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_events.js"() {
|
|
8251
|
+
"use strict";
|
|
8252
|
+
}
|
|
8253
|
+
});
|
|
8254
|
+
|
|
8255
|
+
// ../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.37.0/node_modules/@opentelemetry/semantic-conventions/build/esm/index.js
|
|
8180
8256
|
var init_esm2 = __esm({
|
|
8181
|
-
"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.
|
|
8257
|
+
"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.37.0/node_modules/@opentelemetry/semantic-conventions/build/esm/index.js"() {
|
|
8182
8258
|
"use strict";
|
|
8183
8259
|
init_trace();
|
|
8184
8260
|
init_resource();
|
|
8185
8261
|
init_stable_attributes();
|
|
8186
8262
|
init_stable_metrics();
|
|
8263
|
+
init_stable_events();
|
|
8187
8264
|
}
|
|
8188
8265
|
});
|
|
8189
8266
|
|
|
@@ -8587,6 +8664,69 @@ var init_esm3 = __esm({
|
|
|
8587
8664
|
}
|
|
8588
8665
|
});
|
|
8589
8666
|
|
|
8667
|
+
// ../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.32.0/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/SemanticAttributes.js
|
|
8668
|
+
var init_SemanticAttributes2 = __esm({
|
|
8669
|
+
"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.32.0/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/SemanticAttributes.js"() {
|
|
8670
|
+
"use strict";
|
|
8671
|
+
}
|
|
8672
|
+
});
|
|
8673
|
+
|
|
8674
|
+
// ../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.32.0/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/index.js
|
|
8675
|
+
var init_trace2 = __esm({
|
|
8676
|
+
"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.32.0/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/index.js"() {
|
|
8677
|
+
"use strict";
|
|
8678
|
+
init_SemanticAttributes2();
|
|
8679
|
+
}
|
|
8680
|
+
});
|
|
8681
|
+
|
|
8682
|
+
// ../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.32.0/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/SemanticResourceAttributes.js
|
|
8683
|
+
var init_SemanticResourceAttributes2 = __esm({
|
|
8684
|
+
"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.32.0/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/SemanticResourceAttributes.js"() {
|
|
8685
|
+
"use strict";
|
|
8686
|
+
}
|
|
8687
|
+
});
|
|
8688
|
+
|
|
8689
|
+
// ../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.32.0/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/index.js
|
|
8690
|
+
var init_resource2 = __esm({
|
|
8691
|
+
"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.32.0/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/index.js"() {
|
|
8692
|
+
"use strict";
|
|
8693
|
+
init_SemanticResourceAttributes2();
|
|
8694
|
+
}
|
|
8695
|
+
});
|
|
8696
|
+
|
|
8697
|
+
// ../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.32.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js
|
|
8698
|
+
var ATTR_EXCEPTION_MESSAGE, ATTR_EXCEPTION_STACKTRACE, ATTR_EXCEPTION_TYPE, ATTR_SERVICE_NAME, ATTR_TELEMETRY_SDK_LANGUAGE2, ATTR_TELEMETRY_SDK_NAME2, ATTR_TELEMETRY_SDK_VERSION2;
|
|
8699
|
+
var init_stable_attributes2 = __esm({
|
|
8700
|
+
"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.32.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js"() {
|
|
8701
|
+
"use strict";
|
|
8702
|
+
ATTR_EXCEPTION_MESSAGE = "exception.message";
|
|
8703
|
+
ATTR_EXCEPTION_STACKTRACE = "exception.stacktrace";
|
|
8704
|
+
ATTR_EXCEPTION_TYPE = "exception.type";
|
|
8705
|
+
ATTR_SERVICE_NAME = "service.name";
|
|
8706
|
+
ATTR_TELEMETRY_SDK_LANGUAGE2 = "telemetry.sdk.language";
|
|
8707
|
+
ATTR_TELEMETRY_SDK_NAME2 = "telemetry.sdk.name";
|
|
8708
|
+
ATTR_TELEMETRY_SDK_VERSION2 = "telemetry.sdk.version";
|
|
8709
|
+
}
|
|
8710
|
+
});
|
|
8711
|
+
|
|
8712
|
+
// ../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.32.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_metrics.js
|
|
8713
|
+
var init_stable_metrics2 = __esm({
|
|
8714
|
+
"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.32.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_metrics.js"() {
|
|
8715
|
+
"use strict";
|
|
8716
|
+
}
|
|
8717
|
+
});
|
|
8718
|
+
|
|
8719
|
+
// ../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.32.0/node_modules/@opentelemetry/semantic-conventions/build/esm/index.js
|
|
8720
|
+
var init_esm4 = __esm({
|
|
8721
|
+
"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.32.0/node_modules/@opentelemetry/semantic-conventions/build/esm/index.js"() {
|
|
8722
|
+
"use strict";
|
|
8723
|
+
init_trace2();
|
|
8724
|
+
init_resource2();
|
|
8725
|
+
init_stable_attributes2();
|
|
8726
|
+
init_stable_metrics2();
|
|
8727
|
+
}
|
|
8728
|
+
});
|
|
8729
|
+
|
|
8590
8730
|
// ../../node_modules/.pnpm/@opentelemetry+resources@2.0.1_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/resources/build/esm/platform/node/default-service-name.js
|
|
8591
8731
|
function defaultServiceName() {
|
|
8592
8732
|
return `unknown_service:${process.argv0}`;
|
|
@@ -8631,9 +8771,9 @@ function resourceFromAttributes(attributes) {
|
|
|
8631
8771
|
function defaultResource() {
|
|
8632
8772
|
return resourceFromAttributes({
|
|
8633
8773
|
[ATTR_SERVICE_NAME]: defaultServiceName(),
|
|
8634
|
-
[
|
|
8635
|
-
[
|
|
8636
|
-
[
|
|
8774
|
+
[ATTR_TELEMETRY_SDK_LANGUAGE2]: SDK_INFO[ATTR_TELEMETRY_SDK_LANGUAGE2],
|
|
8775
|
+
[ATTR_TELEMETRY_SDK_NAME2]: SDK_INFO[ATTR_TELEMETRY_SDK_NAME2],
|
|
8776
|
+
[ATTR_TELEMETRY_SDK_VERSION2]: SDK_INFO[ATTR_TELEMETRY_SDK_VERSION2]
|
|
8637
8777
|
});
|
|
8638
8778
|
}
|
|
8639
8779
|
function guardedRawAttributes(attributes) {
|
|
@@ -8656,7 +8796,7 @@ var init_ResourceImpl = __esm({
|
|
|
8656
8796
|
"use strict";
|
|
8657
8797
|
init_esm();
|
|
8658
8798
|
init_esm3();
|
|
8659
|
-
|
|
8799
|
+
init_esm4();
|
|
8660
8800
|
init_platform2();
|
|
8661
8801
|
init_utils();
|
|
8662
8802
|
ResourceImpl = class _ResourceImpl {
|
|
@@ -8730,7 +8870,7 @@ var init_ResourceImpl = __esm({
|
|
|
8730
8870
|
});
|
|
8731
8871
|
|
|
8732
8872
|
// ../../node_modules/.pnpm/@opentelemetry+resources@2.0.1_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/resources/build/esm/index.js
|
|
8733
|
-
var
|
|
8873
|
+
var init_esm5 = __esm({
|
|
8734
8874
|
"../../node_modules/.pnpm/@opentelemetry+resources@2.0.1_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/resources/build/esm/index.js"() {
|
|
8735
8875
|
"use strict";
|
|
8736
8876
|
init_ResourceImpl();
|
|
@@ -8753,7 +8893,7 @@ var init_Span = __esm({
|
|
|
8753
8893
|
"use strict";
|
|
8754
8894
|
init_esm();
|
|
8755
8895
|
init_esm3();
|
|
8756
|
-
|
|
8896
|
+
init_esm4();
|
|
8757
8897
|
init_enums();
|
|
8758
8898
|
SpanImpl2 = class {
|
|
8759
8899
|
// Below properties are included to implement ReadableSpan for export
|
|
@@ -9682,7 +9822,7 @@ var init_BasicTracerProvider = __esm({
|
|
|
9682
9822
|
"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.0.1_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/sdk-trace-base/build/esm/BasicTracerProvider.js"() {
|
|
9683
9823
|
"use strict";
|
|
9684
9824
|
init_esm3();
|
|
9685
|
-
|
|
9825
|
+
init_esm5();
|
|
9686
9826
|
init_Tracer();
|
|
9687
9827
|
init_config();
|
|
9688
9828
|
init_MultiSpanProcessor();
|
|
@@ -9959,7 +10099,7 @@ __export(esm_exports2, {
|
|
|
9959
10099
|
SimpleSpanProcessor: () => SimpleSpanProcessor,
|
|
9960
10100
|
TraceIdRatioBasedSampler: () => TraceIdRatioBasedSampler
|
|
9961
10101
|
});
|
|
9962
|
-
var
|
|
10102
|
+
var init_esm6 = __esm({
|
|
9963
10103
|
"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.0.1_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/sdk-trace-base/build/esm/index.js"() {
|
|
9964
10104
|
"use strict";
|
|
9965
10105
|
init_BasicTracerProvider();
|
|
@@ -10169,7 +10309,7 @@ var init_ExportResult2 = __esm({
|
|
|
10169
10309
|
});
|
|
10170
10310
|
|
|
10171
10311
|
// ../../node_modules/.pnpm/@opentelemetry+core@2.0.0_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/core/build/esm/index.js
|
|
10172
|
-
var
|
|
10312
|
+
var init_esm7 = __esm({
|
|
10173
10313
|
"../../node_modules/.pnpm/@opentelemetry+core@2.0.0_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/core/build/esm/index.js"() {
|
|
10174
10314
|
"use strict";
|
|
10175
10315
|
init_time2();
|
|
@@ -10207,7 +10347,7 @@ var OTLPExportDelegate;
|
|
|
10207
10347
|
var init_otlp_export_delegate = __esm({
|
|
10208
10348
|
"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.200.0_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/otlp-exporter-base/build/esm/otlp-export-delegate.js"() {
|
|
10209
10349
|
"use strict";
|
|
10210
|
-
|
|
10350
|
+
init_esm7();
|
|
10211
10351
|
init_types();
|
|
10212
10352
|
init_logging_response_handler();
|
|
10213
10353
|
init_esm();
|
|
@@ -10293,7 +10433,7 @@ var init_otlp_export_delegate = __esm({
|
|
|
10293
10433
|
});
|
|
10294
10434
|
|
|
10295
10435
|
// ../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.200.0_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/otlp-exporter-base/build/esm/index.js
|
|
10296
|
-
var
|
|
10436
|
+
var init_esm8 = __esm({
|
|
10297
10437
|
"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.200.0_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/otlp-exporter-base/build/esm/index.js"() {
|
|
10298
10438
|
"use strict";
|
|
10299
10439
|
init_OTLPExporterBase();
|
|
@@ -10377,7 +10517,7 @@ var encodeTimestamp, DEFAULT_ENCODER;
|
|
|
10377
10517
|
var init_utils3 = __esm({
|
|
10378
10518
|
"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.200.0_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/otlp-transformer/build/esm/common/utils.js"() {
|
|
10379
10519
|
"use strict";
|
|
10380
|
-
|
|
10520
|
+
init_esm7();
|
|
10381
10521
|
init_hex_to_binary();
|
|
10382
10522
|
encodeTimestamp = typeof BigInt !== "undefined" ? encodeAsString : hrTimeToNanoseconds2;
|
|
10383
10523
|
DEFAULT_ENCODER = {
|
|
@@ -10550,7 +10690,7 @@ var init_internal2 = __esm({
|
|
|
10550
10690
|
|
|
10551
10691
|
// ../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.200.0_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/otlp-transformer/build/esm/trace/json/trace.js
|
|
10552
10692
|
var JsonTraceSerializer;
|
|
10553
|
-
var
|
|
10693
|
+
var init_trace3 = __esm({
|
|
10554
10694
|
"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.200.0_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/otlp-transformer/build/esm/trace/json/trace.js"() {
|
|
10555
10695
|
"use strict";
|
|
10556
10696
|
init_internal2();
|
|
@@ -10575,12 +10715,12 @@ var init_trace2 = __esm({
|
|
|
10575
10715
|
var init_json = __esm({
|
|
10576
10716
|
"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.200.0_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/otlp-transformer/build/esm/trace/json/index.js"() {
|
|
10577
10717
|
"use strict";
|
|
10578
|
-
|
|
10718
|
+
init_trace3();
|
|
10579
10719
|
}
|
|
10580
10720
|
});
|
|
10581
10721
|
|
|
10582
10722
|
// ../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.200.0_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/otlp-transformer/build/esm/index.js
|
|
10583
|
-
var
|
|
10723
|
+
var init_esm9 = __esm({
|
|
10584
10724
|
"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.200.0_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/otlp-transformer/build/esm/index.js"() {
|
|
10585
10725
|
"use strict";
|
|
10586
10726
|
init_json();
|
|
@@ -11011,7 +11151,7 @@ function getHttpConfigurationFromEnvironment(signalIdentifier, signalResourcePat
|
|
|
11011
11151
|
var init_otlp_http_env_configuration = __esm({
|
|
11012
11152
|
"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.200.0_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/otlp-http-env-configuration.js"() {
|
|
11013
11153
|
"use strict";
|
|
11014
|
-
|
|
11154
|
+
init_esm7();
|
|
11015
11155
|
init_esm();
|
|
11016
11156
|
init_shared_env_configuration();
|
|
11017
11157
|
init_shared_configuration();
|
|
@@ -11070,9 +11210,9 @@ var OTLPTraceExporter;
|
|
|
11070
11210
|
var init_OTLPTraceExporter = __esm({
|
|
11071
11211
|
"../../node_modules/.pnpm/@opentelemetry+exporter-trace-otlp-http@0.200.0_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/exporter-trace-otlp-http/build/esm/platform/node/OTLPTraceExporter.js"() {
|
|
11072
11212
|
"use strict";
|
|
11073
|
-
init_esm7();
|
|
11074
|
-
init_version2();
|
|
11075
11213
|
init_esm8();
|
|
11214
|
+
init_version2();
|
|
11215
|
+
init_esm9();
|
|
11076
11216
|
init_index_node_http();
|
|
11077
11217
|
OTLPTraceExporter = class extends OTLPExporterBase {
|
|
11078
11218
|
constructor(config = {}) {
|
|
@@ -11106,7 +11246,7 @@ var esm_exports3 = {};
|
|
|
11106
11246
|
__export(esm_exports3, {
|
|
11107
11247
|
OTLPTraceExporter: () => OTLPTraceExporter
|
|
11108
11248
|
});
|
|
11109
|
-
var
|
|
11249
|
+
var init_esm10 = __esm({
|
|
11110
11250
|
"../../node_modules/.pnpm/@opentelemetry+exporter-trace-otlp-http@0.200.0_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/exporter-trace-otlp-http/build/esm/index.js"() {
|
|
11111
11251
|
"use strict";
|
|
11112
11252
|
init_platform4();
|
|
@@ -11391,6 +11531,7 @@ __export(exports_node_exports, {
|
|
|
11391
11531
|
FailedHTTPResponse: () => FailedHTTPResponse,
|
|
11392
11532
|
IDGenerator: () => IDGenerator,
|
|
11393
11533
|
INTERNAL_BTQL_LIMIT: () => INTERNAL_BTQL_LIMIT,
|
|
11534
|
+
JSONAttachment: () => JSONAttachment,
|
|
11394
11535
|
LEGACY_CACHED_HEADER: () => LEGACY_CACHED_HEADER,
|
|
11395
11536
|
LazyValue: () => LazyValue,
|
|
11396
11537
|
Logger: () => Logger,
|
|
@@ -13164,6 +13305,9 @@ async function Eval(name, evaluator, reporterOrOpts) {
|
|
|
13164
13305
|
repoInfo: evaluator.repoInfo,
|
|
13165
13306
|
dataset: Dataset2.isDataset(data) ? data : void 0
|
|
13166
13307
|
});
|
|
13308
|
+
if (experiment && typeof process !== "undefined" && process.env?.BRAINTRUST_OTEL_COMPAT?.toLowerCase() === "true") {
|
|
13309
|
+
await experiment._waitForId();
|
|
13310
|
+
}
|
|
13167
13311
|
if (experiment && options.onStart) {
|
|
13168
13312
|
const summary = await experiment.summarize({ summarizeScores: false });
|
|
13169
13313
|
options.onStart(summary);
|
|
@@ -16344,7 +16488,7 @@ var otelSdk = null;
|
|
|
16344
16488
|
var OTEL_AVAILABLE2 = false;
|
|
16345
16489
|
try {
|
|
16346
16490
|
otelApi = (init_esm(), __toCommonJS(esm_exports));
|
|
16347
|
-
otelSdk = (
|
|
16491
|
+
otelSdk = (init_esm6(), __toCommonJS(esm_exports2));
|
|
16348
16492
|
OTEL_AVAILABLE2 = true;
|
|
16349
16493
|
} catch {
|
|
16350
16494
|
console.warn(
|
|
@@ -16481,7 +16625,7 @@ var BraintrustSpanProcessor = class _BraintrustSpanProcessor {
|
|
|
16481
16625
|
try {
|
|
16482
16626
|
const {
|
|
16483
16627
|
OTLPTraceExporter: OTLPTraceExporter2
|
|
16484
|
-
} = (
|
|
16628
|
+
} = (init_esm10(), __toCommonJS(esm_exports3));
|
|
16485
16629
|
const headers = {
|
|
16486
16630
|
Authorization: `Bearer ${apiKey}`,
|
|
16487
16631
|
"Content-Type": "application/json",
|
|
@@ -16706,6 +16850,7 @@ export {
|
|
|
16706
16850
|
FailedHTTPResponse,
|
|
16707
16851
|
IDGenerator,
|
|
16708
16852
|
INTERNAL_BTQL_LIMIT,
|
|
16853
|
+
JSONAttachment,
|
|
16709
16854
|
LEGACY_CACHED_HEADER,
|
|
16710
16855
|
LazyValue,
|
|
16711
16856
|
Logger,
|