Skip to content

Support first contentful paint event in document load plugin #2725

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

Open
8tme opened this issue Feb 20, 2025 · 4 comments
Open

Support first contentful paint event in document load plugin #2725

8tme opened this issue Feb 20, 2025 · 4 comments

Comments

@8tme
Copy link

8tme commented Feb 20, 2025

What happened?

What happened?

What happened?

Steps to Reproduce

use like this in my react app

  registerInstrumentations({
    instrumentations: [
      new DocumentLoadInstrumentation({}),
    ],
  })

Expected Result

document load span whith 11 events

Image

Actual Result

document load span whith 9 events

Image

Additional Details

After a meticulous investigation, I have identified several potential causes that lead to this issue. when executing

if (!this.getConfig().ignoreNetworkEvents) {
        addSpanNetworkEvents(span, resource);
}

otperformance is always an empty array. I realize that this can only be achieved through asynchronous retrieval.

the code is located here

by the way, why wasn't there a distinction between node and browser when introducing the platform in opentelemetry-core?

@8tme 8tme added bug Something isn't working triage labels Feb 20, 2025
@pichlermarc pichlermarc transferred this issue from open-telemetry/opentelemetry-js Feb 20, 2025
@pichlermarc
Copy link
Member

cc @pkanal @martinkuba (component owners)

@dyladan dyladan added enhancement New feature or request and removed bug Something isn't working triage labels Mar 5, 2025
@dyladan dyladan changed the title document load instrumentation cant trace FCP Support first contentful paint event in document load plugin Mar 5, 2025
@dyladan
Copy link
Member

dyladan commented Mar 5, 2025

This instrumentation is not indicative of the direction the client/browser SIG is planning to go. It will be rewritten when there is a good specification for browser events. This work is ongoing but I don't think this instrumentation is likely to get any real enhancements before then.

@8tme
Copy link
Author

8tme commented Mar 12, 2025

This instrumentation is not indicative of the direction the client/browser SIG is planning to go. It will be rewritten when there is a good specification for browser events. This work is ongoing but I don't think this instrumentation is likely to get any real enhancements before then.

Why can't we set up an asynchronous task (e.g., with a 3-second delay) to collect the network spans, even if we can't guarantee that FCP has occurred by then? For example, we could set a timeout of 3 seconds, and if after that time we still haven't collected the data, it would indicate an inherent issue with the page itself.

@8tme
Copy link
Author

8tme commented Mar 12, 2025

be like this
const GET_FCP_DELAY = 3000; if (!this.getConfig().ignoreNetworkEvents) { setTimeout(() => addSpanNetworkEvents(span, resource), GET_FCP_DELAY) }

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

No branches or pull requests

3 participants