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

Add appdynamicscloud metric provider #1360

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
add more error check and type assertion
Signed-off-by: charleslin-appd <[email protected]>
  • Loading branch information
charleslin-appd committed Feb 19, 2023
commit 2608dc62ce5f8a4a0217712d2c4824766acbdb98
8 changes: 7 additions & 1 deletion pkg/metrics/providers/appdynamicscloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,13 @@ func (p *AppDynamicsCloudProvider) RunQuery(query string) (float64, error) {
return 0, fmt.Errorf("invalid response: %s: %w", string(body), ErrNoValuesFound)
}

return metric[1].(float64), nil
// assert the second item of the array is numeric and return
r, ok := metric[1].(float64)
if ok {
return r, nil
} else {
return 0, fmt.Errorf("failed to retrieve numeric result: %s: %w", query, ErrNoValuesFound)
}
}

// IsOnline calls the Appdynamics Cloud's metrics endpoint with client ID and
Expand Down