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

Switch tuning example to use body param over query #94

Merged
merged 1 commit into from
Jul 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 8 additions & 4 deletions docs/user-guide/models.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,17 @@ models:
url: "http://tuning/holt_winters"
successCodes:
- 200
parameterMode: query
parameterMode: body
seasonalPeriods: 6
storedSeasons: 4
trend: additive
seasonal: additive
```

> Note this uses the `parameterMode: body` instead of `parameterMode: query`, this is because for large amounts of
> data the URL generated can become too long and invalid. See
> [#89](https://github.com/jthomperoo/predictive-horizontal-pod-autoscaler/issues/89).

The hook is defined with the name `runtimeTuningFetchHook`.

The supported hook types for the PHPA are:
Expand Down Expand Up @@ -173,7 +177,7 @@ models:
url: "http://tuning/holt_winters"
successCodes:
- 200
parameterMode: query
parameterMode: body
beta: 0.9
gamma: 0.9
seasonalPeriods: 6
Expand All @@ -199,7 +203,7 @@ models:
url: "http://tuning/holt_winters"
successCodes:
- 200
parameterMode: query
parameterMode: body
alpha: 0.9
beta: 0.9
gamma: 0.9
Expand Down Expand Up @@ -237,7 +241,7 @@ The data that the external source will recieve will be formatted as:
"successCodes": [
200
],
"parameterMode": "query"
"parameterMode": "body"
}
},
"seasonalPeriods": 6,
Expand Down
2 changes: 1 addition & 1 deletion examples/dynamic-holt-winters/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ spec:
url: "http://tuning/holt_winters"
successCodes:
- 200
parameterMode: query
parameterMode: body
seasonalPeriods: 6
storedSeasons: 4
trend: "additive"
Expand Down
2 changes: 1 addition & 1 deletion examples/dynamic-holt-winters/phpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ spec:
url: "http://tuning/holt_winters"
successCodes:
- 200
parameterMode: query
parameterMode: body
seasonalPeriods: 6
storedSeasons: 4
trend: "additive"
Expand Down
6 changes: 3 additions & 3 deletions examples/dynamic-holt-winters/tuning/api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 The Predictive Horizontal Pod Autoscaler Authors.
# Copyright 2023 The Predictive Horizontal Pod Autoscaler Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -14,7 +14,7 @@

from flask import Flask, request
import json
import sys

app = Flask(__name__)

ALPHA_VALUE = 0.9
Expand All @@ -23,7 +23,7 @@

@app.route("/holt_winters")
def metric():
print("Received query parameter: {0}".format(request.args.get("value")), file=sys.stderr)
app.logger.info('Received context: %s', request.data)

return json.dumps({
"alpha": ALPHA_VALUE,
Expand Down