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

[TEP-0124] implement opentelemetry Jaeger tracing #5746

Merged
merged 9 commits into from
Jan 23, 2023

Conversation

kmjayadeep
Copy link
Contributor

@kmjayadeep kmjayadeep commented Nov 11, 2022

Adds opentelemetry instrumentation code to pipelinerun and taskrun reconcilers. Also made required changes in the main.go to include jaeger as tracing backend

Changes

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Has Docs included if any changes are user facing
  • Has Tests included if any functionality added or changed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including
    functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings)
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Note to reviewers: There are pipeline failures (looks like they are not related to the changes). Once the review is complete and ready to approve, I will address the pipeline issues, rebase with main and squash all commits into one.

Release Notes

Added support for tracing using Jaeger and OpenTelemetry. It can be enabled by adding the following environment variables to controller manifest
* `OTEL_EXPORTER_JAEGER_ENDPOINT` is the HTTP endpoint for sending spans directly to a collector.
* `OTEL_EXPORTER_JAEGER_USER` is the username to be sent as authentication to the collector endpoint. (optional)
* `OTEL_EXPORTER_JAEGER_PASSWORD` is the password to be sent as authentication to the collector endpoint. (optional)

@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Nov 11, 2022
@tekton-robot
Copy link
Collaborator

Hi @kmjayadeep. Thanks for your PR.

I'm waiting for a tektoncd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@kmjayadeep
Copy link
Contributor Author

/kind feature

@tekton-robot tekton-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Nov 11, 2022
@tekton-robot tekton-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 11, 2022
@afrittoli
Copy link
Member

/ok-to-test

@tekton-robot tekton-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 11, 2022
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/pipelinerun.go 85.6% 83.7% -1.9
pkg/reconciler/pipelinerun/tracing.go Do not exist 88.9%
pkg/reconciler/taskrun/taskrun.go 81.5% 82.5% 1.0
pkg/reconciler/taskrun/tracing.go Do not exist 89.3%

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/pipelinerun.go 85.6% 85.8% 0.2
pkg/reconciler/pipelinerun/tracing.go Do not exist 88.9%
pkg/reconciler/taskrun/taskrun.go 81.5% 82.5% 1.0
pkg/reconciler/taskrun/tracing.go Do not exist 89.3%

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/pipelinerun.go 85.6% 85.8% 0.2
pkg/reconciler/pipelinerun/tracing.go Do not exist 88.9%
pkg/reconciler/taskrun/taskrun.go 81.5% 82.5% 1.0
pkg/reconciler/taskrun/tracing.go Do not exist 89.3%

@afrittoli
Copy link
Member

From the error in the build tests it might be that something went wrong in the rebase again, but you could try and run the codegen script to see if it fixes the error

@kmjayadeep
Copy link
Contributor Author

Hi @afrittoli I tried the codegen script already. It has introduced some formatting changes, but didn't fix the build.

@afrittoli
Copy link
Member

Hi @afrittoli I tried the codegen script already. It has introduced some formatting changes, but didn't fix the build.

I had a look and your commit actually includes formatting changes to generated files, which causes the build job to fail.

pkg/client/clientset/versioned/fake/register.go                                               |   14 +-
pkg/client/clientset/versioned/scheme/register.go                                             |   14 +-
pkg/client/resolution/clientset/versioned/fake/register.go                                    |   14 +-
pkg/client/resolution/clientset/versioned/scheme/register.go                                  |   14 +-
pkg/client/resource/clientset/versioned/fake/register.go                                      |   14 +-
pkg/client/resource/clientset/versioned/scheme/register.go                                    |   14 +-

I tried reverting those and running the codegen again and they appear back, so I suspect this might be related to a change in go version between CI and your/mine local go version.

My go version is:

go version go1.19.1 darwin/arm64

while CI runs on 1.18.

For this specific CI, I would recommend reverting those changes and adding them to your commit. You can skip the codegen script since there is no change in the PR which requires it:

git checkout origin/main -- pkg/client/clientset/versioned/fake/register.go
git checkout origin/main -- pkg/client/clientset/versioned/scheme/register.go
git checkout origin/main -- pkg/client/resolution/clientset/versioned/fake/register.go
git checkout origin/main -- pkg/client/resolution/clientset/versioned/scheme/register.go
git checkout origin/main -- pkg/client/resource/clientset/versioned/fake/register.go
git checkout origin/main -- pkg/client/resource/clientset/versioned/scheme/register.go

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/pipelinerun.go 85.6% 85.8% 0.2
pkg/reconciler/pipelinerun/tracing.go Do not exist 88.9%
pkg/reconciler/taskrun/taskrun.go 81.5% 82.5% 1.0
pkg/reconciler/taskrun/tracing.go Do not exist 89.3%

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/pipelinerun.go 85.6% 85.8% 0.2
pkg/reconciler/pipelinerun/tracing.go Do not exist 88.9%
pkg/reconciler/taskrun/taskrun.go 81.5% 82.5% 1.0
pkg/reconciler/taskrun/tracing.go Do not exist 89.3%

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/pipelinerun.go 85.6% 85.8% 0.2
pkg/reconciler/pipelinerun/tracing.go Do not exist 88.9%
pkg/reconciler/taskrun/taskrun.go 81.5% 82.5% 1.0
pkg/reconciler/taskrun/tracing.go Do not exist 89.3%

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/pipelinerun.go 86.2% 86.6% 0.4
pkg/reconciler/pipelinerun/tracing.go Do not exist 75.8%
pkg/reconciler/taskrun/taskrun.go 83.6% 84.5% 0.9
pkg/reconciler/taskrun/tracing.go Do not exist 90.9%

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/pipelinerun.go 86.2% 86.6% 0.4
pkg/reconciler/pipelinerun/tracing.go Do not exist 75.8%
pkg/reconciler/taskrun/taskrun.go 83.6% 84.5% 0.9
pkg/reconciler/taskrun/tracing.go Do not exist 90.9%

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/pipelinerun.go 86.2% 86.6% 0.4
pkg/reconciler/pipelinerun/tracing.go Do not exist 75.8%
pkg/reconciler/taskrun/taskrun.go 83.6% 84.5% 0.9
pkg/reconciler/taskrun/tracing.go Do not exist 90.9%

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/pipelinerun.go 86.2% 86.6% 0.4
pkg/reconciler/pipelinerun/tracing.go Do not exist 75.8%
pkg/reconciler/taskrun/taskrun.go 83.6% 84.5% 0.9
pkg/reconciler/taskrun/tracing.go Do not exist 90.9%

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/pipelinerun.go 86.2% 86.6% 0.4
pkg/reconciler/pipelinerun/tracing.go Do not exist 75.8%
pkg/reconciler/taskrun/taskrun.go 83.6% 84.5% 0.9
pkg/reconciler/taskrun/tracing.go Do not exist 90.9%

Signed-off-by: Jayadeep KM <kmjayadeep@gmail.com>
Signed-off-by: Jayadeep KM <kmjayadeep@gmail.com>
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/pipelinerun.go 86.2% 86.6% 0.4
pkg/reconciler/pipelinerun/tracing.go Do not exist 75.8%
pkg/reconciler/taskrun/taskrun.go 83.6% 84.5% 0.9
pkg/reconciler/taskrun/tracing.go Do not exist 90.9%

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/pipelinerun.go 86.2% 86.6% 0.4
pkg/reconciler/pipelinerun/tracing.go Do not exist 75.8%
pkg/reconciler/taskrun/taskrun.go 83.6% 84.5% 0.9
pkg/reconciler/taskrun/tracing.go Do not exist 90.9%

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/pipelinerun.go 86.2% 86.6% 0.4
pkg/reconciler/pipelinerun/tracing.go Do not exist 75.8%
pkg/reconciler/taskrun/taskrun.go 83.6% 84.5% 0.9
pkg/reconciler/taskrun/tracing.go Do not exist 90.9%

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/pipelinerun.go 86.2% 86.6% 0.4
pkg/reconciler/pipelinerun/tracing.go Do not exist 75.8%
pkg/reconciler/taskrun/taskrun.go 83.6% 84.5% 0.9
pkg/reconciler/taskrun/tracing.go Do not exist 90.9%

and fix a few linter issues.

Signed-off-by: Andrea Frittoli <andrea.frittoli@uk.ibm.com>
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/pipelinerun.go 86.2% 86.6% 0.4
pkg/reconciler/pipelinerun/tracing.go Do not exist 75.8%
pkg/reconciler/taskrun/taskrun.go 83.6% 84.5% 0.9
pkg/reconciler/taskrun/tracing.go Do not exist 90.9%

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/pipelinerun.go 86.2% 86.6% 0.4
pkg/reconciler/pipelinerun/tracing.go Do not exist 75.8%
pkg/reconciler/taskrun/taskrun.go 83.6% 84.5% 0.9
pkg/reconciler/taskrun/tracing.go Do not exist 90.9%

Comment on lines +4572 to +4574
</tr><tr><td><p>&#34;TaskRunResultLargerThanAllowedLimit&#34;</p></td>
<td><p>TaskRunReasonResultLargerThanAllowedLimit is the reason set when one of the results exceeds its maximum allowed limit of 1 KB</p>
</td>
Copy link
Member

Choose a reason for hiding this comment

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

It looks like these were missed in some previous PR, but I wonder by CI did not catch them.
@vdemeester @abayer any idea?

Comment on lines +6359 to +6363
Supported formats differ based on the KMS system used.
One example of a KMS url could be:
gcpkms://projects/[PROJECT]/locations/[LOCATION]&gt;/keyRings/[KEYRING]/cryptoKeys/[KEY]/cryptoKeyVersions/[KEY_VERSION]
For more examples please refer <a href="https://docs.sigstore.dev/cosign/kms_support">https://docs.sigstore.dev/cosign/kms_support</a>.
Note that the KMS is not supported yet.</p>
Copy link
Member

Choose a reason for hiding this comment

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

Ditto

spanContext := make(map[string]string)

// SpanContext was propogated through annotations
if pr.Annotations != nil && pr.Annotations[SpanContextAnnotation] != "" {
Copy link
Member

Choose a reason for hiding this comment

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

Nice! These means that a PipelineRun too can receive an input context, which means we can support existing contexts for pipelines, like in the case of pipeline in pipeline, or a pipeline triggered via CloudEvent with a tracing context in it.

Copy link
Member

@afrittoli afrittoli left a comment

Choose a reason for hiding this comment

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

Thank you @kmjayadeep
/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 23, 2023
@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vdemeester

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

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 23, 2023
@tekton-robot tekton-robot merged commit 000c3af into tektoncd:main Jan 23, 2023
@kmjayadeep kmjayadeep deleted the tep-0124 branch January 23, 2023 14:18
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. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants