Skip to content

Custom Widgets

Garot Conklin edited this page Feb 6, 2025 · 1 revision

Custom Widgets

Guide to creating and using custom widget configurations in your dashboards.

Widget Types

1. Timeseries

widgets:
  - title: "Advanced Timeseries"
    type: "timeseries"
    query: "avg:system.cpu.user{*} by {host}"
    visualization:
      type: "line"
      yaxis:
        min: 0
        max: 100
        scale: "linear"
    markers:
      - value: 80
        type: "error"
        label: "Critical"
      - value: 60
        type: "warning"
        label: "Warning"

2. Query Value

widgets:
  - title: "Formatted Query Value"
    type: "query_value"
    query: "sum:http.requests{*}.as_rate()"
    precision: 2
    format: "number"
    conditional_formats:
      - comparator: ">"
        value: 1000
        palette: "red"
      - comparator: ">"
        value: 500
        palette: "yellow"

3. Heat Map

widgets:
  - title: "Response Time Heat Map"
    type: "heatmap"
    query: "avg:http.response.time{*} by {host,endpoint}"
    style:
      palette: "YlOrRd"
      palette_reverse: false

4. Top List

widgets:
  - title: "Top Hosts by CPU"
    type: "toplist"
    query: "top(avg:system.cpu.user{*} by {host}, 10, 'mean', 'desc')"

Advanced Features

Custom Links

widgets:
  - title: "Service Status"
    type: "query_value"
    query: "avg:service.health{*}"
    custom_links:
      - label: "View Logs"
        link: "https://app.datadoghq.com/logs"
      - label: "Service Dashboard"
        link: "https://app.datadoghq.com/dashboard/custom"

Event Overlay

widgets:
  - title: "System Load with Deployments"
    type: "timeseries"
    query: "avg:system.load.1{*}"
    events:
      - q: "sources:jenkins status:success"
        tags_execution: "and"

Formula Queries

widgets:
  - title: "Error Rate Percentage"
    type: "timeseries"
    requests:
      - query:
          metric: "sum:http.errors{*}"
          aggregator: "sum"
        name: "errors"
      - query:
          metric: "sum:http.requests{*}"
          aggregator: "sum"
        name: "requests"
    formulas:
      - formula: "errors / requests * 100"
        alias: "Error Rate %"

Best Practices

  • Choose appropriate widget types
  • Use clear titles and descriptions
  • Set meaningful thresholds
  • Implement proper formatting
  • Consider dashboard performance

Related Resources

Clone this wiki locally