Skip to content
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

New names for span macros #811

Open
tsloughter opened this issue Dec 22, 2024 · 0 comments
Open

New names for span macros #811

tsloughter opened this issue Dec 22, 2024 · 0 comments

Comments

@tsloughter
Copy link
Member

With metrics hopefully moving to stable soon after I write the docs I'm working on now I think we need to introduce new macros (keeping the old to not break existing code). For example:

?set_attribute(Key, Value)

becomes:

?span_set_attribute(Key, Value)

Otherwise you end up with confusing code like:

do_roll() ->
    ?with_span(dice_roll, #{},
               fun(_) ->
                       Roll = rand:uniform(6),
                       ?set_attribute('roll.value', Roll),
                       ?counter_add(?ROLL_COUNTER, 1, #{'roll.value' => Roll}),
                       Roll
               end).

Where you are setting this attribute with a macro set_attribute in one line and having to set it manually in counter_add in the next.

There is no such thing as context attributes (yet) so to be clear we are only setting it on the span we should add these new macros and update all docs/examples to use them.

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

No branches or pull requests

1 participant