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

Add distributed tracing to the etcd client #103216

Merged
merged 1 commit into from Jul 8, 2021

Conversation

dashpole
Copy link
Contributor

@dashpole dashpole commented Jun 25, 2021

What type of PR is this?

/kind feature

What this PR does / why we need it:

This adds tracing for etcd client requests, and propagates context to etcd to connect apiserver spans with spans from etcd-io/etcd#12919.

Part of enhancement: kubernetes/enhancements#647

Special notes for your reviewer:

I followed the pattern used by the EgressLookup config to plumb it through to the etcd client. In order to avoid globals (as requested in the initial tracing review), we pass the TracerProvider via config instead of using the global one. Rather than add etcd options for tracing separately, we copy the tracing-related options into the etcd config after the TracerProvider is initialized.

Does this PR introduce a user-facing change?

APIServerTracing now collects spans from etcd client calls, and propagates context to etcd.

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

- [KEP]: https://github.com/kubernetes/enhancements/blob/master/keps/sig-instrumentation/0034-distributed-tracing-kep.md

For illustration, see the example below:

Screen Shot 2021-06-30 at 9 32 15 AM (2)

The top span is the span added in #94942. The bottom span comes from ETCD, and was added in etcd-io/etcd#12919. The middle span is from this PR, and links the top and bottom spans!

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Jun 25, 2021
@k8s-ci-robot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jun 25, 2021
@k8s-ci-robot k8s-ci-robot added area/apiserver sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jun 25, 2021
@dashpole
Copy link
Contributor Author

/sig instrumentation

@k8s-ci-robot k8s-ci-robot added the sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. label Jun 25, 2021
@dashpole
Copy link
Contributor Author

/priority important-soon

@k8s-ci-robot k8s-ci-robot added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Jun 25, 2021
@dashpole
Copy link
Contributor Author

/test all

@k8s-ci-robot k8s-ci-robot added area/cloudprovider area/dependency Issues or PRs related to dependency changes sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. labels Jun 25, 2021
@dashpole
Copy link
Contributor Author

/test all

@dashpole
Copy link
Contributor Author

/test all

@dashpole
Copy link
Contributor Author

/retest

1 similar comment
@dashpole
Copy link
Contributor Author

/retest

@dashpole
Copy link
Contributor Author

/retest

@dashpole dashpole marked this pull request as ready for review June 26, 2021 21:09
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 26, 2021
@dashpole
Copy link
Contributor Author

/cc @kubernetes/sig-instrumentation-leads @lilic

@dashpole
Copy link
Contributor Author

/assign @lilic @logicalhan

Copy link
Member

@logicalhan logicalhan left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 29, 2021
@fedebongio
Copy link
Contributor

/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jun 29, 2021
@dashpole
Copy link
Contributor Author

dashpole commented Jul 2, 2021

/assign @sttts @wlan0

@dashpole
Copy link
Contributor Author

dashpole commented Jul 8, 2021

/assign @liggitt

Comment on lines +152 to +154
dialOptions = append(dialOptions,
grpc.WithUnaryInterceptor(otelgrpc.UnaryClientInterceptor(tracingOpts...)),
grpc.WithStreamInterceptor(otelgrpc.StreamClientInterceptor(tracingOpts...)))
Copy link
Member

Choose a reason for hiding this comment

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

I don't know enough about the grpc wiring to know the implications of this bit... would like an ack from an etcd reviewer

Copy link
Member

Choose a reason for hiding this comment

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

suggest @ptabor or @mm4tt

Copy link
Contributor

Choose a reason for hiding this comment

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

This part looks good to me.

@logicalhan
Copy link
Member

/assign @wenjiaswe @jingyih

@liggitt
Copy link
Member

liggitt commented Jul 8, 2021

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dashpole, liggitt, logicalhan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 8, 2021
@k8s-ci-robot k8s-ci-robot merged commit 694d6cd into kubernetes:master Jul 8, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.22 milestone Jul 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/apiserver area/cloudprovider area/dependency Issues or PRs related to dependency changes cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants