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

[metricbeat] [meraki] Ignore 400 error for unsupported per-device licensing #42397

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

gpop63
Copy link
Contributor

@gpop63 gpop63 commented Jan 22, 2025

Overview

We should continue collecting metrics even if the getDeviceLicenses function errors with 400 status code.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Disruptive User Impact

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Use cases

Screenshots

Logs

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jan 22, 2025
@gpop63 gpop63 self-assigned this Jan 22, 2025
@gpop63 gpop63 added the Team:Obs-InfraObs Label for the Observability Infrastructure Monitoring team label Jan 22, 2025
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Jan 22, 2025
@gpop63 gpop63 added needs_team Indicates that the issue/PR needs a Team:* label backport-8.17 Automated backport with mergify labels Jan 22, 2025
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Jan 22, 2025
Copy link
Contributor

mergify bot commented Jan 22, 2025

backport-8.x has been added to help with the transition to the new branch 8.x.
If you don't need it please use backport-skip label and remove the backport-8.x label.

@mergify mergify bot added the backport-8.x Automated backport to the 8.x branch with mergify label Jan 22, 2025
@gpop63 gpop63 changed the title [metricbeat] [meraki] Don't error in getDeviceLicenses func [metricbeat] [meraki] Ignore 400 error for unsupported per-device licensing Jan 22, 2025
@gpop63 gpop63 marked this pull request as ready for review January 22, 2025 16:13
@gpop63 gpop63 requested a review from a team as a code owner January 22, 2025 16:13
@gpop63 gpop63 requested review from mauri870 and faec January 22, 2025 16:13
Copy link
Contributor

@ishleenk17 ishleenk17 left a comment

Choose a reason for hiding this comment

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

Looks good!

@@ -150,6 +150,10 @@ func getDeviceChannelUtilization(client *meraki.Client, devices map[Serial]*Devi
func getDeviceLicenses(client *meraki.Client, organizationID string, devices map[Serial]*Device) error {
val, res, err := client.Organizations.GetOrganizationLicenses(organizationID, &meraki.GetOrganizationLicensesQueryParams{})
if err != nil {
// Ignore 400 error for per-device licensing not supported
if res.StatusCode() == 400 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we check for any 4xx error and not just 400?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if we should skip all 4xx error codes, 404 for example could mean the organization was not found meaning the org ID provided in the config is wrong.

Copy link
Contributor

Choose a reason for hiding this comment

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

right. but it also can be something different. I mean I'm pretty sure that even 400 can be returned in multiple cases (something else can be invalid, might not be related to licensing not being supported, right?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8.x Automated backport to the 8.x branch with mergify backport-8.17 Automated backport with mergify Team:Obs-InfraObs Label for the Observability Infrastructure Monitoring team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[metricbeat] [meraki] getDeviceLicenses fails for organizations that do not support per-device licensing
4 participants