Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions docs/span-customization-hooks-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -1241,31 +1241,26 @@ span := braintrust.StartSpan(SpanConfig{
## Next Steps

1. **Requirements Validation**

- Validate with users across different languages
- Confirm use cases are addressed
- Gather feedback on API ergonomics

2. **Prototype Implementation**

- Build prototypes in JavaScript, Python, and Go
- Test with real auto-instrumentation scenarios
- Measure performance impact

3. **API Refinement**

- Finalize hook interface signatures
- Define error handling behavior
- Document edge cases

4. **Documentation**

- Write comprehensive guides with examples
- Create cookbook of common hook patterns
- Document best practices per language

5. **Implementation Rollout**

- Implement in priority languages first
- Gather early feedback
- Iterate and expand to remaining languages
Expand Down
5 changes: 2 additions & 3 deletions integrations/otel-js/examples/otel-v1/otel_compat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ async function main() {
// Try to import AsyncHooksContextManager - it's optional but required for context propagation
let AsyncHooksContextManager: any;
try {
const contextAsyncHooks = await import(
"@opentelemetry/context-async-hooks"
);
const contextAsyncHooks =
await import("@opentelemetry/context-async-hooks");
AsyncHooksContextManager = contextAsyncHooks.AsyncHooksContextManager;
} catch (e) {
console.error("⚠️ @opentelemetry/context-async-hooks not found.");
Expand Down
10 changes: 4 additions & 6 deletions integrations/otel-js/src/otel-compat.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -708,9 +708,8 @@ describe("Distributed Tracing (BT → OTEL)", () => {
});

test("otelContextFromSpanExport parses BT span and creates OTEL context", async () => {
const { contextFromSpanExport: otelContextFromSpanExport } = await import(
"./"
);
const { contextFromSpanExport: otelContextFromSpanExport } =
await import("./");
const { SpanComponentsV4 } = await import("braintrust/util");
const { SpanObjectTypeV3 } = await import("braintrust/util");

Expand Down Expand Up @@ -755,9 +754,8 @@ describe("Distributed Tracing (BT → OTEL)", () => {
test("BT span in Service A can be parent of OTEL span in Service B", async () => {
const { tracer, exporter, processor } =
setupOtelFixture("service-a-project");
const { contextFromSpanExport: otelContextFromSpanExport } = await import(
"./"
);
const { contextFromSpanExport: otelContextFromSpanExport } =
await import("./");

const projectName = "service-a-project";
const logger = initLogger({ projectName });
Expand Down
8 changes: 2 additions & 6 deletions integrations/temporal-js/src/workflow-interceptors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ interface WorkflowSpanState {
spanId: string | undefined;
}

class BraintrustWorkflowInboundInterceptor
implements WorkflowInboundCallsInterceptor
{
class BraintrustWorkflowInboundInterceptor implements WorkflowInboundCallsInterceptor {
constructor(private state: WorkflowSpanState) {}

async execute(
Expand Down Expand Up @@ -76,9 +74,7 @@ class BraintrustWorkflowInboundInterceptor
}
}

class BraintrustWorkflowOutboundInterceptor
implements WorkflowOutboundCallsInterceptor
{
class BraintrustWorkflowOutboundInterceptor implements WorkflowOutboundCallsInterceptor {
constructor(private state: WorkflowSpanState) {}

private getHeaders(): Record<string, Payload> {
Expand Down
3 changes: 0 additions & 3 deletions js/smoke/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,12 @@ Scenarios automatically create tarballs if they're not provided via environment
### Environment Variables

- **`BRAINTRUST_TAR`**: Path to braintrust tarball (auto-created if not set)

- Example: `../artifacts/braintrust-latest.tgz`

- **`BRAINTRUST_OTEL_TAR`**: Path to @braintrust/otel tarball (auto-created for scenarios that need it)

- Example: `../artifacts/braintrust-otel-latest.tgz`

- **`BRAINTRUST_TEMPLATES_NUNJUCKS_JS_TAR`**: Path to @braintrust/templates-nunjucks-js tarball

- Example: `../artifacts/braintrust-templates-nunjucks-js-latest.tgz`

- **`SMOKE_V2_SHARED_DIST`**: Path to shared test utilities (auto-built if not set)
Expand Down
3 changes: 0 additions & 3 deletions js/src/auto-instrumentations/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,19 +112,16 @@ The bundler plugins (Vite, Webpack, esbuild, Rollup) apply transformations durin
The plugin system follows the OpenTelemetry pattern:

- **Core Infrastructure**: `js/src/instrumentation/core/` in the main `braintrust` package

- `BasePlugin` - Abstract base class for plugins
- Channel utilities (`createChannelName`, `parseChannelName`, etc.)
- Event type definitions

- **Braintrust Implementation**: `js/src/instrumentation/braintrust-plugin.ts` in the main `braintrust` package

- `BraintrustPlugin` - Converts diagnostics_channel events into Braintrust spans
- Automatically enabled when the Braintrust SDK is loaded
- Supports configuration to disable specific integrations

- **Plugin Registry**: `js/src/instrumentation/registry.ts` in the main `braintrust` package

- `PluginRegistry` - Manages plugin lifecycle
- Automatically enables `BraintrustPlugin` on SDK initialization
- Reads configuration from `configureInstrumentation()` API and `BRAINTRUST_DISABLE_INSTRUMENTATION` environment variable
Expand Down
6 changes: 3 additions & 3 deletions js/src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5488,9 +5488,9 @@ export type WithTransactionId<R> = R & {
export const DEFAULT_FETCH_BATCH_SIZE = 1000;
export const MAX_BTQL_ITERATIONS = 10000;

export class ObjectFetcher<RecordType>
implements AsyncIterable<WithTransactionId<RecordType>>
{
export class ObjectFetcher<RecordType> implements AsyncIterable<
WithTransactionId<RecordType>
> {
private _fetchedData: WithTransactionId<RecordType>[] | undefined = undefined;

constructor(
Expand Down
35 changes: 14 additions & 21 deletions js/tests/auto-instrumentations/error-handling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,8 @@ describe("Error Handling", () => {

fs.writeFileSync(entryPoint, testCode);

const { esbuildPlugin } = await import(
"../../src/auto-instrumentations/bundler/esbuild.js"
);
const { esbuildPlugin } =
await import("../../src/auto-instrumentations/bundler/esbuild.js");

await esbuild.build({
entryPoints: [entryPoint],
Expand Down Expand Up @@ -137,9 +136,8 @@ describe("Error Handling", () => {

fs.writeFileSync(entryPoint, testCode);

const { esbuildPlugin } = await import(
"../../src/auto-instrumentations/bundler/esbuild.js"
);
const { esbuildPlugin } =
await import("../../src/auto-instrumentations/bundler/esbuild.js");

await esbuild.build({
entryPoints: [entryPoint],
Expand Down Expand Up @@ -189,9 +187,8 @@ describe("Error Handling", () => {

fs.writeFileSync(entryPoint, testCode);

const { esbuildPlugin } = await import(
"../../src/auto-instrumentations/bundler/esbuild.js"
);
const { esbuildPlugin } =
await import("../../src/auto-instrumentations/bundler/esbuild.js");

await esbuild.build({
entryPoints: [entryPoint],
Expand Down Expand Up @@ -234,9 +231,8 @@ describe("Error Handling", () => {

fs.writeFileSync(entryPoint, testCode);

const { esbuildPlugin } = await import(
"../../src/auto-instrumentations/bundler/esbuild.js"
);
const { esbuildPlugin } =
await import("../../src/auto-instrumentations/bundler/esbuild.js");

await esbuild.build({
entryPoints: [entryPoint],
Expand Down Expand Up @@ -288,9 +284,8 @@ describe("Error Handling", () => {

fs.writeFileSync(entryPoint, testCode);

const { esbuildPlugin } = await import(
"../../src/auto-instrumentations/bundler/esbuild.js"
);
const { esbuildPlugin } =
await import("../../src/auto-instrumentations/bundler/esbuild.js");

await esbuild.build({
entryPoints: [entryPoint],
Expand Down Expand Up @@ -344,9 +339,8 @@ describe("Error Handling", () => {

fs.writeFileSync(entryPoint, testCode);

const { esbuildPlugin } = await import(
"../../src/auto-instrumentations/bundler/esbuild.js"
);
const { esbuildPlugin } =
await import("../../src/auto-instrumentations/bundler/esbuild.js");

await esbuild.build({
entryPoints: [entryPoint],
Expand Down Expand Up @@ -409,9 +403,8 @@ describe("Error Handling", () => {

fs.writeFileSync(entryPoint, testCode);

const { esbuildPlugin } = await import(
"../../src/auto-instrumentations/bundler/esbuild.js"
);
const { esbuildPlugin } =
await import("../../src/auto-instrumentations/bundler/esbuild.js");

await esbuild.build({
entryPoints: [entryPoint],
Expand Down
Loading
Loading