Skip to content

getSLOHistory fails with SLO type time-slice #2184

@alexanderldavis

Description

@alexanderldavis

Describe the bug

getSLOHistory fails to retrieve SLO History for time-slice SLOs, with the following error:

Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot coerce String value ("NO_DATA") to `java.lang.Double` value (but might if coercion using `CoercionConfig` was enabled)
 at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 1, column: 971] (through reference chain: com.datadog.api.client.v1.model.SLOHistoryResponse["data"]->com.datadog.api.client.v1.model.SLOHistoryResponseData["overall"]->com.datadog.api.client.v1.model.SLOHistorySLIData["history"]->java.util.ArrayList[0]->java.util.ArrayList[1])

Only SLOs of type time-slice are affected.

To Reproduce
Steps to reproduce the behavior:

We followed the most minimal example from the SLO API documentation:

ApiClient defaultClient = ApiClient.getDefaultApiClient();
ServiceLevelObjectivesApi apiInstance = new ServiceLevelObjectivesApi(defaultClient);

ServiceLevelObjectivesApi.GetSLOHistoryOptionalParameters parameters = new ServiceLevelObjectivesApi.GetSLOHistoryOptionalParameters().target(99.9).applyCorrection(false);

SLOHistoryResponse result = apiInstance.getSLOHistory(
    "asdf4567asdf7890, "// Some String SLO ID of type time-slice
    OffsetDateTime.now().plusDays(-7).toInstant().getEpochSecond(),
    OffsetDateTime.now().toInstant().getEpochSecond(),
    parameters
);

Expected behavior

apiInstance.getSLOHistory() should return an object of type SLOHistoryResponse.

This currently works for all SLOs in our environment except SLOs of type time-slice. This remains true even if we remove the .target() and .applyCorrection optional parameters from the query.

Environment and Versions (please complete the following information):
A clear and precise description of your setup:

  • v2.21.0 of the Java datadog-api-client

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugBug related issuestaleStale - Bot reminder

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions