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

accept optional arbitrary fields when attaching an error to a span #694

Merged
merged 1 commit into from Jan 13, 2023

Conversation

bpholt
Copy link
Member

@bpholt bpholt commented Jan 11, 2023

Without this change, it's still possible to attach arbitrary fields onto an event using log (or onto a span itself using put), but for at least the OpenTelemetry backend, that results in the exception being placed on a distinct event on the span from the other fields. Keeping them together seems more semantically sound.

If this is merged, I plan to use it here in log4cats-natchez. That line would probably become something like

maybeThrowable.fold(Trace[F].log(attributes: _*))(Trace[F].attachError(_, attributes: _*))

Arguably, we could also make a very similar addition to the def log(event: String): F[Unit] method, but I think it's less necessary there because AFAICT, for most of the backends, you can achieve the same result by using def log(fields: (String, TraceValue)*): F[Unit] and adding an "event" -> TraceValue.StringValue(event) with the rest of the attributes being set.

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

Successfully merging this pull request may close these issues.

None yet

2 participants