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

client: Add context parameter and enable tracing support #328

Merged

Conversation

jodh-intel
Copy link
Contributor

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
Contributor 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

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
Copy link
Contributor Author

Branch updated.

@codecov
Copy link

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

@@ -54,14 +56,28 @@ type dialer func(string, time.Duration) (net.Conn, error)
// - unix://<unix socket path>
// - 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

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
Contributor 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

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

@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
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