go-sensor icon indicating copy to clipboard operation
go-sensor copied to clipboard

Logging warn and error when using open tracing

Open steveww opened this issue 3 years ago • 4 comments

I'm using the go sensor with open tracing. Everything works OK apart from logging an error.

What are the magic tags I need to set to generate a log message so that it shows up under the service log messages?

steveww avatar Jun 22 '21 16:06 steveww

Hey @steveww! The Go sensor does not support logging spans yet, but there is an option to log an error with (opentracing.Span).LogKV() by providing "error" as a key. This would mark the span accordingly and the error message will be displayed in UI. Would this work in your case?

andrewslotin avatar Jun 23 '21 11:06 andrewslotin

Thanks for the reply. I'm using span.LogFields(otlog.Object("error", err)) any reason this would not work?

steveww avatar Jun 23 '21 14:06 steveww

Apologies for confusion, I just checked the code and while this should be enough to mark the span as erroneous, but the error message needs to go to span tags to be displayed in UI. There is no common tag that would work uniformly for all kind of spans, but if you could share the span types you're using, I can provide corresponding error tags for them.

andrewslotin avatar Jun 23 '21 14:06 andrewslotin

I have an intermediate span that validates some data. I'd like to log an error if the validation fails.

steveww avatar Jun 25 '21 10:06 steveww