-
Notifications
You must be signed in to change notification settings - Fork 48
feat: make context.active() the default value for certain context functions #30
Conversation
Codecov Report
@@ Coverage Diff @@
## main #30 +/- ##
==========================================
+ Coverage 94.64% 94.65% +0.01%
==========================================
Files 39 39
Lines 504 505 +1
Branches 81 84 +3
==========================================
+ Hits 477 478 +1
Misses 27 27
Continue to review full report at Codecov.
|
84ec2be
to
ccc3599
Compare
ccc3599
to
50c323c
Compare
breaks setSpan as it reverses the order of params Signed-off-by: naseemkullah <[email protected]>
50c323c
to
d48ab7f
Compare
Signed-off-by: naseemkullah <[email protected]>
In the past we have been moving in the opposite direction. For low-level API primitives we have typically considered it to be better to have more explicit parameters. /cc @Flarna because I know you've expressed opinions in the past that you believe we already have too many cases where context has a default value of |
I removed the The helper functions here are somewhat different as they are used more frequently at places where I'm not a big fan of using references to globals in default arguments as it makes it terrible hard to consistent use non global I'm also not sure if a breaking change is still acceptable in current stage (see #15 (comment)). |
Thanks for the detailed explanation! Closing |
functions where I'm adding a default context as
context.active()
, based on searching the otel-js repo for their invocations:getSpan()
setSpan()
suppressInstrumentation()
💥 breaks
setSpan()
as it reverses the order of params.This PR also serves a discussion. Is this a better default or not?
Pros: it will reduce boilerplate code, helper functions aside/when working with lowest level api
Cons: ?