Skip to content

✨: Add OpenTelemetry Tracing Support#6002

Open
AnmolxSingh wants to merge 9 commits into
kubernetes-sigs:mainfrom
AnmolxSingh:tracing-support
Open

✨: Add OpenTelemetry Tracing Support#6002
AnmolxSingh wants to merge 9 commits into
kubernetes-sigs:mainfrom
AnmolxSingh:tracing-support

Conversation

@AnmolxSingh

@AnmolxSingh AnmolxSingh commented May 5, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind feature

What this PR does / why we need it:
Adding OpenTelemetry Tracing support for Kubernetes CAPA
More details are shared in #5982

Fixes #2178

Special notes for your reviewer:

AI Usage:
None

Checklist:

  • squashed commits
  • includes documentation
  • includes AI generated content
  • includes emoji in title
  • adds unit tests
  • adds or updates e2e tests

Release note:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 5, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign damdo for approval. For more information see the Code Review Process.

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

Details 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 requested review from damdo and fiunchinho May 5, 2026 12:21
@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 5, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

Hi @AnmolxSingh. Thanks for your PR.

I'm waiting for a kubernetes-sigs 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.

Details

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-sigs/prow repository.

@richardcase richardcase changed the title ✨ WIP: Add OpenTelemetry Tracing Support WIP: ✨ Add OpenTelemetry Tracing Support May 5, 2026
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 5, 2026
@richardcase

Copy link
Copy Markdown
Member

/ok-to-test

@k8s-ci-robot k8s-ci-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 May 5, 2026
Comment thread controllers/awscluster_controller.go Outdated

//creating span using OpenTelemetry SDK
tr := otel.Tracer("awscluster_controller")
ctx, span := tr.Start(ctx, "Reconcile() awscluster_controller.go")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It would be good to follow a naming convention. Perhaps it could be:

AWSClusterReconciler.Reconcile

Comment thread controllers/awscluster_controller.go Outdated
log := logger.FromContext(ctx)

//creating span using OpenTelemetry SDK
tr := otel.Tracer("awscluster_controller")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It might be good to wrap this into our own function that returns a tracer. This would force consumers to supply specific values.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This would allow us to add attributes etc

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

For example, in one of the projects i added otel to:

	ctx, logger, span := telemetry.StartSpanWithLogger(ctx,
		"controllers.MyController.Reconcile",
		telemetry.KVP("namespace", req.Namespace),
		telemetry.KVP("name", req.Name),
		telemetry.KVP("kind", mytypev1.MyKind),
	)
	defer span.End()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have added a simple function as of now. I can add more values to it as per the requirement.

Comment thread controllers/awscluster_controller.go Outdated
Comment thread pkg/otel/tracing/traces.go
Comment thread pkg/otel/tracing/traces.go
@AnmolxSingh AnmolxSingh changed the title WIP: ✨ Add OpenTelemetry Tracing Support ✨ WIP: Add OpenTelemetry Tracing Support May 10, 2026
@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 May 10, 2026
@AnmolxSingh AnmolxSingh changed the title ✨ WIP: Add OpenTelemetry Tracing Support WIP: Add OpenTelemetry Tracing Support May 10, 2026
Comment thread main.go Outdated
@AnmolxSingh

Copy link
Copy Markdown
Contributor Author

I have removed the aws api calls in this pr. I will open a separate pr for that.

@richardcase

Copy link
Copy Markdown
Member

/test pull-cluster-api-provider-aws-test

@AnmolxSingh

Copy link
Copy Markdown
Contributor Author

@richardcase I think this pull request is now ready to be merged

@AnmolxSingh AnmolxSingh changed the title WIP: Add OpenTelemetry Tracing Support ✨: Add OpenTelemetry Tracing Support May 29, 2026
@richardcase

Copy link
Copy Markdown
Member

@AnmolxSingh - it looks like this contains merge commits:

Adding label do-not-merge/contains-merge-commits because PR contains merge commits, which are not allowed in this repository.
Use git rebase to reapply your commits on top of the target branch. Detailed instructions for doing so can be found

Could you rebase instead?

@richardcase

Copy link
Copy Markdown
Member

@AnmolxSingh - i think this looks good. Can you rebase and squash your commits? We can then get it merged.

@kubernetes-prow kubernetes-prow Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 3, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

PR needs rebase.

Details

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-sigs/prow repository.

@dlipovetsky

Copy link
Copy Markdown
Contributor

/approve

@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dlipovetsky

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

The pull request process is described here

Details 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

@kubernetes-prow kubernetes-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 6, 2026
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. 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. needs-priority needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Opentelemetry tracing

4 participants