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

Request to allow control of which grpc codes set the span to error #3386

Open
fantapop opened this issue Feb 13, 2023 · 1 comment
Open

Request to allow control of which grpc codes set the span to error #3386

fantapop opened this issue Feb 13, 2023 · 1 comment
Labels

Comments

@fantapop
Copy link

Along the same lines as #1973, we use grpc codes to indicate which errors were caused by a users action. Currently any error that's passed back through the grpc interceptor is setting the span to error. This makes it more difficult to see which errors are actionable in our request dashboards. I have some local changes that allows passing a function in as configuration which would determine whether an error should set the span status to code. Is this something you'd accept a PR for?

I'm currently doing this but happy to do it differently or change the names of variables etc, thanks.

		if err != nil {
			s, _ := status.FromError(err)
			if config.SpanErrorClassifier(err) {
				span.SetStatus(codes.Error, s.Message())
			}
			span.SetAttributes(statusCodeAttr(s.Code()))
			messageSent.Event(ctx, 1, s.Proto())
		} else {
			span.SetAttributes(statusCodeAttr(grpc_codes.OK))
			messageSent.Event(ctx, 1, resp)
		}
@MrAlias
Copy link
Contributor

MrAlias commented Feb 13, 2023

Please take a look at open-telemetry/opentelemetry-specification#3110. We need to specification to evolve before we can change this instrumentation to deviate.

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

No branches or pull requests

2 participants