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

added otel capabilities for descheduler plugin #958

Conversation

harshanarayana
Copy link
Contributor

Note

Early Draft of the PR to get feedbacks on. This is not yet ready for full review.

Fixes: #951

@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 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 Sep 23, 2022
@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Sep 23, 2022
@harshanarayana
Copy link
Contributor Author

/assign @Dentrax

@k8s-ci-robot
Copy link
Contributor

@harshanarayana: GitHub didn't allow me to assign the following users: Dentrax.

Note that only kubernetes-sigs members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

In response to this:

/assign @Dentrax

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.

@harshanarayana
Copy link
Contributor Author

/cc @Dentrax

@k8s-ci-robot
Copy link
Contributor

@harshanarayana: GitHub didn't allow me to request PR reviews from the following users: Dentrax.

Note that only kubernetes-sigs members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/cc @Dentrax

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.

@harshanarayana harshanarayana changed the title added otel capabilities for descheduler plugin WIP: added otel capabilities for descheduler plugin Sep 23, 2022
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 27, 2022
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 28, 2022
type RunFunc func(ctx context.Context, nodes []*v1.Node) *framework.Status

// RunPlugin runs a plugin.
func RunPlugin(plugin framework.Plugin, runFn RunFunc, operationName, pluginName string) func(ctx context.Context, nodes []*v1.Node) {
Copy link
Contributor

Choose a reason for hiding this comment

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

rather than wrapping the plugin's function in a span, why not start and close the span within the plugin's Deschedule function?

I would prefer if traces are implemented by the plugins themselves rather than the framework. The framework can provide the mechanisms (like registering a global traceprovider) but I would leave the actual spans up to plugin developers to implement

Copy link
Contributor

@Dentrax Dentrax Sep 30, 2022

Choose a reason for hiding this comment

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

My initial attempt was to put Span login within each plugin individually. And then I thought it could hard to maintain if we manage tracing stuff separately:

  • it would be easy to forget to put tracing logic in a function
  • it would bring code duplication (1 line tracing, 1 line defer: times plugin count)
  • it would be easy to forget to add span.RecordError(status.Err) function in all error cases
  • should plugins really know the existence of tracing? (why plugin developers should duplicate this logic?)

These are just my concern, I'm OK to go with your way anyway. Wanted to learn more about your concern. 🤞

Copy link
Contributor

Choose a reason for hiding this comment

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

should plugins really know the existence of tracing? (why plugin developers should duplicate this logic?)

One benefit of a framework model is detangling the plugin logic from the surrounding framework internals, so in that sense the answer is yes.

On that end, it makes sense for us to start a parent trace in our internals (somewhere around here), and plugins can use the context to add whatever additional spans they want. But the responsibilities of good design you mention in your other bullet points are kept to the individual plugin developers

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On that end, it makes sense for us to start a parent trace in our internals (somewhere around here),

+1 from me for this. I think we can start from this for now and see how it goes. Enforcing the tracing related code can be done mostly during the code review of a new plugin getting added anyway. The current code in the repo already lets us create the parent trace and pass the context down to the individual plugin/strategies so that they can trace the required bit of the code in that accordingly.

This will also leave the plugin developer with freedom of being able to trace some of their internal helper/util functions as well if required.

Copy link
Contributor

Choose a reason for hiding this comment

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

@harshanarayana yup, that's exactly what I'm thinking

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Screenshot 2022-10-04 at 4 18 24 PM

@@ -22,6 +22,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
componentbaseconfig "k8s.io/component-base/config"
registry "k8s.io/component-base/logs/api/v1"
"sigs.k8s.io/descheduler/pkg/apis/componentconfig"
Copy link
Contributor

Choose a reason for hiding this comment

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

the versioned API shouldn't import the unversioned API. it's a hub-and-spoke model for conversion, so you should basically duplicate the types into the versioned api here

Copy link
Contributor Author

@harshanarayana harshanarayana Oct 4, 2022

Choose a reason for hiding this comment

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

/Ack. I am working on getting this changed. Will publish a copy of this by tomorrow. @damemi

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changes done.

@harshanarayana harshanarayana marked this pull request as ready for review October 13, 2022 02:16
@k8s-ci-robot k8s-ci-robot requested a review from a7i October 13, 2022 02:16
@harshanarayana
Copy link
Contributor Author

/cc @damemi

@harshanarayana
Copy link
Contributor Author

/test pull-descheduler-verify-master

@harshanarayana
Copy link
Contributor Author

/test pull-descheduler-verify-master

@harshanarayana
Copy link
Contributor Author

@damemi @damemi

https://prow.k8s.io/view/gs/kubernetes-jenkins/pr-logs/pull/kubernetes-sigs_descheduler/958/pull-descheduler-verify-master/1580431724137943040

Unable to figure out why this issue on the CICD showing up.

❯ hack/verify-conversions.sh
hack/uGenerated conversions verified.

if I run the verify locally, it works just fine!

@damemi
Copy link
Contributor

damemi commented Oct 13, 2022

@harshanarayana I checked out your branch locally and it fails when I run it with the same output as the CI. Could you try running make clean first, or perhaps in a container?

@harshanarayana
Copy link
Contributor Author

@mikedanese That is definitely weird. I did that already and I see not delta in the commits or files! :(

@damemi
Copy link
Contributor

damemi commented Oct 13, 2022

@harshanarayana I think it has something to do with #982, but I can't quite figure it out. Posted a more detailed explanation there

@harshanarayana
Copy link
Contributor Author

harshanarayana commented Oct 14, 2022

@harshanarayana I think it has something to do with #982, but I can't quite figure it out. Posted a more detailed explanation there

@damemi Thanks very much. Definitely looks like the same. Let me run the same generation code in a different machine I have and see if actually makes a difference. Do you think it matters where my code resides though? Mine doesn't exists under the $GOPATH/src/<x>/<y> path

@harshanarayana
Copy link
Contributor Author

@a7i @damemi Sorry for the delay and responding back to this. I will get this addressing your comments today and push the changes accordingly.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 4, 2023
harshanarayana and others added 3 commits February 25, 2023 20:04
tracing: pass start span func to all plugins

Signed-off-by: Furkan <furkan.turkal@trendyol.com>

tracing: pass span context to run func

Signed-off-by: Furkan <furkan.turkal@trendyol.com>

move tracing workflow to individual plugins

handle shutdown handling for context cancel

enable hub/spoke mode for the OTEL config conversion

add tests for tracing

Signed-off-by: Furkan <furkan.turkal@trendyol.com>

update generated conversion data model

update generated conversion spec

fix deepcopy gen behavior

gofumpt cleanup for formatting

format descheduler.go

Signed-off-by: Furkan <furkan.turkal@trendyol.com>

use same context instead creating a new one

Signed-off-by: Furkan <furkan.turkal@trendyol.com>

update vendoring to match the upstream branches

regenerated auto generated code for new copyright for verify match

Signed-off-by: Harsha Narayana <harshnar@cisco.com>

fix klog ErrorS invocation

cleanup vendor and mod files

reuse existing context against trace spans and fix the structs

update conversion
Signed-off-by: Furkan <furkan.turkal@trendyol.com>
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 25, 2023
@k8s-ci-robot
Copy link
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 ingvagabund for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@harshanarayana
Copy link
Contributor Author

@a7i @damemi Thanks for your patience on this. I have been on again and off again due to some personal commitments. Getting back to this again. Left a few comments. Need help with those so that I can close the pending comments.

@harshanarayana
Copy link
Contributor Author

/ping @damemi @a7i

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 24, 2023
@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

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.

@k8s-ci-robot
Copy link
Contributor

@harshanarayana: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-descheduler-test-e2e-k8s-master-1-27 a281e80 link true /test pull-descheduler-test-e2e-k8s-master-1-27

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@a7i
Copy link
Contributor

a7i commented Apr 12, 2023

/cc @damemi @ingvagabund @knelasevero

Has the 0.27 🚢 sailed or do you think we can squeeze this in?
I'm certainly open to bringing this in since not enabling it doesn't have any negative side effects.

@damemi
Copy link
Contributor

damemi commented Apr 12, 2023

@a7i this needs a rebase and there is still some unaddressed feedback. I would say let's release 0.27 and target this for 0.28

@harshanarayana
Copy link
Contributor Author

harshanarayana commented Apr 12, 2023

@damemi I've addressed most of the comments already. Let me tenses again and push changes.. I'm fine with moving this to 0.28

@damemi
Copy link
Contributor

damemi commented Apr 12, 2023

@harshanarayana I bumped the comments that I noticed that still need to be fixed from when we left this off

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 11, 2023
@a7i
Copy link
Contributor

a7i commented Jul 11, 2023

/remove-lifecycle stale

@harshanarayana apologies for the delay on this review. would be good to include this as part of next release. would you be able to address the issues above? I can also address if you are ok with that.

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 11, 2023
@harshanarayana
Copy link
Contributor Author

@a7i I will take care of this. I might just close and re-create a new PR entirely with a clean slate and keep a reference for this to track the history of discussion. I will have a PR ready for you in a day or two.

@harshanarayana
Copy link
Contributor Author

Closing this in favor of #1189

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. 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.

Proposal: OpenTelemetry Tracing Per-Plugin
6 participants