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 profiling to API server #743

Merged
merged 2 commits into from
Apr 1, 2024

Conversation

sayan-biswas
Copy link
Contributor

Changes

This feature add golang's native profiling server to expose debug profiles.

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you review them:

  • Has Docs included if any changes are user facing
  • Has Tests included if any functionality added or changed
  • Tested your changes locally (if this is a code change)
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add 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 contain the string "action required" if the change requires additional action from users switching to the new release

Release Notes

NONE

@sayan-biswas sayan-biswas added the kind/feature Categorizes issue or PR as related to a new feature. label Mar 28, 2024
@tekton-robot tekton-robot added the release-note-none Denotes a PR that doesnt merit a release note. label Mar 28, 2024
@tekton-robot tekton-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Mar 28, 2024
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
cmd/api/main.go 11.9% 11.4% -0.5
pkg/api/server/config/config.go Do not exist 0.0%

@tektoncd tektoncd deleted a comment from tekton-robot Mar 28, 2024
@sayan-biswas
Copy link
Contributor Author

@gabemontero Here's the PR for enabling basic pprof.

Copy link
Contributor

@khrm khrm left a comment

Choose a reason for hiding this comment

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

/approve

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 28, 2024
Copy link
Contributor

@khrm khrm left a comment

Choose a reason for hiding this comment

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

We also need to put this Port in the service, isn't it? Or we can just port-forward.

@sayan-biswas
Copy link
Contributor Author

Although we can port-forward from pod also, I think having it in the service is the right way.
I'll make the changes, also fix the lint issue.

This feature add golang's native profiling server to expose debug profiles.
@tekton-robot tekton-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 29, 2024
@tekton-robot
Copy link

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

File Old Coverage New Coverage Delta
cmd/api/main.go 11.9% 11.4% -0.5
pkg/api/server/config/config.go Do not exist 0.0%
pkg/api/server/config/config.go Do not exist 0.0%
pkg/api/server/config/config.go Do not exist 0.0%
pkg/api/server/config/config.go Do not exist 0.0%

@sayan-biswas sayan-biswas requested a review from khrm March 29, 2024 15:37
Copy link
Contributor

@khrm khrm left a comment

Choose a reason for hiding this comment

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

/approve
This looks good to me.
@avinal @gabemontero

Copy link
Contributor

@gabemontero gabemontero left a comment

Choose a reason for hiding this comment

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

/lgtm

yeah per the wg call let's start with this vs. the knative approach I tried, and we can iterate on this over time

next time I get back to api perf testing I hope to try this out, either in conjunction, or as an alternative to, my temporary thread dumps in known problematic calls like ListRecords or UpdateLogs

@tekton-robot
Copy link

@gabemontero: changing LGTM is restricted to collaborators

In response to this:

/lgtm

yeah per the wg call let's start with this vs. the knative approach I tried, and we can iterate on this over time

next time I get back to api perf testing I hope to try this out, either in conjunction, or as an alternative to, my temporary thread dumps in known problematic calls like ListRecords or UpdateLogs

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.

@khrm
Copy link
Contributor

khrm commented Apr 1, 2024

@enarha Let's merge this.

Copy link
Member

@avinal avinal left a comment

Choose a reason for hiding this comment

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

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 1, 2024
@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: avinal, gabemontero, khrm

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 merged commit 9a1dbbc into tektoncd:main Apr 1, 2024
6 checks passed
@@ -11,6 +11,8 @@
| DB_SSLMODE | Database SSL mode | verify-full |
| DB_SSLROOTCERT | Path to CA cert used to validate Database cert | /etc/tls/db/ca.crt |
| DB_ENABLE_AUTO_MIGRATION | Auto-migrate the database on startup (create/update schemas). For further details, refer to <https://gorm.io/docs/migration.html> | true (default) |
| PROFILING | Enable profiling server | false (default) |
| PROFILING_PORT | Profiling Server Port | 6060 (default) |
Copy link
Contributor

Choose a reason for hiding this comment

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

fyi @sayan-biswas I just tried this and it looks like the PROFILING_PORT defaulting to 6060 does not take effect

{"level":"info","ts":1715275165.595052,"caller":"api/main.go:237","msg":"Profiling server listening on: "}
{"level":"info","ts":1715275165.5953324,"caller":"api/main.go:259","msg":"Prometheus server listening on: 9090"}

I tried 6060, 8008, and few others anyway, no luck. Unfortunately, you can't run command like netstat in the container.

I'll try explicitly setting it to 6060 and see what happens

Copy link
Contributor

Choose a reason for hiding this comment

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

it works OK when I explicitly set PROFILING_PORT @sayan-biswas

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. release-note-none Denotes a PR that doesnt merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants