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

UpdateService is not working properly with AlertGroupingParameters #458

Closed
mjlshen opened this issue Aug 16, 2022 · 0 comments · Fixed by #459
Closed

UpdateService is not working properly with AlertGroupingParameters #458

mjlshen opened this issue Aug 16, 2022 · 0 comments · Fixed by #459
Milestone

Comments

@mjlshen
Copy link
Contributor

mjlshen commented Aug 16, 2022

If a PD service has data inside svc.AlerGroupingParameters.Config.Timeout it doesn't appear to be correctly sent when updating, for example if there was an indefinite time-based alert grouping configured.

POC:

package main

import (
	"context"
	"fmt"
	"github.com/PagerDuty/go-pagerduty"
)

var (
	authToken = "<REDACTED>"
	serviceId = "<REDACTED>"
)

func main() {
	client := pagerduty.NewClient(authToken)
	svc, err := client.GetServiceWithContext(context.TODO(), serviceId, nil)
	if err != nil {
		panic(err)
	}

       // If the service has data inside svc.AlertGroupingParameters.Config.Timeout it doesn't appear to be respected, e.g.
       // if there was an indefinite time-based alert grouping configured.
       // pagerduty.AlertGroupingParameters{Type:"time", Config:(*pagerduty.AlertGroupParamsConfig)(0x140001810e0)}
       // pagerduty.AlertGroupParamsConfig{Timeout:0x0, Aggregate:"", Fields:[]string(nil)}

	_, err = client.UpdateServiceWithContext(context.TODO(), *svc)
	if err != nil {
		// Results in panic: HTTP response failed with status code 400,
		// message: Invalid Input Provided (code: 2001): Config is invalid.
		panic(err)
	}
}
@ChuckCrawford ChuckCrawford added this to the v1.6.0 milestone Sep 21, 2022
yithian added a commit to yithian/pagerduty-operator that referenced this issue May 11, 2023
PagerDuty/go-pagerduty#458 has been resolved
so the workaround shouldn't be needed anymore
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 a pull request may close this issue.

2 participants