Skip to content
This repository was archived by the owner on Sep 17, 2025. It is now read-only.

Update grpc server_interceptor to report accurate timing#108

Merged
liyanhui1228 merged 3 commits intocensus-instrumentation:masterfrom
wkiser:server_interceptor
Jan 25, 2018
Merged

Update grpc server_interceptor to report accurate timing#108
liyanhui1228 merged 3 commits intocensus-instrumentation:masterfrom
wkiser:server_interceptor

Conversation

@wkiser
Copy link
Copy Markdown
Contributor

@wkiser wkiser commented Jan 24, 2018

fixes #107. Updated my example to accept pre handler and post handler callbacks as requested. I also updated the code to set the tracer in the interceptor as the current tracer in the execution context.

Copy link
Copy Markdown
Contributor

@liyanhui1228 liyanhui1228 left a comment

Choose a reason for hiding this comment

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

LGTM except some nits. Please also fix the test coverage. Thank you for sending this PR!

ATTRIBUTE_ERROR_MESSAGE = 'ERROR_MESSAGE'

RpcRequestInfo = collections.namedtuple('RPCRequestInfo', ('request', 'context'))
RpcResponseInfo = collections.namedtuple('RPCCallbackInfo', ('request', 'context', 'response', 'exc'))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please fix the lint warning that each line should be less than 79 characters.


def __init__(self, handler, pre_handler_callbacks=None, post_handler_callbacks=None):
"""
:param handler: instance of RpcMethodHandler
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please add one blank line between the param docstrings.


from opencensus.trace import attributes_helper
from opencensus.trace import tracer as tracer_module
from opencensus.trace import tracer as tracer_module, execution_context
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Change this to two lines to import the tracer module and execution_context module separately.

@liyanhui1228
Copy link
Copy Markdown
Contributor

System tests are sometimes flaky which are not related to grpc integrations, merging for now.

@liyanhui1228 liyanhui1228 merged commit 8a13b0a into census-instrumentation:master Jan 25, 2018
@wkiser wkiser deleted the server_interceptor branch January 31, 2018 16:53
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.

OpenCensusServerInterceptor reports incorrect timing

2 participants