Sha256: 8c1ed93c90ec8a36a900fd68d7e242875dccd57c16dbe398685b6154e4e751ae

Contents?: true

Size: 1.98 KB

Versions: 15

Compression:

Stored size: 1.98 KB

Contents

# Create a distribution widget using a histogram request containing a formulas and functions metrics query

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

body = DatadogAPIClient::V1::Dashboard.new({
  title: "Example-Dashboard",
  widgets: [
    DatadogAPIClient::V1::Widget.new({
      definition: DatadogAPIClient::V1::DistributionWidgetDefinition.new({
        title: "Metrics HOP",
        title_size: "16",
        title_align: DatadogAPIClient::V1::WidgetTextAlign::LEFT,
        show_legend: false,
        type: DatadogAPIClient::V1::DistributionWidgetDefinitionType::DISTRIBUTION,
        custom_links: [
          DatadogAPIClient::V1::WidgetCustomLink.new({
            label: "Example",
            link: "https://example.org/",
          }),
        ],
        xaxis: DatadogAPIClient::V1::DistributionWidgetXAxis.new({
          max: "auto",
          include_zero: true,
          scale: "linear",
          min: "auto",
        }),
        yaxis: DatadogAPIClient::V1::DistributionWidgetYAxis.new({
          max: "auto",
          include_zero: true,
          scale: "linear",
          min: "auto",
        }),
        requests: [
          DatadogAPIClient::V1::DistributionWidgetRequest.new({
            query: DatadogAPIClient::V1::FormulaAndFunctionMetricQueryDefinition.new({
              query: "histogram:trace.Load{*}",
              data_source: DatadogAPIClient::V1::FormulaAndFunctionMetricDataSource::METRICS,
              name: "query1",
            }),
            request_type: DatadogAPIClient::V1::DistributionWidgetHistogramRequestType::HISTOGRAM,
            style: DatadogAPIClient::V1::WidgetStyle.new({
              palette: "dog_classic",
            }),
          }),
        ],
      }),
      layout: DatadogAPIClient::V1::WidgetLayout.new({
        x: 0,
        y: 0,
        width: 4,
        height: 2,
      }),
    }),
  ],
  layout_type: DatadogAPIClient::V1::DashboardLayoutType::ORDERED,
})
p api_instance.create_dashboard(body)

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
datadog_api_client-2.28.1 examples/v1/dashboards/CreateDashboard_252716965.rb
datadog_api_client-2.27.1 examples/v1/dashboards/CreateDashboard_252716965.rb
datadog_api_client-2.26.1 examples/v1/dashboards/CreateDashboard_252716965.rb
datadog_api_client-2.26.0 examples/v1/dashboards/CreateDashboard_252716965.rb
datadog_api_client-2.25.0 examples/v1/dashboards/CreateDashboard_252716965.rb
datadog_api_client-2.24.0 examples/v1/dashboards/CreateDashboard_252716965.rb
datadog_api_client-2.22.0 examples/v1/dashboards/CreateDashboard_252716965.rb
datadog_api_client-2.21.0 examples/v1/dashboards/CreateDashboard_252716965.rb
datadog_api_client-2.20.0 examples/v1/dashboards/CreateDashboard_252716965.rb
datadog_api_client-2.19.0 examples/v1/dashboards/CreateDashboard_252716965.rb
datadog_api_client-2.18.0 examples/v1/dashboards/CreateDashboard_252716965.rb
datadog_api_client-2.17.0 examples/v1/dashboards/CreateDashboard_252716965.rb
datadog_api_client-2.16.0 examples/v1/dashboards/CreateDashboard_252716965.rb
datadog_api_client-2.15.0 examples/v1/dashboards/CreateDashboard_252716965.rb
datadog_api_client-2.14.0 examples/v1/dashboards/CreateDashboard_252716965.rb