Skip to content

Commit

Permalink
Merge pull request #905 from mirackara/awspatch
Browse files Browse the repository at this point in the history
Azure Utilization Detecting Bug
  • Loading branch information
nr-swilloughby committed May 1, 2024
2 parents 3462954 + a884592 commit 2982fb8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion v3/internal/utilization/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ func gatherAzure(util *Data, client *http.Client) error {
if err != nil {
// Only return the error here if it is unexpected to prevent
// warning customers who aren't running Azure about a timeout.
if _, ok := err.(unexpectedAzureErr); ok {
// If any of the other vendors have already been detected and set, and we have an error, we should not return the error
// If no vendors have been detected, we should return the error.
if _, ok := err.(unexpectedAzureErr); ok && !util.Vendors.AnySet() {
return err
}
return nil
Expand Down
4 changes: 3 additions & 1 deletion v3/internal/utilization/utilization.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

// Package utilization implements the Utilization spec, available at
// https://source.datanerd.us/agents/agent-specs/blob/master/Utilization.md
//
package utilization

import (
Expand Down Expand Up @@ -84,6 +83,9 @@ type vendors struct {
Kubernetes *kubernetes `json:"kubernetes,omitempty"`
}

func (v *vendors) AnySet() bool {
return v.AWS != nil || v.Azure != nil || v.GCP != nil || v.PCF != nil || v.Docker != nil || v.Kubernetes != nil
}
func (v *vendors) isEmpty() bool {
return nil == v || *v == vendors{}
}
Expand Down

0 comments on commit 2982fb8

Please sign in to comment.