Sha256: 4a8efdce0121540f02356b892f63389ca0b626c43d4f6e41671a5e93ee3cec30

Contents?: true

Size: 918 Bytes

Versions: 23

Compression:

Stored size: 918 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,
    }),
  ],
  timeframe: DatadogAPIClient::V1::SLOTimeframe::SEVEN_DAYS,
  target_threshold: 97.0,
  warning_threshold: 98,
  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

23 entries across 23 versions & 1 rubygems

Version Path
datadog_api_client-2.28.1 examples/v1/service-level-objectives/UpdateSLO.rb
datadog_api_client-2.27.1 examples/v1/service-level-objectives/UpdateSLO.rb
datadog_api_client-2.26.1 examples/v1/service-level-objectives/UpdateSLO.rb
datadog_api_client-2.26.0 examples/v1/service-level-objectives/UpdateSLO.rb
datadog_api_client-2.25.0 examples/v1/service-level-objectives/UpdateSLO.rb
datadog_api_client-2.24.0 examples/v1/service-level-objectives/UpdateSLO.rb
datadog_api_client-2.22.0 examples/v1/service-level-objectives/UpdateSLO.rb
datadog_api_client-2.21.0 examples/v1/service-level-objectives/UpdateSLO.rb
datadog_api_client-2.20.0 examples/v1/service-level-objectives/UpdateSLO.rb
datadog_api_client-2.19.0 examples/v1/service-level-objectives/UpdateSLO.rb
datadog_api_client-2.18.0 examples/v1/service-level-objectives/UpdateSLO.rb
datadog_api_client-2.17.0 examples/v1/service-level-objectives/UpdateSLO.rb
datadog_api_client-2.16.0 examples/v1/service-level-objectives/UpdateSLO.rb
datadog_api_client-2.15.0 examples/v1/service-level-objectives/UpdateSLO.rb
datadog_api_client-2.14.0 examples/v1/service-level-objectives/UpdateSLO.rb
datadog_api_client-2.13.0 examples/v1/service-level-objectives/UpdateSLO.rb
datadog_api_client-2.12.0 examples/v1/service-level-objectives/UpdateSLO.rb
datadog_api_client-2.11.0 examples/v1/service-level-objectives/UpdateSLO.rb
datadog_api_client-2.10.0 examples/v1/service-level-objectives/UpdateSLO.rb
datadog_api_client-2.9.0 examples/v1/service-level-objectives/UpdateSLO.rb