Sha256: 47b4b1ae4ecb7597202a04f683b4d2863076cb76f55a4b4bfb9e296be0bc292a

Contents?: true

Size: 1018 Bytes

Versions: 20

Compression:

Stored size: 1018 Bytes

Contents

# Create an SLO object returns "OK" response

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

body = DatadogAPIClient::V1::ServiceLevelObjectiveRequest.new({
  type: DatadogAPIClient::V1::SLOType::METRIC,
  description: "string",
  groups: [
    "env:test",
    "role:mysql",
  ],
  monitor_ids: [],
  name: "Example-Service-Level-Objective",
  query: DatadogAPIClient::V1::ServiceLevelObjectiveQuery.new({
    denominator: "sum:httpservice.hits{!code:3xx}.as_count()",
    numerator: "sum:httpservice.hits{code:2xx}.as_count()",
  }),
  tags: [
    "env:prod",
    "app:core",
  ],
  thresholds: [
    DatadogAPIClient::V1::SLOThreshold.new({
      target: 97.0,
      target_display: "97.0",
      timeframe: DatadogAPIClient::V1::SLOTimeframe::SEVEN_DAYS,
      warning: 98,
      warning_display: "98.0",
    }),
  ],
  timeframe: DatadogAPIClient::V1::SLOTimeframe::SEVEN_DAYS,
  target_threshold: 97.0,
  warning_threshold: 98,
})
p api_instance.create_slo(body)

Version data entries

20 entries across 20 versions & 1 rubygems

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