Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.

client: Add context parameter and enable tracing support#328

Merged
jodh-intel merged 1 commit intokata-containers:masterfrom
jodh-intel:add-client-grpc-tracing
Aug 21, 2018
Merged

client: Add context parameter and enable tracing support#328
jodh-intel merged 1 commit intokata-containers:masterfrom
jodh-intel:add-client-grpc-tracing

Conversation

@jodh-intel
Copy link
Copy Markdown

Add a context.Context parameter to the client NewAgentClient() API and
enable gRPC tracing if the specified context contains an opentracing
span.

Fixes #327.

Signed-off-by: James O. D. Hunt james.o.hunt@intel.com

@egernst egernst added the review label Aug 20, 2018
@jodh-intel
Copy link
Copy Markdown
Author

Note that this change is somewhat "invasive" since it adds an opentracing dependency to the client. However, that's the direction we want to move in anyway (see kata-containers/kata-containers#27).

Note also that the gRPC server the agent runs is not currently traced - that will be dealt with on #322.

@devimc
Copy link
Copy Markdown

devimc commented Aug 20, 2018

CI is not happy

protocols/client/client_test.go:96:35:warning: ...

Add a `context.Context` parameter to the client `NewAgentClient()` API and
enable gRPC tracing if the specified context contains an opentracing
span.

Fixes kata-containers#327.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
@jodh-intel jodh-intel force-pushed the add-client-grpc-tracing branch from d78ac8f to 6d26d61 Compare August 20, 2018 13:18
@jodh-intel
Copy link
Copy Markdown
Author

Branch updated.

@codecov
Copy link
Copy Markdown

codecov bot commented Aug 20, 2018

Codecov Report

Merging #328 into master will increase coverage by 0.18%.
The diff coverage is 33.33%.

@@            Coverage Diff             @@
##           master     #328      +/-   ##
==========================================
+ Coverage   44.73%   44.92%   +0.18%     
==========================================
  Files          15       15              
  Lines        2345     2393      +48     
==========================================
+ Hits         1049     1075      +26     
- Misses       1162     1176      +14     
- Partials      134      142       +8

// - vsock://<cid>:<port>
// - <unix socket path>
func NewAgentClient(sock string, enableYamux bool) (*AgentClient, error) {
func NewAgentClient(ctx context.Context, sock string, enableYamux bool) (*AgentClient, error) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

why this change? the context is always Background()

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

We want to be able to pass the context the runtime creates to virtcontainers/kata_agent.go because the runtime's context will have the trace information stored inside it so with this change, when the runtime is executed, we'll get gRPC traces for the client (runtime) side.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

make sense, thanks

Copy link
Copy Markdown

@devimc devimc left a comment

Choose a reason for hiding this comment

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

lgtm

@caoruidong
Copy link
Copy Markdown
Member

caoruidong commented Aug 21, 2018

LGTM

Approved with PullApprove

@jodh-intel jodh-intel merged commit 46396d2 into kata-containers:master Aug 21, 2018
@egernst egernst removed the review label Aug 21, 2018
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.

4 participants