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

Change service level objective history response structs #330

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

t-sato
Copy link
Contributor

@t-sato t-sato commented Nov 26, 2020

Changed the response struct of SLO's history API.

The SLO's history API response seems to be different from the documentation and actual response.
Documentation: https://docs.datadoghq.com/api/v1/service-level-objectives/#get-an-slos-history:
Maybe the documentation is also old.

API Response is this.
{
  "errors": null,
  "data": {
    "to_ts": 1604242800,
    "type_id": 0,
    "thresholds": {
      "7d": {
        "warning": 99.99,
        "warning_display": "99.99",
        "target": 99.9,
        "target_display": "99.9",
        "timeframe": "7d"
      },
      "30d": {
        "warning": 99.99,
        "warning_display": "99.99",
        "target": 99.9,
        "target_display": "99.9",
        "timeframe": "30d"
      }
    },
    "overall": {
      "span_precision": 1,
      "precision": {
        "7d": 2,
        "30d": 2,
        "custom": 1
      },
      "sli_value": 100,
      "errors": null,
      "preview": false,
      "history": [
        [
          1604156400,
          0
        ]
      ]
    },
    "from_ts": 1604156400,
    "slo": {
      "description": "xxxxxxx",
      "monitor_tags": [
        "service:service",
        "area:area",
        "env:env"
      ],
      "creator": {
        "handle": "xxxxx",
        "name": "xxxxx",
        "email": "xxxxx"
      },
      "thresholds": [
        {
          "warning": 99.99,
          "warning_display": "99.99",
          "target": 99.9,
          "target_display": "99.9",
          "timeframe": "7d"
        },
        {
          "warning": 99.99,
          "warning_display": "99.99",
          "target": 99.9,
          "target_display": "99.9",
          "timeframe": "30d"
        }
      ],
      "type_id": 0,
      "id": "xxxxxxx",
      "monitor_ids": [
        xxxxxxx,
        xxxxxxx
      ],
      "name": "xxxxxx",
      "created_at": 1603702727,
      "tags": [
        "service:service",
      ],
      "modified_at": 1603783363,
      "type": "monitor"
    },
    "type": "monitor",
    "monitors": [
      {
        "precision": 1,
        "monitor_modified": 1603783363,
        "span_precision": 1,
        "id": xxxxxxx,
        "errors": null,
        "name": "xxxxxxx",
        "sli_value": 100,
        "preview": false,
        "monitor_type": "query alert",
        "history": [
          [
            1604156400,
            0
          ]
        ]
      }
    ]
  }
}

above API response is monitor base SLO.

I know there was an update recently.
https://app.datadoghq.com/release_notes#create-and-manage-datadog-slos-via-api

so I changed the following.

  • Change data.groups to data.monitors
  • Add new shemas
    • data.slo
      • it's maybe ServiceLevelObjective
  • Add the missing schemas
    • data.type
    • data.monitors[].monitor_type
    • data.monitors[].monitor_modified
    • data.monitors[].errors

This PR changed monitor-based SLO only.

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.

1 participant