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

Azure Log Analytics, Prometheus scaler: custom HTTP client timeout #6607

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

zroubalik
Copy link
Member

@zroubalik zroubalik commented Mar 6, 2025

Timeout in miliseconds for these specific triggers. This value will override the value defined in KEDA_HTTP_DEFAULT_TIMEOUT

Checklist

Relates to #6603

@zroubalik zroubalik requested a review from a team as a code owner March 6, 2025 13:58
@zroubalik
Copy link
Member Author

zroubalik commented Mar 7, 2025

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

@zroubalik
Copy link
Member Author

zroubalik commented Mar 7, 2025

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

@zroubalik zroubalik mentioned this pull request Mar 7, 2025
28 tasks
@@ -49,7 +49,8 @@ type prometheusMetadata struct {
CustomHeaders map[string]string `keda:"name=customHeaders, order=triggerMetadata, optional"`
IgnoreNullValues bool `keda:"name=ignoreNullValues, order=triggerMetadata, default=true"`
UnsafeSSL bool `keda:"name=unsafeSsl, order=triggerMetadata, optional"`
AwsRegion string `keda:"name=awsRegion, order=triggerMetadata;authParams, optional"`
AwsRegion string `keda:"name=awsRegion, order=triggerMetadata;authParams, optional"`
Timeout int `keda:"name=timeout, order=triggerMetadata, optional"` // custom HTTP client timeout
Copy link
Member

Choose a reason for hiding this comment

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

Does it make sense supporting time.Duration as input type? it's more explicit

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with Jorge. Innw @wozniakjan, we can modify this existing method to support new input type

func setConfigValueHelper(params Params, valFromConfig string, field reflect.Value) error {
paramValue := reflect.ValueOf(valFromConfig)
if paramValue.Type().AssignableTo(field.Type()) {
field.SetString(valFromConfig)
return nil
}
if paramValue.Type().ConvertibleTo(field.Type()) {
field.Set(paramValue.Convert(field.Type()))
return nil
}
if field.Type() == reflect.TypeOf(url.Values{}) {
return setConfigValueURLParams(params, valFromConfig, field)
}
if field.Kind() == reflect.Map {
return setConfigValueMap(params, valFromConfig, field)
}
if field.Kind() == reflect.Slice {
return setConfigValueSlice(params, valFromConfig, field)
}
if field.Kind() == reflect.Bool {
boolVal, err := strconv.ParseBool(valFromConfig)
if err != nil {
return fmt.Errorf("unable to parse boolean value %q: %w", valFromConfig, err)
}
field.SetBool(boolVal)
return nil
}
if field.CanInterface() {
ifc := reflect.New(field.Type()).Interface()
if err := json.Unmarshal([]byte(valFromConfig), &ifc); err != nil {
return fmt.Errorf("unable to unmarshal to field type %v: %w", field.Type(), err)
}
field.Set(reflect.ValueOf(ifc).Elem())
return nil
}
return fmt.Errorf("unable to find matching parser for field type %v", field.Type())
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants