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

Experimental support for tracing #16020

Merged
merged 8 commits into from
Nov 18, 2023
Merged

Conversation

justinsb
Copy link
Member

@justinsb justinsb commented Oct 14, 2023

Implement simple otel tracing, starting with the kOps CLI.

  • We implement a custom collector which writes to a otel proto to a file. Eventually we can gather these artifacts in tests.
  • Implement a simple server that serves the jaeger UI. It's very inefficient currently (and loads everything into memory), but may be good enough for small traces.

Prompted by discussion in kOps office hours about how it would be understanding where we are spending time e.g. on node startup.

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Oct 14, 2023
@k8s-ci-robot k8s-ci-robot requested a review from zetaab October 14, 2023 18:06
@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Oct 14, 2023
@justinsb
Copy link
Member Author

I'm working on cleaning this up to be a reasonable PR (reasonable size, better factored). I started by splitting out #16021 which is mostly orthogonal (but supporting) changes to add context.Context to more methods in the vfs layer.

@justinsb justinsb force-pushed the otlp branch 2 times, most recently from 6abfb3d to 6199c31 Compare October 14, 2023 19:49
@justinsb
Copy link
Member Author

cc @rifelpet

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 15, 2023
@justinsb justinsb changed the title WIP: Experimental support for profiling WIP: Experimental support for tracing Oct 18, 2023
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 21, 2023
@justinsb justinsb force-pushed the otlp branch 2 times, most recently from dbfd339 to 58846d5 Compare October 21, 2023 12:43
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 4, 2023
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 9, 2023
@justinsb justinsb force-pushed the otlp branch 2 times, most recently from ea1c2d5 to 2d822b1 Compare November 9, 2023 13:54
@justinsb justinsb changed the title WIP: Experimental support for tracing Experimental support for tracing Nov 9, 2023
@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 Nov 9, 2023
@justinsb
Copy link
Member Author

justinsb commented Nov 9, 2023

Added some basic docs in the last commit (including describing it as very early experimental support), and so removing WIP marker.

@justinsb
Copy link
Member Author

justinsb commented Nov 9, 2023

/test pull-kops-e2e-k8s-gce-cilium

(though it looks like it might be unrelated but legitimate?)

Copy link
Member

@rifelpet rifelpet left a comment

Choose a reason for hiding this comment

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

Nice work! Do you think we could either set that env var in the presubmit prow jobs, or push a temporary commit to this PR that sets it by default to a filepath within the prow artifacts path? Just to see an example file

cmd/kops/main.go Show resolved Hide resolved
util/pkg/vfs/s3fs.go Outdated Show resolved Hide resolved
docs/opentelemetry.md Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 10, 2023
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 10, 2023
@justinsb justinsb force-pushed the otlp branch 2 times, most recently from 2586155 to cc203df Compare November 10, 2023 15:12
@justinsb
Copy link
Member Author

Do you think we could either set that env var in the presubmit prow jobs, or push a temporary commit to this PR that sets it by default to a filepath within the prow artifacts path? Just to see an example file

Good idea. In the last two commits I tweaked it to (1) write files to a directory and set up kubetest to default that directory if artifacts is set and (2) tweaked the reader to use the VFS layer.

So now from this branch you can do:

cd tools/otel/traceserver
go run . --src gs://kubernetes-jenkins/pr-logs/pull/kops/16020/pull-kops-e2e-k8s-gce-cilium/1722995655665782784/artifacts/otlp/ --run jaeger

http://127.0.0.1:16686/trace/5152af7cbbfc499316aba7df80ce1a76 is then the most interesting trace (I think).

@rifelpet
Copy link
Member

Very cool! for others, this is what the tracing looks like. The tranches as described here are very apparent.

image

Copy link
Member

@rifelpet rifelpet left a comment

Choose a reason for hiding this comment

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

This might be worthy of a release note. Even though it is only relevant to kops development, it might head off any concerns about introducing telemetry to the project, clarifying that it doesn't "phone home" or connect to any remote servers.

otherwise LGTM!

justinsb and others added 8 commits November 18, 2023 09:12
We initially support capturing to a file (in our own format, as it
doesn't appear a suitable format exists).  This means we don't need a
server to capture the traces, and can start capturing through prow
without a lot of infrastructure changes.

Co-authored-by: Peter Rifel <rifelpet@users.noreply.github.com>
This allows us to explore a trace file in jaeger.
Co-authored-by: Peter Rifel <rifelpet@users.noreply.github.com>
If given a directory, we can construct a reasonable name based on the
executable name, pid and timestamp.  Then this is relatively easy to
wire up from kubetest2, if we have an artifacts directory.
This lets us easily show the results from prow jobs, captured as artifacts.
In particular, highlighting that it is not "phone home" telemetry.
@justinsb
Copy link
Member Author

justinsb commented Nov 18, 2023

Good idea @rifelpet (and thanks for uploading the picture) - added a release note to highlight the fact that this is not telemetry in the "phone home" sense!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 18, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rifelpet

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 Nov 18, 2023
@k8s-ci-robot k8s-ci-robot merged commit 0b99ade into kubernetes:master Nov 18, 2023
@k8s-ci-robot k8s-ci-robot added this to the v1.29 milestone Nov 18, 2023
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/documentation area/nodeup cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/office-hours lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants