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

refactor: Reduce code duplication in analytics.go #397

Merged
merged 2 commits into from
Nov 17, 2021

Conversation

t-junjie
Copy link
Contributor

Refer to #393

Copy link
Collaborator

@theckman theckman left a comment

Choose a reason for hiding this comment

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

Thank you for this contribution! I did find two minor things that I requested changes on, but beyond that this should be good to go.

I had originally tagged the issue (#393) to be part of v1.6.0, but since you've opened this PR up so quickly I can make it part of the upcoming v1.5.0 release once the changes are made.

analytics.go Outdated
)

const baseURL = "/analytics/metrics/incidents"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since constants are local to the package and not just this file, would you be able to make this constant name a little more precise? Maybe analyticsBaseURL?

analytics.go Outdated
h := map[string]string{
"X-EARLY-ACCESS": "analytics-v2",
}

resp, err := c.post(ctx, "/analytics/metrics/incidents/teams", analytics, h)
URL := fmt.Sprintf("%s/%s", baseURL, endpoint)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is an odd nit, I'll admit, but since capitalized identifiers are meant for things that are exported it feels a little unusual to have this be called URL. Could you rename it to url or even just u?

@theckman theckman added this to the v1.5.0 milestone Nov 16, 2021
baseURL -> analyticsBaseURL
URL -> u
@t-junjie
Copy link
Contributor Author

Thank you for reviewing my commits!
I have made the appropriate changes.

Copy link
Collaborator

@theckman theckman left a comment

Choose a reason for hiding this comment

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

Thank you again! I'll be merging this in shortly.

@theckman theckman merged commit 9190a3b into PagerDuty:master Nov 17, 2021
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.

2 participants