Sha256: 09b508239fd8e2fed7770b529971e678302e4922f5eaba29157a1f5757d170ed

Contents?: true

Size: 1.54 KB

Versions: 19

Compression:

Stored size: 1.54 KB

Contents

# Create a new dashboard returns "OK" response

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

body = DatadogAPIClient::V1::Dashboard.new({
  layout_type: DatadogAPIClient::V1::DashboardLayoutType::ORDERED,
  title: "Example-Create_a_new_dashboard_returns_OK_response with Profile Metrics Query",
  widgets: [
    DatadogAPIClient::V1::Widget.new({
      definition: DatadogAPIClient::V1::TimeseriesWidgetDefinition.new({
        type: DatadogAPIClient::V1::TimeseriesWidgetDefinitionType::TIMESERIES,
        requests: [
          DatadogAPIClient::V1::TimeseriesWidgetRequest.new({
            profile_metrics_query: DatadogAPIClient::V1::LogQueryDefinition.new({
              compute: DatadogAPIClient::V1::LogsQueryCompute.new({
                aggregation: "sum",
                facet: "@prof_core_cpu_cores",
              }),
              search: DatadogAPIClient::V1::LogQueryDefinitionSearch.new({
                query: "runtime:jvm",
              }),
              group_by: [
                DatadogAPIClient::V1::LogQueryDefinitionGroupBy.new({
                  facet: "service",
                  limit: 10,
                  sort: DatadogAPIClient::V1::LogQueryDefinitionGroupBySort.new({
                    aggregation: "sum",
                    order: DatadogAPIClient::V1::WidgetSort::DESCENDING,
                    facet: "@prof_core_cpu_cores",
                  }),
                }),
              ],
            }),
          }),
        ],
      }),
    }),
  ],
})
p api_instance.create_dashboard(body)

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
datadog_api_client-2.9.0 examples/v1/dashboards/CreateDashboard.rb
datadog_api_client-2.8.0 examples/v1/dashboards/CreateDashboard.rb
datadog_api_client-2.7.0 examples/v1/dashboards/CreateDashboard.rb
datadog_api_client-2.6.0 examples/v1/dashboards/CreateDashboard.rb
datadog_api_client-2.5.0 examples/v1/dashboards/CreateDashboard.rb
datadog_api_client-2.4.0 examples/v1/dashboards/CreateDashboard.rb
datadog_api_client-2.3.0 examples/v1/dashboards/CreateDashboard.rb
datadog_api_client-2.2.0 examples/v1/dashboards/CreateDashboard.rb
datadog_api_client-2.1.0 examples/v1/dashboards/CreateDashboard.rb
datadog_api_client-2.0.2 examples/v1/dashboards/CreateDashboard.rb
datadog_api_client-2.0.1 examples/v1/dashboards/CreateDashboard.rb
datadog_api_client-2.0.0 examples/v1/dashboards/CreateDashboard.rb
datadog_api_client-1.11.0 examples/v1/dashboards/CreateDashboard.rb
datadog_api_client-1.10.0 examples/v1/dashboards/CreateDashboard.rb
datadog_api_client-1.9.0 examples/v1/dashboards/CreateDashboard.rb
datadog_api_client-1.8.0 examples/v1/dashboards/CreateDashboard.rb
datadog_api_client-1.7.0 examples/v1/dashboards/CreateDashboard.rb
datadog_api_client-1.6.0 examples/v1/dashboards/CreateDashboard.rb
datadog_api_client-1.5.0 examples/v1/dashboards/CreateDashboard.rb