-
Notifications
You must be signed in to change notification settings - Fork 6
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
feat: initial web vitals instrumentation #84
Conversation
|
||
if (this.vitalsToTrack.includes('LCP')) { | ||
onLCP((vital) => { | ||
this.onReportLCP(vital); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went back and forth a lot on whether to make these separate onReport
functions, or whether to make a single generic one. I found that the types and tests worked out a lot better with them all being more specific.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i ❤️ the separate functions
SimpleSpanProcessor, | ||
} from '@opentelemetry/sdk-trace-base'; | ||
|
||
describe('Web Vitals Instrumentation Tests', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For tests, decided to focus on the spans being generated instead of whether the web vitals functions fire when they're supposed to since that's covered in the tests for the web-vitals library. Will eventually want to write smoke tests for this but will make that a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
beautiful!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great!
}, | ||
) { | ||
super('@honeycombio/instrumentation-web-vitals', '0.0.1', { | ||
// NOTE: this is an unfortunate necessity to initially set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for adding a detailed note here!
Which problem is this PR solving?
Adds basic web vitals span based auto-instrumentation. Heavily based on what will be available upstream, with the main difference being that the upstream instrumentation will be based on events, we'll have to support that down the line as well.
Should align very closely with the spec laid out in #61
Short description of the changes
Out of scope for this PR
This PR is really aimed at getting the base instrumentation into the package so there will be follow up work to:
How to verify that this has the expected result