Sha256: 13ae9bd5a8b65fa402b9034e95bf5317f21722d65e941b7224a408316d98633a

Contents?: true

Size: 806 Bytes

Versions: 12

Compression:

Stored size: 806 Bytes

Contents

# Update an SLO returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::ServiceLevelObjectivesAPI.new

# there is a valid "slo" in the system
SLO_DATA_0_ID = ENV["SLO_DATA_0_ID"]
SLO_DATA_0_NAME = ENV["SLO_DATA_0_NAME"]

body = DatadogAPIClient::V1::ServiceLevelObjective.new({
  type: DatadogAPIClient::V1::SLOType::METRIC,
  name: SLO_DATA_0_NAME,
  thresholds: [
    DatadogAPIClient::V1::SLOThreshold.new({
      target: 97.0,
      timeframe: DatadogAPIClient::V1::SLOTimeframe::SEVEN_DAYS,
      warning: 98.0,
    }),
  ],
  query: DatadogAPIClient::V1::ServiceLevelObjectiveQuery.new({
    numerator: "sum:httpservice.hits{code:2xx}.as_count()",
    denominator: "sum:httpservice.hits{!code:3xx}.as_count()",
  }),
})
p api_instance.update_slo(SLO_DATA_0_ID, body)

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
datadog_api_client-2.5.0 examples/v1/service-level-objectives/UpdateSLO.rb
datadog_api_client-2.4.0 examples/v1/service-level-objectives/UpdateSLO.rb
datadog_api_client-2.3.0 examples/v1/service-level-objectives/UpdateSLO.rb
datadog_api_client-2.2.0 examples/v1/service-level-objectives/UpdateSLO.rb
datadog_api_client-2.1.0 examples/v1/service-level-objectives/UpdateSLO.rb
datadog_api_client-2.0.2 examples/v1/service-level-objectives/UpdateSLO.rb
datadog_api_client-2.0.1 examples/v1/service-level-objectives/UpdateSLO.rb
datadog_api_client-2.0.0 examples/v1/service-level-objectives/UpdateSLO.rb
datadog_api_client-1.11.0 examples/v1/service-level-objectives/UpdateSLO.rb
datadog_api_client-1.10.0 examples/v1/service-level-objectives/UpdateSLO.rb
datadog_api_client-1.9.0 examples/v1/service-level-objectives/UpdateSLO.rb
datadog_api_client-1.8.0 examples/v1/service-level-objectives/UpdateSLO.rb