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(datadog): check for null values in datadog time series #832

Merged
merged 2 commits into from
Mar 12, 2021

Conversation

gempesaw
Copy link
Contributor

@gempesaw gempesaw commented Feb 24, 2021

hi there! I noticed that a time series I was getting back from datadog had null values in it, leading to NPEs when the code here was trying to populate from the datadog API response.

I'm not sure if I chose a strange query to use in DD, or maybe my app isn't reporting metrics in to DD properly? But, I figured I'd pose the PR here anyway in case other people run into the same null pointer exception.

Here's an example API response I was getting from Datadog that had null values in it:

{
  "status": "ok",
  "res_type": "time_series",
  "from_date": 1612350973000,
  "series": [
    {
      "end": 1612351110000,
      "attributes": {},
      "metric": "(api.request_5xx / api.request_all)",
      "interval": 1,
      "tag_set": [],
      "start": 1612350980000,
      "length": 14,
      "query_index": 0,
      "aggr": "sum",
      "scope": "canary:true,env:lt",
      "pointlist": [
        [
          1612350980000,
          null
        ],
        [
          1612350990000,
          0
        ],
        [
          1612351000000,
          10
        ],
        [
          1612351010000,
          10
        ],
        [
          1612351020000,
          0
        ],
        [
          1612351030000,
          null
        ],
        [
          1612351040000,
          null
        ],
        [
          1612351050000,
          0
        ],
        [
          1612351060000,
          0
        ],
        [
          1612351070000,
          10
        ],
        [
          1612351080000,
          6.666666666666666
        ],
        [
          1612351090000,
          null
        ],
        [
          1612351100000,
          10
        ],
        [
          1612351110000,
          0
        ]
      ],
      "expression": "(sum:api.request_5xx{canary:true,env:lt}.as_count() / sum:api.request_all{canary:true,env:lt})",
      "unit": null,
      "display_name": "(api.request_5xx / api.request_all)"
    }
  ],
  "to_date": 1612351111000,
  "resp_version": 1,
  "query": "sum:api.request_5xx{env:lt,canary:true}.as_count()/sum:api.request_all{env:lt,canary:true}",
  "message": "",
  "group_by": []
}

@gempesaw gempesaw changed the title Check for null values in datadog metric response fix(datadog):check for null values in datadog time series Feb 24, 2021
@gempesaw gempesaw changed the title fix(datadog):check for null values in datadog time series fix(datadog): check for null values in datadog time series Feb 24, 2021
@gempesaw gempesaw marked this pull request as ready for review February 24, 2021 23:29
@fieldju fieldju self-requested a review March 12, 2021 01:07
@fieldju fieldju self-assigned this Mar 12, 2021
@fieldju fieldju merged commit eb91822 into spinnaker:master Mar 12, 2021
@gempesaw gempesaw deleted the patch-1 branch March 16, 2021 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants