Skip to content

Conversation

@schickling
Copy link
Contributor

Summary

Fix Span.addEvent to correctly distinguish TimeInput from Attributes when called with 2 arguments. Previously, span.addEvent('name', { foo: 'bar' }) would throw TypeError: {} is not iterable.

Changes

  • Added isTimeInput helper to distinguish between TimeInput (number, Date, or [seconds, nanos] tuple) and Attributes (plain object)
  • Updated addEvent overload resolution to inspect the second argument at runtime
  • Added 6 regression tests covering all overload combinations

Test Results

All tests pass: 21/21 tests passing in opentelemetry package (14 total, +6 new regression tests for addEvent overloads)

Fix Span.addEvent to correctly distinguish TimeInput (number, Date, [seconds, nanos]) from Attributes (plain object) when called with 2 arguments. Previously, span.addEvent('name', { foo: 'bar' }) would throw TypeError because attributes were incorrectly treated as TimeInput.

🤖 Generated with Claude Code

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@github-project-automation github-project-automation bot moved this to Discussion Ongoing in PR Backlog Dec 21, 2025
@changeset-bot
Copy link

changeset-bot bot commented Dec 21, 2025

🦋 Changeset detected

Latest commit: 86ee73b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@effect/opentelemetry Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants