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

Optimise GetLog API query in v1alpha3 Logs API #808

Merged
merged 1 commit into from
Sep 15, 2024

Conversation

khrm
Copy link
Contributor

@khrm khrm commented Sep 12, 2024

In logql queries, optimised the following:

  • Duration where we search should be small.
  • Searching for uid(TaskRun/PipelineRunUID) after parsing data.

Also, we are caching Token.

Changes

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

@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 12, 2024
Copy link
Contributor Author

@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.

/kind cleanup

@tekton-robot tekton-robot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Sep 12, 2024
@khrm
Copy link
Contributor Author

khrm commented Sep 12, 2024

/assign @enarha @vdemeester

@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
pkg/api/server/config/config.go Do not exist 0.0%
pkg/api/server/v1alpha2/plugin_logs.go 60.9% 21.6% -39.3
pkg/api/server/v1alpha2/server.go 73.6% 73.9% 0.3

@khrm
Copy link
Contributor Author

khrm commented Sep 12, 2024

/test pull-tekton-results-unit-tests

@khrm khrm force-pushed the f/QueryOptimisation branch from 01b031f to 6696d8d Compare September 12, 2024 05:54
@khrm
Copy link
Contributor Author

khrm commented Sep 12, 2024

/test pull-tekton-results-integration-tests

@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
pkg/api/server/config/config.go Do not exist 0.0%
pkg/api/server/v1alpha2/plugin_logs.go 60.9% 49.5% -11.5
pkg/api/server/v1alpha2/server.go 73.6% 73.9% 0.3

@khrm khrm force-pushed the f/QueryOptimisation branch from 6696d8d to 9f45fd7 Compare September 12, 2024 06:29
@khrm
Copy link
Contributor Author

khrm commented Sep 12, 2024

/test pull-tekton-results-build-tests

@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
pkg/api/server/config/config.go Do not exist 0.0%
pkg/api/server/v1alpha2/plugin_logs.go 60.9% 49.5% -11.5
pkg/api/server/v1alpha2/server.go 73.6% 73.9% 0.3

@khrm khrm force-pushed the f/QueryOptimisation branch from 9f45fd7 to 5183e44 Compare September 12, 2024 17:30
@khrm
Copy link
Contributor Author

khrm commented Sep 12, 2024

/hold retesting after rebase.

@tekton-robot tekton-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 12, 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
pkg/api/server/config/config.go Do not exist 0.0%
pkg/api/server/v1alpha2/plugin_logs.go 60.9% 49.5% -11.5
pkg/api/server/v1alpha2/server.go 73.6% 73.9% 0.3

@khrm khrm force-pushed the f/QueryOptimisation branch from 5183e44 to 59c2952 Compare September 12, 2024 18:34
@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
pkg/api/server/config/config.go Do not exist 0.0%
pkg/api/server/v1alpha2/plugin_logs.go 60.9% 49.5% -11.5
pkg/api/server/v1alpha2/server.go 73.6% 73.9% 0.3

@khrm khrm force-pushed the f/QueryOptimisation branch from 59c2952 to fdb7359 Compare September 13, 2024 09:56
@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
pkg/api/server/config/config.go Do not exist 0.0%
pkg/api/server/v1alpha2/plugin_logs.go 60.9% 50.0% -10.9
pkg/api/server/v1alpha2/server.go 73.6% 73.9% 0.3

@khrm
Copy link
Contributor Author

khrm commented Sep 13, 2024

/test pull-tekton-results-integration-tests

@khrm khrm force-pushed the f/QueryOptimisation branch from fdb7359 to 3a34003 Compare September 13, 2024 18:15
@khrm
Copy link
Contributor Author

khrm commented Sep 13, 2024

/test pull-tekton-results-unit-tests

@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
pkg/api/server/config/config.go Do not exist 0.0%
pkg/api/server/v1alpha2/plugin_logs.go 60.9% 49.5% -11.4
pkg/api/server/v1alpha2/server.go 73.6% 73.9% 0.3

@khrm
Copy link
Contributor Author

khrm commented Sep 14, 2024

/hold cancel

@tekton-robot tekton-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 14, 2024
@khrm khrm force-pushed the f/QueryOptimisation branch from 3a34003 to 725ed66 Compare September 14, 2024 17:57
@khrm
Copy link
Contributor Author

khrm commented Sep 14, 2024

/test pull-tekton-results-integration-tests

@khrm
Copy link
Contributor Author

khrm commented Sep 14, 2024

I have added the documentation for new parameter.

@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
pkg/api/server/config/config.go Do not exist 0.0%
pkg/api/server/v1alpha2/plugin_logs.go 60.9% 49.5% -11.4
pkg/api/server/v1alpha2/server.go 73.6% 73.9% 0.3

@@ -25,5 +25,4 @@ These are the common configuration options for all third party logging APIs.
- `LOGGING_PLUGIN_PROXY_PATH`: The path to the proxy to use for the third party logging API. (optional)
- `LOGGING_PLUGIN_CA_CERT`: The CA certificate to use for the third party logging API. This should ideally be passed as environment variable in the deployment spec of the results-api pod. (optional)
- `LOGGING_PLUGIN_TLS_VERIFICATION_DISABLE`: Set to `true` to disable TLS verification for the third party logging API. (optional)

Also, `MAX_RETENTION` is passed to the results API from the Retention Policy ConfigMap.
- `LOGGING_PLUGIN_FORWARDER_BUFFER_DURATION`: Buffer Duration is the max duration taken by third party logging system to forward and store the logs after completion of taskrun and pipelinerun. This is used to search between start time of runs and completion plus buffer duration.
Copy link
Contributor

Choose a reason for hiding this comment

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

The explanation is good. Maybe you can add the type e.g in minutes. The name LOGGING_PLUGIN_FORWARDER_DELAY_DURATION makes more sense to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to LOGGING_PLUGIN_FORWARDER_DELAY_DURATION.

pkg/api/server/v1alpha2/plugin_logs.go Outdated Show resolved Hide resolved
pkg/api/server/v1alpha2/plugin_logs.go Outdated Show resolved Hide resolved
pkg/api/server/v1alpha2/plugin_logs.go Outdated Show resolved Hide resolved
pkg/api/server/v1alpha2/server.go Outdated Show resolved Hide resolved
@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
pkg/api/server/config/config.go Do not exist 0.0%
pkg/api/server/v1alpha2/plugin_logs.go 60.9% 49.5% -11.4
pkg/api/server/v1alpha2/server.go 73.6% 73.9% 0.3

In logql queries, optimised the following:

* Duration where we search should be small.
* Searching for uid(TaskRun/PipelineRunUID) after parsing data.

Also, we are caching Token.
@khrm khrm force-pushed the f/QueryOptimisation branch from 79c2888 to 33890fd Compare September 15, 2024 13:48
@khrm
Copy link
Contributor Author

khrm commented Sep 15, 2024

@khrm
Copy link
Contributor Author

khrm commented Sep 15, 2024

/hold

@tekton-robot tekton-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 15, 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
pkg/api/server/config/config.go Do not exist 0.0%
pkg/api/server/v1alpha2/plugin_logs.go 60.9% 47.7% -13.2
pkg/api/server/v1alpha2/server.go 73.6% 73.9% 0.3

Copy link
Contributor

@enarha enarha 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 Sep 15, 2024
@enarha
Copy link
Contributor

enarha commented Sep 15, 2024

/approve

@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: enarha

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 Sep 15, 2024
@khrm
Copy link
Contributor Author

khrm commented Sep 15, 2024

Done with testing:
CLI
image
GUI
image

@khrm
Copy link
Contributor Author

khrm commented Sep 15, 2024

/hold cancel

@tekton-robot tekton-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 15, 2024
@khrm khrm merged commit 7e63f08 into tektoncd:main Sep 15, 2024
6 checks passed
@khrm khrm deleted the f/QueryOptimisation branch September 15, 2024 14:37
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/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

4 participants