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

fix(metricprovider): support Datadog v2 API Fixes #2813 #2997

Merged
merged 16 commits into from
Oct 14, 2023

Commits on Oct 12, 2023

  1. Add note in CONTRIBUTING.md that I would have found useful.

    Signed-off-by: mitchell amihod <[email protected]>
    meeech committed Oct 12, 2023
    Configuration menu
    Copy the full SHA
    a6806f2 View commit details
    Browse the repository at this point in the history
  2. Fix gen-openapi to be more portable - make sure it includes the GOPAT…

    …H in the call.
    
    Signed-off-by: mitchell amihod <[email protected]>
    meeech committed Oct 12, 2023
    Configuration menu
    Copy the full SHA
    6dc41ea View commit details
    Browse the repository at this point in the history
  3. Update docs.

    * Expand working with v2 information
    * Contacted Datadog to get latest info re: v1 deprecation, api limits.
    * Add tips about rate limits, using helm for templates
    * Add more example templates
    
    Signed-off-by: mitchell amihod <[email protected]>
    meeech committed Oct 12, 2023
    Configuration menu
    Copy the full SHA
    9095b80 View commit details
    Browse the repository at this point in the history
  4. Update Datadog Analysis Type

    * Make Query omitempty since now possible it won't exist
    * Add some descriptions
    * Add new properties we need for v2
    
    Queries: We can pass in key:query for queries
    Formula: Makes formulas using the keys from queries
    
    * Defaults!
    Use annotations to declare defaults for some fields. This lets us remove some guard rails from the code itself
    
    Interval: 5m - Move this from code to here
    ApiVersion: v1 - Move this from code to here
    
    * Enums!
    Much like defaults, having enums lets us make assumptions about the incoming metric so we dont need as many guardrails.
    
    ApiVersion: Enum to restrict to v1 or v2
    Signed-off-by: mitchell amihod <[email protected]>
    meeech committed Oct 12, 2023
    Configuration menu
    Copy the full SHA
    f82ca06 View commit details
    Browse the repository at this point in the history
  5. Output of make codegen

    Everything looks ok.
    
    Signed-off-by: mitchell amihod <[email protected]>
    meeech committed Oct 12, 2023
    Configuration menu
    Copy the full SHA
    03d5962 View commit details
    Browse the repository at this point in the history
  6. Pass in metric to provider factory. Validate metric.

    Validating the metric on initialization, rather than spread out throughout. You get earlier feedback if you have a bad metric defined. (Not perfect, but there's limitations with our annotation generator for the rules in the crd. eg: If we could use oneOf, we wouldn't need a lot of this validation)
    
    We check all the mutually exclusive props.
    The props where one requires another.
    We don't have to check for defaults and set them anymore, since they are guaranteed by the crd.
    
    rules:
    
    - ensure we have only query OR queries
    - restrict v1 to query only
    - make sure you only provide a formula with queries
    - make sure multiple queries are accompanied by a formula
    
    Signed-off-by: mitchell amihod <[email protected]>
    meeech committed Oct 12, 2023
    Configuration menu
    Copy the full SHA
    91c4a8d View commit details
    Browse the repository at this point in the history
  7. Remove DefaultApiVersion, remove impossible AnalysisPhaseError

    ApiVersion is guaranteed to have value, and the enum ensures its v1/v2 when user provided.
    
    Updated v1 tests to reflect some of these new realities
    
    Signed-off-by: mitchell amihod <[email protected]>
    meeech committed Oct 12, 2023
    Configuration menu
    Copy the full SHA
    550940f View commit details
    Browse the repository at this point in the history
  8. extract urlBuilding from run

    run was getting a bit long according to the checks
    
    Signed-off-by: mitchell amihod <[email protected]>
    meeech committed Oct 12, 2023
    Configuration menu
    Copy the full SHA
    1903ca7 View commit details
    Browse the repository at this point in the history
  9. Remove some unnecessary stuff for interval.

    It is a straightline to initialize since default is set to 5m for incoming metrics where it is not set.
    
    Signed-off-by: mitchell amihod <[email protected]>
    meeech committed Oct 12, 2023
    Configuration menu
    Copy the full SHA
    2a4949c View commit details
    Browse the repository at this point in the history
  10. Update createRequest

    Split into createRequest v1/v2
    v1 : pretty much unchanged. just extracted
    v2: support for v2/query/scalar
    
    We don't need all the timeseries. I did some testing fetching both scalar and timeseries, and they pretty much lined up.
    
    Also confirmed with DD: From support ticket with DD: "...I have also tested the scalar api endpoint with the last aggregator as well as the timeseries api endpoint. They do indeed return the same values when retrieving the values via the api endpoints. Observing the time it takes to retrieve the values, they remain relatively the same..."
    
    re: query + v2: Keep backwards compat. if we get in a query, we turn it into a queries object to pass on to requestv2 queries into the QueriesPayload.
    Signed-off-by: mitchell amihod <[email protected]>
    meeech committed Oct 12, 2023
    Configuration menu
    Copy the full SHA
    762a951 View commit details
    Browse the repository at this point in the history
  11. Handle v2 scalar responses

    * update the datadogResponseV2 for scalar values
    * handle no results so it has parity with v1 - empty will now usually result in `[]` unless something goes very wrong on dd side
    
    Signed-off-by: mitchell amihod <[email protected]>
    meeech committed Oct 12, 2023
    Configuration menu
    Copy the full SHA
    920e2cb View commit details
    Browse the repository at this point in the history
  12. update v1 no data tests to better reflect reality

    Signed-off-by: mitchell amihod <[email protected]>
    meeech committed Oct 12, 2023
    Configuration menu
    Copy the full SHA
    febeef3 View commit details
    Browse the repository at this point in the history
  13. update v2 tests

    * add some new test cases
    * update mock server to handle queries / formulas validation
    * update no data tests to reflect reality
    * stop all values being the same. it makes it difficult to know find which test case failed. move meaning from comments into the metric name.
    * stop using deprecated ioutil
    
    Signed-off-by: mitchell amihod <[email protected]>
    meeech committed Oct 12, 2023
    Configuration menu
    Copy the full SHA
    250b99e View commit details
    Browse the repository at this point in the history

Commits on Oct 13, 2023

  1. re-codegen

    Signed-off-by: zachaller <[email protected]>
    zachaller committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    0f56e25 View commit details
    Browse the repository at this point in the history
  2. Merge branch 'master' of github.com:argoproj/argo-rollouts into 2813-…

    …datadog-v2-api
    
    Signed-off-by: zachaller <[email protected]>
    zachaller committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    1f6362a View commit details
    Browse the repository at this point in the history
  3. fix lint

    Signed-off-by: zachaller <[email protected]>
    zachaller committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    c9e2560 View commit details
    Browse the repository at this point in the history