-
Notifications
You must be signed in to change notification settings - Fork 846
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
refactor(instrumentation-http): migrate away from getEnv() #5469
refactor(instrumentation-http): migrate away from getEnv() #5469
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5469 +/- ##
=======================================
Coverage 94.93% 94.93%
=======================================
Files 309 309
Lines 8002 8002
Branches 1686 1686
=======================================
Hits 7597 7597
Misses 405 405 |
@@ -108,7 +106,8 @@ export class HttpInstrumentation extends InstrumentationBase<HttpInstrumentation | |||
super('@opentelemetry/instrumentation-http', VERSION, config); | |||
this._headerCapture = this._createHeaderCapture(); | |||
|
|||
for (const entry of getEnv().OTEL_SEMCONV_STABILITY_OPT_IN) { | |||
for (const entry of getStringListFromEnv('OTEL_SEMCONV_STABILITY_OPT_IN') ?? | |||
[]) { |
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.
Sometimes prettier
is trolling.
hrTime, | ||
hrTimeDuration, | ||
hrTimeToMilliseconds, | ||
suppressTracing, | ||
RPCMetadata, |
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 wonder if we should use a lint rule for this. Probably is difficult because sometimes the import order matters and is not just code style.
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 think a lint rule could be helpful. 👍 I don't think there's a case where we'd split importing from the same package, most of the time when import order matters it's from different packages, so we'd do:
import {a} from 'my-package';
// doing some stuff
import {b} from 'other-package';
but not
import {a} from 'my-package';
// doing some stuff
import {b} from 'my-package';
Which problem is this PR solving?
Migrates away from
getEnv()
to the new functions and inline-defaults introduced in #5443. Since the HTTP instrumentation can only be used on Node.js, everything stays as-is for the end-user. This is a pure refactor.Refs #5217
Type of change
How Has This Been Tested?