Skip to content

feat(ai): remove telemetry data from the user-facing event data#14606

Merged
aayush-kapoor merged 17 commits intomainfrom
aayush/remove-tel-event-data
Apr 21, 2026
Merged

feat(ai): remove telemetry data from the user-facing event data#14606
aayush-kapoor merged 17 commits intomainfrom
aayush/remove-tel-event-data

Conversation

@aayush-kapoor
Copy link
Copy Markdown
Collaborator

@aayush-kapoor aayush-kapoor commented Apr 17, 2026

Background

We were passing telemetry options/data to every core event which was not needed (at least not for the user facing events)

Summary

Changed it so that the telemetry data is passed when unifying user facing callbacks with the provider facing ones so that provider implementations of Telemetry interface still get all the information.

This is verified by some tests breaking in ai and no tests breaking in otel / devtools package

Manual Verification

verified by running the example examples/ai-functions/src/generate-text/anthropic/subagent-with-telemetry.ts - the functionID defined in this example is still observed in the final trace

Checklist

  • Tests have been added / updated (for bug fixes / features)
  • Documentation has been added / updated (for bug fixes / features)
  • A patch changeset for relevant packages has been added (for bug fixes / features - run pnpm changeset in the project root)
  • I have reviewed this pull request (self-review)

Future Work

  • look into adding a type: event-type property to core-events

@tigent tigent Bot added ai/core core functions like generateText, streamText, etc. Provider utils, and provider spec. maintenance CI, internal documentation, automations, etc labels Apr 17, 2026
Comment thread packages/ai/src/telemetry/create-telemetry-dispatcher.ts
@aayush-kapoor aayush-kapoor added the major marker for PRs with major version bump label Apr 17, 2026
Comment thread .changeset/short-carrots-sell.md
Comment thread packages/ai/src/telemetry/telemetry.ts Outdated
Comment thread packages/ai/src/telemetry/create-telemetry-dispatcher.ts
Comment thread packages/ai/src/telemetry/create-unified-telemetry.ts Outdated
Comment thread packages/ai/src/telemetry/create-telemetry-dispatcher.ts
Comment thread packages/ai/src/telemetry/create-telemetry-dispatcher.ts Outdated
Comment thread packages/ai/src/telemetry/create-unified-telemetry.ts Outdated
Comment thread packages/ai/src/telemetry/telemetry.ts Outdated

export type TelemetryEvent<EVENT> = EVENT & TelemetryMetadata;

type OperationStartEvent =
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wonder if separate event handlers would be better. otherwise we need event type ids.

Comment thread packages/ai/src/telemetry/index.ts
Comment thread packages/ai/src/generate-text/generate-text.ts Outdated
@aayush-kapoor aayush-kapoor merged commit 116c89f into main Apr 21, 2026
17 checks passed
@aayush-kapoor aayush-kapoor deleted the aayush/remove-tel-event-data branch April 21, 2026 15:45
aayush-kapoor added a commit that referenced this pull request Apr 23, 2026
## Background

as a follow up to the PR #14654 and
#14606, we had to continue removing and
aligning the event data sent at each callback in the lifecycle

## Summary

- `prompt` property removed and `StandardizedPrompt` used instead
- `stepNumber` removed and made to derive from the `steps`
- `interface` -> `type` used
- properties that have overlap with `langaugeModelCallOptions` were
stripped and made to use that type
 
## Manual Verification

na

## Checklist

- [x] Tests have been added / updated (for bug fixes / features)
- [ ] Documentation has been added / updated (for bug fixes / features)
- [x] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] I have reviewed this pull request (self-review)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai/core core functions like generateText, streamText, etc. Provider utils, and provider spec. maintenance CI, internal documentation, automations, etc major marker for PRs with major version bump

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants