Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[@opentelemetry/instrumentation-user-interaction] No spans created without Zone.js #1750

Open
pkanal opened this issue Oct 20, 2023 · 0 comments
Assignees
Labels
bug Something isn't working has:reproducer This bug/feature has a minimal reproduction provided pkg:instrumentation-user-interaction priority:p2 Bugs and spec inconsistencies which cause telemetry to be incomplete or incorrect

Comments

@pkanal
Copy link
Contributor

pkanal commented Oct 20, 2023

What version of OpenTelemetry are you using?

  "@opentelemetry/api": "^1.4.1",
  "@opentelemetry/context-zone": "^1.15.1",
  "@opentelemetry/exporter-trace-otlp-http": "^0.41.1",
  "@opentelemetry/instrumentation-user-interaction": "^0.33.2",

What version of Node are you using?

v16

What did you do?

Scenario 1:

  1. Installed the user interaction auto-instrumentation
  2. Initialized it in OTel config
  3. Zone Context Manager is present
  4. Ran the app and expected to see click traces

Scenario 2:

  1. Installed the user interaction auto-instrumentation
  2. Initialized it in OTel config
  3. Zone Context Manager is not present
  4. Ran the app and expected to see click traces

Here is a branch to see the code I was testing this with: https://github.com/honeycombio/example-greeting-service/tree/purvi/user-interaction-repro

What did you expect to see?

In both cases, expected to see spans for all click events on a button and a link.

What did you see instead?

Scenario 1: Saw spans created for the click event from only a button, not a link
Scenario 2: Did not see any spans created

Additional context

I dug into the code a little bit and found that while the addEventListener and removeEventListener functions were being patched by the instrumentation, the event listeners were never actually being registered. So I tested manually adding an event listener for click events in my app setup code and then the instrumentation worked as expected. I've drafted a PR for the instrumentation to add event listeners for each of the events on init as a potential fix to this and tested it it out locally. Here's the PR: #1749

@pkanal pkanal added the bug Something isn't working label Oct 20, 2023
@pkanal pkanal changed the title [@opentelemetry/instrumentation-user-interation] No spans created without Zone.js [@opentelemetry/instrumentation-user-interaction] No spans created without Zone.js Oct 23, 2023
@dyladan dyladan added the has:reproducer This bug/feature has a minimal reproduction provided label Oct 25, 2023
@pichlermarc pichlermarc added the priority:p2 Bugs and spec inconsistencies which cause telemetry to be incomplete or incorrect label Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working has:reproducer This bug/feature has a minimal reproduction provided pkg:instrumentation-user-interaction priority:p2 Bugs and spec inconsistencies which cause telemetry to be incomplete or incorrect
Projects
None yet
3 participants