Comments (5)
right, because the case expression is fully local, the branch is unique to each call-site.
I'm noticing that we already do some dynamic dispatch on otel_counter:add/4
:
I don't think adding a similar match in add/5
would be a problem, if anything it may increase consistency?
from opentelemetry-erlang.
The problem is the use of ?MODULE. We'd have to always pass the module for the meter to maybe be looked up in the counter module.
from opentelemetry-erlang.
An alternative is to make it a sort of "private API" function that the macro uses to create a layer of indirection but passes the union of all required context to.
like
-define(counter_add(NameOrInstrument, Number, Attributes),
otel_counter:'_macro_helper_add'(otel_ctx:get_current(), ?current_meter, NameOrInstrument, Number, Attributes)).
% [...] within otel_counter, maybe?
'_macro_helper_add'(Ctx, Meter, NameOrInstrument, Number, Attributes) ->
case is_atom(NameOrInstrument) of
true ->
add(Ctx, Meter, NameOrInstrument, Number, Attributes);
false ->
add(Ctx, NameOrInstrument, Number, Attributes)
end).
This looks like hot garbage internally but keeps macro usage unchanged.
I would however say that the arity confusion likely transfers to users of the app who aren't quite sure when to pass in the right data types?
from opentelemetry-erlang.
Hm, interesting idea.
Yea, arity confusion. Have messed that up a few places. Maybe a reason to make it separate calls. ?instrument_counter_add(...)
.
from opentelemetry-erlang.
Yeah separate calls would have a clear demarcation of type signatures and split docs automatically. Sounds like it's a bit wordier but clearer for usage.
from opentelemetry-erlang.
Related Issues (20)
- Injecting and extracting traceparent for distributed tracing HOT 8
- Update exemplar random seleection
- Metric Filters
- Metric cardinality limits
- Metric sync gauge
- Metrics: Investigate using metrics key with bucket index for histograms
- Exponential histogram
- Use a sorted list for attributes in metrics HOT 1
- Wrong seen count in exemplars test HOT 1
- broken typespec for otel_span:start_opts HOT 1
- Histogram metric with cumulative temporality HOT 19
- Histogram transient test failure
- Flapping exemplars test failure
- Codecov always fail
- breaking changes in recent version HOT 6
- opentelemetry_finch handler is failing and detaching HOT 2
- Logs are using incorrect trace and span id
- Spans not being closed when parent process exits HOT 1
- otel_tracer_noop:with_span/5 doesn't restore context properly
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opentelemetry-erlang.