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

Add zap fields and setting attribututes to trace in context #59

Closed
ianthpun opened this issue Jun 5, 2022 · 2 comments
Closed

Add zap fields and setting attribututes to trace in context #59

ianthpun opened this issue Jun 5, 2022 · 2 comments

Comments

@ianthpun
Copy link

ianthpun commented Jun 5, 2022

we currently are following a pattern where we use ctxzap from https://github.com/grpc-ecosystem/go-grpc-middleware/blob/v1.3.0/logging/zap/ctxzap/context.go#L24-L30 where we are able to add additional zap fields into the context logger so that when the function starts/exits, the logger middleware will be able to run Info and have all the additional fields added alongside the function.

We want to be able to combine that functionality with what we have here with otelzap so that any call to a new AddFields functions will

  1. add the additional zapFields into l.l.extrafields(?)
  2. run span.SetAttributes for those fields into the span tracer

Lemme know if this is something we can have otelzap support, or if im approaching this incorrectly.

@vmihailenco
Copy link
Member

It depends on how general we can make it so it is useful for more than once person. Also see #60

@togiles
Copy link

togiles commented Jun 8, 2022

We are using open telemetry with datadog, and in order to connect our logs and traces we need to provide both a trace_id and a span_id using specific field names (i.e. dd.trace_id and dd.span_id). See the following documentation for details:

https://docs.datadoghq.com/tracing/connect_logs_and_traces/opentelemetry/

Having an option to add arbitrary fields on zap logs would be really beneficial to tying these all together. We can of course see the events in our traces, however would prefer leveraging the logs + trace connection within datadog directly if possible.

tamj0rd2 added a commit to tamj0rd2/opentelemetry-go-extra that referenced this issue Aug 21, 2022
tamj0rd2 added a commit to tamj0rd2/opentelemetry-go-extra that referenced this issue Aug 21, 2022
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

Successfully merging a pull request may close this issue.

3 participants