Skip to content

Datadog v2 API fails when using formulas in query #2813

Description

@tukak

Checklist:

  • I've included steps to reproduce the bug.
  • I've included the version of argo rollouts.

Describe the bug

Using formulas in AnalysisTemplate with Datadog v2 API fails with API error

received non 2xx response code: 400 {"errors":["Functions are not supported in metrics data source field. Use the formulas payload."]}

To Reproduce

Use a query with formula in Datadog provider for AnalysisTemplate and set apiRevision to v2. The query works with v1.

apiVersion: argoproj.io/v1alpha1
kind: AnalysisTemplate
metadata:
  name: rollout-test-success-rate
spec:
  metrics:
    - name: success-rate
      interval: 1m
      successCondition: default(result, 0) < 10
      provider:
        datadog:
          apiVersion: v2
          interval: 1m
          query: |
            sum:trace.rack.request.hits{env:staging AND service:service_name AND http.status_code:5*}.as_count() /
            sum:trace.rack.request.hits{env:staging AND service:service_name AND http.status_code:2*}.as_count() * 100

Expected behavior

It should work with v2 as well, or the note in https://argo-rollouts.readthedocs.io/en/stable/analysis/datadog/ should warn about using formulas (now it says that "If you switch to v2, you will not need to change any other field aside from apiVersion.")

Version

1.5.1

Logs

time="2023-05-26T10:02:02Z" level=info msg="Taking 1 Measurement(s)..." analysisrun=rollout-test-6b986bcd5b-7.1 namespace=default
time="2023-05-26T10:02:02Z" level=info msg="Measurement Completed. Result: Error" analysisrun=rollout-test-6b986bcd5b-7.1 metric=success-rate namespace=default
time="2023-05-26T10:02:02Z" level=warning msg="Measurement had error: received non 2xx response code: 400 {\"errors\":[\"Functions are not supported in metrics data source field. Use the formulas payload.\"]}" analysisrun=rollout-test-6b986bcd5b-7.1 metric=success-rate namespace=default

Message from the maintainers:

Impacted by this bug? Give it a 👍. We prioritize the issues with the most 👍.

Metadata

Metadata

Assignees

Labels

analysisRelated to Analysis CRDbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions