Skip to content

Comments

fix(gcp): resolve deprecation in GCP Stackdriver API#7350

Open
majiayu000 wants to merge 3 commits intokedacore:mainfrom
majiayu000:fix-6653-resolve-deprecation-in-gcp-sta-1231-0502
Open

fix(gcp): resolve deprecation in GCP Stackdriver API#7350
majiayu000 wants to merge 3 commits intokedacore:mainfrom
majiayu000:fix-6653-resolve-deprecation-in-gcp-sta-1231-0502

Conversation

@majiayu000
Copy link
Contributor

Fixes #6653

Changes

  • Replace deprecated QueryTimeSeries MQL-based API with filter-based ListTimeSeries API
  • Add new GetPubSubMetrics method that uses existing GetMetrics infrastructure
  • Remove QueryClient dependency and related MQL query building code
  • Update tests to validate new aggregation helper function

@majiayu000 majiayu000 requested a review from a team as a code owner December 30, 2025 21:18
@github-actions
Copy link

Thank you for your contribution! 🙏

Please understand that we will do our best to review your PR and give you feedback as soon as possible, but please bear with us if it takes a little longer as expected.

While you are waiting, make sure to:

  • Add an entry in our changelog in alphabetical order and link related issue
  • Update the documentation, if needed
  • Add unit & e2e tests for your changes
  • GitHub checks are passing
  • Is the DCO check failing? Here is how you can fix DCO issues

Once the initial tests are successful, a KEDA member will ensure that the e2e tests are run. Once the e2e tests have been successfully completed, the PR may be merged at a later date. Please be patient.

Learn more about our contribution guide.

@keda-automation keda-automation requested a review from a team December 30, 2025 21:18
@snyk-io
Copy link

snyk-io bot commented Dec 30, 2025

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@JorTurFer
Copy link
Member

JorTurFer commented Dec 31, 2025

/run-e2e gcp
Update: You can check the progress here

@JorTurFer
Copy link
Member

could you fix DCO check please?

@majiayu000
Copy link
Contributor Author

Sorry, I will fix it soon.

@majiayu000 majiayu000 force-pushed the fix-6653-resolve-deprecation-in-gcp-sta-1231-0502 branch from 9a48a90 to 44f633d Compare January 1, 2026 18:12
Replace the deprecated MQL-based QueryTimeSeries API with the filter-based
ListTimeSeries API for GCP PubSub metrics.

Changes:
- Remove deprecated QueryClient and QueryTimeSeries usage
- Remove deprecated BuildMQLQuery and related MQL functions
- Add GetPubSubMetrics method using filter-based API
- Add NewPubSubAggregator to map aggregation functions to filter API
- Update gcp_pubsub_scaler.go to use new GetPubSubMetrics method
- Update tests to reflect API changes
- Extract aggregation function names to constants
- Replace string literals with constants in aligner/reducer/aggregator
- Use switch for resource type handling in GetPubSubMetrics

This change addresses the deprecation of MQL (Monitoring Query Language)
announced by GCP. The new implementation uses the recommended ListTimeSeries
API with filter strings, which provides equivalent functionality.

Closes kedacore#6653

Signed-off-by: lif <1835304752@qq.com>
@majiayu000 majiayu000 force-pushed the fix-6653-resolve-deprecation-in-gcp-sta-1231-0502 branch from 44f633d to 86f3e2c Compare January 1, 2026 18:13
@JorTurFer
Copy link
Member

JorTurFer commented Jan 1, 2026

/run-e2e gcp
Update: You can check the progress here

@JorTurFer
Copy link
Member

JorTurFer commented Jan 1, 2026

/run-e2e gcp_pubsub_topic
Update: You can check the progress here

When using the ListTimeSeries API with aggregations on distribution-type
metrics (like message_sizes), the API may return DistributionValue type.
This fix adds proper handling for:
- DistributionValue: returns the count from the distribution
- BoolValue: returns 1 for true, 0 for false

Also adds comprehensive unit tests for extractValueFromPoint function.

Signed-off-by: majiayu000 <jiayuma2@cisco.com>
@JorTurFer
Copy link
Member

JorTurFer commented Jan 4, 2026

/run-e2e gcp_pubsub_topic
Update: You can check the progress here

@JorTurFer JorTurFer mentioned this pull request Jan 11, 2026
44 tasks
…-0502

Signed-off-by: Jan Wozniak <wozniak.jan@gmail.com>
@rickbrouwer
Copy link
Member

rickbrouwer commented Jan 22, 2026

/run-e2e gcp
Update: You can check the progress here

@wozniakjan
Copy link
Member

wozniakjan commented Jan 22, 2026

afaict the commits are all signed off, I set the DCO to pass

$ gh pr view 7350 --json 'commits' --jq '.commits[].messageBody' | grep 'Signed-off-by:'
Signed-off-by: lif <1835304752@qq.com>
Signed-off-by: majiayu000 <jiayuma2@cisco.com>
Signed-off-by: Jan Wozniak <wozniak.jan@gmail.com>

(the last commit is just resolving the CHANGELOG conflict)

@rickbrouwer
Copy link
Member

rickbrouwer commented Jan 22, 2026

What I'm especially curious about is: Does this scaler still function exactly the same way after these changes?

Are we sure that the scaling behavior for e.g. aggregation: "count" or aggregation: "sum" has the same scaling behavior?

@rickbrouwer rickbrouwer added the waiting-author-response All PR's or Issues where we are waiting for a response from the author label Feb 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting-author-response All PR's or Issues where we are waiting for a response from the author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resolve deprecation in GCP Stackdrive API

4 participants