graph_snapshots
Creates, updates, deletes, gets or lists a graph_snapshots resource.
Overview
| Name | graph_snapshots |
| Type | Resource |
| Id | datadog.dashboards.graph_snapshots |
Fields
The following fields are returned by SELECT queries:
- get_graph_snapshot
| Name | Datatype | Description |
|---|---|---|
graph_def | string | A JSON document defining the graph. graph_def can be used instead of metric_query. The JSON document uses the [grammar defined here](https://docs.datadoghq.com/graphing/graphing_json/#grammar) and should be formatted to a single line then URL encoded. |
metric_query | string | The metric query. One of metric_query or graph_def is required. |
snapshot_url | string | URL of your [graph snapshot](https://docs.datadoghq.com/metrics/explorer/#snapshot). (example: https://app.datadoghq.com/s/f12345678/aaa-bbb-ccc) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_graph_snapshot | select | start, end | metric_query, event_query, graph_def, title, height, width | Take graph snapshots. Snapshots are PNG images generated by rendering a specified widget in a web page and capturing it once the data is available. The image is then uploaded to cloud storage.<br /><br />Note: When a snapshot is created, there is some delay before it is available. |
create_snapshot | exec | data | Create a snapshot of a graph widget. The snapshot is rendered asynchronously; the returned URL can be polled until the image is ready. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
end | integer (int64) | The POSIX timestamp of the end of the query in seconds. |
site | string | The Datadog site (region) for your organization, for example datadoghq.com, us3.datadoghq.com, us5.datadoghq.com, ap1.datadoghq.com, ap2.datadoghq.com, datadoghq.eu, ddog-gov.com. Resolved from the DD_SITE environment variable when set. Optional: defaults to datadoghq.com, or the value of the DD_SITE environment variable when set; a WHERE value overrides both. |
start | integer (int64) | The POSIX timestamp of the start of the query in seconds. |
event_query | string | A query that adds event bands to the graph. |
graph_def | string | A JSON document defining the graph. graph_def can be used instead of metric_query. The JSON document uses the [grammar defined here](https://docs.datadoghq.com/graphing/graphing_json/#grammar) and should be formatted to a single line then URL encoded. |
height | integer (int64) | The height of the graph. If no height is specified, the graph's original height is used. |
metric_query | string | The metric query. |
title | string | A title for the graph. If no title is specified, the graph does not have a title. |
width | integer (int64) | The width of the graph. If no width is specified, the graph's original width is used. |
SELECT examples
- get_graph_snapshot
Take graph snapshots. Snapshots are PNG images generated by rendering a specified widget in a web page and capturing it once the data is available. The image is then uploaded to cloud storage.<br /><br />Note: When a snapshot is created, there is some delay before it is available.
SELECT
graph_def,
metric_query,
snapshot_url
FROM datadog.dashboards.graph_snapshots
WHERE start = '{{ start }}' -- required
AND end = '{{ end }}' -- required
AND metric_query = '{{ metric_query }}'
AND event_query = '{{ event_query }}'
AND graph_def = '{{ graph_def }}'
AND title = '{{ title }}'
AND height = '{{ height }}'
AND width = '{{ width }}'
;
Lifecycle Methods
EXEC variables use wire (API) names.
- create_snapshot
Create a snapshot of a graph widget. The snapshot is rendered asynchronously; the returned URL can be polled until the image is ready.
EXEC datadog.dashboards.graph_snapshots.create_snapshot
@@json=
'{
"data": "{{ data }}"
}'
;