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

Conversation

charleslin-appd
Copy link

AppDynamics Cloud offers full-stack observability for large, managed Kubernetes deployments. I would like to use its metrics in flagger.

@charleslin-appd
Copy link
Author

Hi @stefanprodan, I think the PR is ready for review. Please let me know if I can provide anything else. I would love to get this into the next release.

Thank you,

Charles

Copy link
Author

I believe the DCO check is passed. Any chance for getting the PR reviewed?

Copy link
Member

@aryan9600 aryan9600 left a comment

Choose a reason for hiding this comment

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

hey @charlesLin, thanks for opening this PR!
i have a few questions about the code, most of them regarding how the upstream provider itself works. since i have zero experience with AppDynamics Cloud, i don't feel very comfortable reviewing this PR. some more doc refs and explanation would be really helpful.

pkg/metrics/providers/appdynamicscloud.go Show resolved Hide resolved
pkg/metrics/providers/appdynamicscloud.go Show resolved Hide resolved
}
// actual result (non-meta data) is in the data element of the last item
// of the json array
data := anyValue[len(anyValue)-1]["data"].([]any)
Copy link
Member

Choose a reason for hiding this comment

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

according to the OpenAPI docs:

The ModelResultChunk will be always the first item in the response array. The rest of the items might be a mix of DataResultChunk, ErrorResultChunk and HeartbeatResultChunk

how are we safely assuming that the data we are interested in will always be the last item of the array?

Copy link
Author

Choose a reason for hiding this comment

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

Hi @aryan9600 ,

Thank you for reviewing and the questions. AppDynamics Cloud Query response is a big model that covers metrics, logs, traces and spans. I am hoping to reduce the code complexity since we only retrieves a single floating value from the upstream. As long as the query submitted to the upstream is for a single metrics value, the result is either empty DataResultChunk or an array of {timestamp, numbers} pair with the last item being the value that we wanted. Rather than including the entire package of the API data model and un-marshaling all the meta data, what I try to do is to put enough error checking around each type cast so that we can safely return the numeric value at the end. I just realized that I need to error check the last type cast to float64 as well. Will it be good enough once that is added?

Thanks,

Charles

Copy link
Author

Choose a reason for hiding this comment

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

Hi @aryan9600,

I added error checking for type cast of the last item of the array to float. Love to hear your thoughts.

Thanks,

Charles

@codecov-commenter
Copy link

Codecov Report

Base: 54.37% // Head: 54.23% // Decreases project coverage by -0.14% ⚠️

Coverage data is based on head (134f92e) compared to base (05d08d3).
Patch coverage: 39.02% of modified lines in pull request are covered.

❗ Current head 134f92e differs from pull request most recent head 2608dc6. Consider uploading reports for the commit 2608dc6 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1360      +/-   ##
==========================================
- Coverage   54.37%   54.23%   -0.14%     
==========================================
  Files          84       85       +1     
  Lines       10044    10172     +128     
==========================================
+ Hits         5461     5517      +56     
- Misses       3927     3983      +56     
- Partials      656      672      +16     
Impacted Files Coverage Δ
pkg/metrics/providers/factory.go 0.00% <0.00%> (ø)
pkg/metrics/providers/appdynamicscloud.go 39.66% <39.66%> (ø)
pkg/router/istio.go 76.98% <0.00%> (+0.09%) ⬆️
pkg/controller/scheduler_metrics.go 37.64% <0.00%> (+0.74%) ⬆️
pkg/metrics/observers/render.go 62.50% <0.00%> (+18.75%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

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.

None yet

3 participants