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

Allow setting event names in macros #1426

Closed
seanmonstar opened this issue Jun 8, 2021 · 5 comments
Closed

Allow setting event names in macros #1426

seanmonstar opened this issue Jun 8, 2021 · 5 comments
Labels
crate/tracing Related to the `tracing` crate kind/feature New feature or request

Comments

@seanmonstar
Copy link
Member

Feature Request

Crates

  • tracing

Motivation

Sometimes it would be useful to be able to specify the name part of an event's metadata, just like we can with spans.

Proposal

Add support to the event macros (trace!, debug!, etc) to set the event name specifically, similar to target.

debug!(name: "waker.clone", my.other = stuff);

That would set the Metadata::name() to "waker.clone" for that event.

@hawkw
Copy link
Member

hawkw commented Jun 8, 2021

This should be a pretty simple change --- just kind of repetitive since we'd need to touch a lot of repetitive macro cases.

@hawkw hawkw added the kind/feature New feature or request label Jun 15, 2021
@ileixe
Copy link

ileixe commented Oct 20, 2021

@hawkw it seems to be simple enough to change, but are you aligned to support this change? If then, I will take this issue as we need to introduce this change as well.

@cijothomas
Copy link
Contributor

The issue is quite old, but wondering if people are still interested in this or found an alternative? (We are leveraging tracing in our company and this is something we could use!)

@hawkw
Copy link
Member

hawkw commented Jun 16, 2023

@cijothomas I would merge a PR adding a name: argument to the event! macros, if anyone is interested in opening one!

@hawkw hawkw added the crate/tracing Related to the `tracing` crate label Jun 16, 2023
@twitchax
Copy link
Contributor

Ok, I just opened #2699.

Yay for combinatorial explosion...

@hawkw hawkw closed this as completed in c573651 Sep 5, 2023
davidbarsky pushed a commit that referenced this issue Sep 26, 2023
## Motivation

The motivation is #1426.  Currently, event names are set to a default
value of `event file:line`, which (1) doesn't allow for customization,
and (2) prevents events from working for some opentelemetry endpoints
(they often use the event name `exception` to designate something like a
panic).

## Solution

Went through the event macros, and added new parameterization that
allows for setting the `name`.  In addition, added some comments, and
reordering, to make life a bit better for the next person that comes
along to edit those macros.  Finally, added tests for the macro
expansion alongside the existing tests with a reasonable amount of
coverage (though, admittedly, more could be added for all of the macro
invocation types

Fixes #1426
davidbarsky pushed a commit that referenced this issue Sep 27, 2023
## Motivation

The motivation is #1426.  Currently, event names are set to a default
value of `event file:line`, which (1) doesn't allow for customization,
and (2) prevents events from working for some opentelemetry endpoints
(they often use the event name `exception` to designate something like a
panic).

## Solution

Went through the event macros, and added new parameterization that
allows for setting the `name`.  In addition, added some comments, and
reordering, to make life a bit better for the next person that comes
along to edit those macros.  Finally, added tests for the macro
expansion alongside the existing tests with a reasonable amount of
coverage (though, admittedly, more could be added for all of the macro
invocation types

Fixes #1426
davidbarsky pushed a commit that referenced this issue Sep 27, 2023
## Motivation

The motivation is #1426.  Currently, event names are set to a default
value of `event file:line`, which (1) doesn't allow for customization,
and (2) prevents events from working for some opentelemetry endpoints
(they often use the event name `exception` to designate something like a
panic).

## Solution

Went through the event macros, and added new parameterization that
allows for setting the `name`.  In addition, added some comments, and
reordering, to make life a bit better for the next person that comes
along to edit those macros.  Finally, added tests for the macro
expansion alongside the existing tests with a reasonable amount of
coverage (though, admittedly, more could be added for all of the macro
invocation types

Fixes #1426
davidbarsky pushed a commit that referenced this issue Sep 27, 2023
## Motivation

The motivation is #1426.  Currently, event names are set to a default
value of `event file:line`, which (1) doesn't allow for customization,
and (2) prevents events from working for some opentelemetry endpoints
(they often use the event name `exception` to designate something like a
panic).

## Solution

Went through the event macros, and added new parameterization that
allows for setting the `name`.  In addition, added some comments, and
reordering, to make life a bit better for the next person that comes
along to edit those macros.  Finally, added tests for the macro
expansion alongside the existing tests with a reasonable amount of
coverage (though, admittedly, more could be added for all of the macro
invocation types

Fixes #1426
davidbarsky pushed a commit that referenced this issue Sep 27, 2023
## Motivation

The motivation is #1426.  Currently, event names are set to a default
value of `event file:line`, which (1) doesn't allow for customization,
and (2) prevents events from working for some opentelemetry endpoints
(they often use the event name `exception` to designate something like a
panic).

## Solution

Went through the event macros, and added new parameterization that
allows for setting the `name`.  In addition, added some comments, and
reordering, to make life a bit better for the next person that comes
along to edit those macros.  Finally, added tests for the macro
expansion alongside the existing tests with a reasonable amount of
coverage (though, admittedly, more could be added for all of the macro
invocation types

Fixes #1426
davidbarsky pushed a commit that referenced this issue Sep 29, 2023
## Motivation

The motivation is #1426.  Currently, event names are set to a default
value of `event file:line`, which (1) doesn't allow for customization,
and (2) prevents events from working for some opentelemetry endpoints
(they often use the event name `exception` to designate something like a
panic).

## Solution

Went through the event macros, and added new parameterization that
allows for setting the `name`.  In addition, added some comments, and
reordering, to make life a bit better for the next person that comes
along to edit those macros.  Finally, added tests for the macro
expansion alongside the existing tests with a reasonable amount of
coverage (though, admittedly, more could be added for all of the macro
invocation types

Fixes #1426
hawkw pushed a commit that referenced this issue Oct 1, 2023
## Motivation

The motivation is #1426.  Currently, event names are set to a default
value of `event file:line`, which (1) doesn't allow for customization,
and (2) prevents events from working for some opentelemetry endpoints
(they often use the event name `exception` to designate something like a
panic).

## Solution

Went through the event macros, and added new parameterization that
allows for setting the `name`.  In addition, added some comments, and
reordering, to make life a bit better for the next person that comes
along to edit those macros.  Finally, added tests for the macro
expansion alongside the existing tests with a reasonable amount of
coverage (though, admittedly, more could be added for all of the macro
invocation types

Fixes #1426
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crate/tracing Related to the `tracing` crate kind/feature New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants