Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Add gRPC server interceptor #123

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

south37
Copy link

@south37 south37 commented Jan 20, 2020

WHY

I want to use opencensus with gRPC server.
Discussion on this topic was found in #79 , but I couldn't find any implementation.

WHAT

I implemented GrpcServerInterceptor. By using this, we can send spans to each exporter.

In this implementation, span names and span statuses are set according to the following document.
cf. https://github.com/census-instrumentation/opencensus-specs/blob/master/trace/gRPC.md

Each span also has some useful attributes (e.g. http.path, http.method, http.user_agent, etc.).

So far I have only implemented the server interceptor, but in the future, I will also implement the client interceptor.

@south37 south37 mentioned this pull request Jan 20, 2020
span.put_attribute "http.status_code", to_http_status(exception)
end

# rubocop:disable Metrics/MethodLength
Copy link
Author

Choose a reason for hiding this comment

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

Here, I disabled Metrics/MethodLength and Metrics/CyclomaticComplexity because #to_http_status is inherently complex.

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

Successfully merging this pull request may close these issues.

1 participant