Sha256: 2a92626da1ad6d3b9c70cd7f3ee042949adef105de3d2488c5c7a7b41181df37

Contents?: true

Size: 923 Bytes

Versions: 15

Compression:

Stored size: 923 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-Create_an_SLO_object_returns_OK_response",
  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: 95.0,
      target_display: "95.0",
      timeframe: DatadogAPIClient::V1::SLOTimeframe::SEVEN_DAYS,
      warning: 98,
      warning_display: "98.0",
    }),
  ],
})
p api_instance.create_slo(body)

Version data entries

15 entries across 15 versions & 1 rubygems

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