Skip to main content

graph_snapshots

Creates, updates, deletes, gets or lists a graph_snapshots resource.

Overview

Namegraph_snapshots
TypeResource
Iddatadog.dashboards.graph_snapshots

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
graph_defstringA 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_querystringThe metric query. One of metric_query or graph_def is required.
snapshot_urlstringURL 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:

NameAccessible byRequired ParamsOptional ParamsDescription
get_graph_snapshotselectstart, endmetric_query, event_query, graph_def, title, height, widthTake 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_snapshotexecdataCreate 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.

NameDatatypeDescription
endinteger (int64)The POSIX timestamp of the end of the query in seconds.
sitestringThe 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.
startinteger (int64)The POSIX timestamp of the start of the query in seconds.
event_querystringA query that adds event bands to the graph.
graph_defstringA 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.
heightinteger (int64)The height of the graph. If no height is specified, the graph's original height is used.
metric_querystringThe metric query.
titlestringA title for the graph. If no title is specified, the graph does not have a title.
widthinteger (int64)The width of the graph. If no width is specified, the graph's original width is used.

SELECT examples

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 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 }}"
}'
;