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 adding extra fields to error logs #514

Merged
merged 5 commits into from
Sep 16, 2022
Merged

Allow adding extra fields to error logs #514

merged 5 commits into from
Sep 16, 2022

Conversation

kentquirk
Copy link
Contributor

Which problem is this PR solving?

As noted in #513, errors that occur while Refinery is trying to send data to Honeycomb happen asynchronously. It's hard to relate any errors that show up in the logs with the spans that caused them to occur. However, there is a way provided by libhoney (metadata) that makes it possible to attach data to the error. Before now, Refinery has attached the dataset, api host, and environment to the metadata. This helps but is not enough.

Short description of the changes

This PR attempts to leverage that technique further by adding a new configuration value called AdditionalErrorFields. It allows the user to specify a list of field names. In the event of a transmission error, these fields (if they exist) will be copied from the failing span into the metadata, and will therefore show up as identified fields in the logs.

The default value is trace.span_id.

This also removes the remaining instances of the obsolete standard library ioutil.

Closes #513

@kentquirk kentquirk requested review from a team and MikeGoldsmith September 15, 2022 00:40
Copy link
Contributor

@MikeGoldsmith MikeGoldsmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍🏻

@MikeGoldsmith
Copy link
Contributor

MikeGoldsmith commented Sep 15, 2022

PS This PR needs a title update and labels applying.

@kentquirk kentquirk changed the title Kent.extra fields Allow adding extra fields to error logs Sep 15, 2022
@kentquirk kentquirk self-assigned this Sep 15, 2022
@kentquirk kentquirk added type: enhancement New feature or request version: bump minor A PR that adds behavior, but is backwards-compatible. labels Sep 15, 2022
@kentquirk kentquirk merged commit c6533de into main Sep 16, 2022
@kentquirk kentquirk deleted the kent.extra-fields branch September 16, 2022 00:08
kentquirk added a commit that referenced this pull request Sep 29, 2022
## Which problem is this PR solving?

- A previous PR (#514) changed the type of the metadata object from
`map[string]string` to `map[string]any`, but I must have forgotten to
hit save at some point, and this part of it (4 lines) didn't get
committed. This bug actually will cause that feature to omit fields it
knows about.

## Short description of the changes

- Change the type appropriately in processResponses
ghost pushed a commit to opsramp/tracing-proxy that referenced this pull request Jul 5, 2024
## Which problem is this PR solving?

As noted in honeycombio#513, errors that occur while Refinery is trying to send data to Honeycomb happen asynchronously. It's hard to relate any errors that show up in the logs with the spans that caused them to occur. However, there is a way provided by libhoney ([metadata](https://github.com/honeycombio/libhoney-go/blob/25068939fe8240ccc45e4c86271b6f057c5f833d/transmission/response.go#L11)) that makes it possible to attach data to the error. Before now, Refinery has attached the dataset, api host, and environment to the metadata. This helps but is not enough.


## Short description of the changes

This PR attempts to leverage that technique further by adding a new configuration value called `AdditionalErrorFields`. It allows the user to specify a list of field names. In the event of a transmission error, these fields (if they exist) will be copied from the failing span into the metadata, and will therefore show up as identified fields in the logs. 

The default value is `trace.span_id`.

This also removes the remaining instances of the obsolete standard library `ioutil`.

Closes honeycombio#513
ghost pushed a commit to opsramp/tracing-proxy that referenced this pull request Jul 5, 2024
## Which problem is this PR solving?

- A previous PR (honeycombio#514) changed the type of the metadata object from
`map[string]string` to `map[string]any`, but I must have forgotten to
hit save at some point, and this part of it (4 lines) didn't get
committed. This bug actually will cause that feature to omit fields it
knows about.

## Short description of the changes

- Change the type appropriately in processResponses
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request version: bump minor A PR that adds behavior, but is backwards-compatible.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Attach additional metadata to make ingestion error logs more informative
2 participants