Skip to content

New names for span macros #811

Open
Open
@tsloughter

Description

@tsloughter

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions