Retrieve the list of governance insights available to the organization. Each insight
reports the query used to compute it, so that the value can be computed client-side.
Insights can be filtered by product.
This endpoint requires
any
of the following permissions:
metrics_read
events_read
audit_logs_read
governance_console_read
OAuth apps require the events_read, metrics_read authorization scope to access this endpoint.
Arguments
Query Strings
Name
Type
Description
filter[product]
array
Restrict the results to insights belonging to the given products. May be repeated to
filter by multiple products. Matching is case-insensitive.
The attributes of a governance insight. Exactly one of metric_query, event_query,
usage_query, audit_query, or percentage_query is populated, depending on the data
source the insight is computed from; the rest are null.
audit_query
object
An audit log query used to compute an insight value.
compute [required]
object
The aggregation applied to an audit log query.
aggregation [required]
string
The aggregation function to apply.
interval [required]
int64
The aggregation time window, in milliseconds.
metric [required]
string
The metric or attribute to aggregate.
rollup
string
An optional secondary aggregation applied to the audit query result.
indexes [required]
[string]
The audit log indexes the query runs against.
query [required]
string
The audit log search query string.
source [required]
string
The data source the query runs against.
description [required]
string
A human-readable description of what the insight measures.
display_name [required]
string
Human-readable name of the insight.
event_query
object
An event query used to compute an insight value.
compute
object
The aggregation applied to an event query.
aggregation [required]
string
The aggregation function to apply.
interval [required]
int64
The aggregation time window, in milliseconds.
indexes [required]
[string]
The event indexes the query runs against.
query [required]
string
The event search query string.
metric_query
object
A metric query used to compute an insight value.
query [required]
string
The query string.
reducer [required]
string
How the query result series is reduced to a single value.
source [required]
string
The data source the query runs against.
percentage_query
object
A percentage query that computes an insight value as a ratio of two metric queries.
denominator_query [required]
object
A metric query used to compute an insight value.
query [required]
string
The query string.
reducer [required]
string
How the query result series is reduced to a single value.
source [required]
string
The data source the query runs against.
numerator_query [required]
object
A metric query used to compute an insight value.
query [required]
string
The query string.
reducer [required]
string
How the query result series is reduced to a single value.
source [required]
string
The data source the query runs against.
product [required]
string
The product the insight belongs to.
query_config
object
Query execution context for running insight queries directly.
chart_type
string
The chart type used to render the insight.
comparison_shift [required]
string
The window used for the previous value comparison; for example, week or month.
default_value
int64
The default value to display when no data is available.
directionality
enum
Whether an increase in the insight's value is good, bad, or neutral.
Allowed enum values: neutral,increase_better,decrease_better
effective_time_window_days [required]
int64
The number of days the insight value is computed over.
sub_product [required]
string
The sub-product the insight belongs to, if any.
time_range [required]
string
The time range the insight value is computed over, if applicable.
unit_name [required]
string
The unit that the insight's value is measured in.
usage_query
object
A usage query used to compute an insight value.
query [required]
string
The usage query string.
reducer [required]
string
How the query result series is reduced to a single value.
id [required]
string
The unique identifier of the insight.
type [required]
enum
JSON:API resource type for a governance insight.
Allowed enum values: insight
{"data":[{"attributes":{"audit_query":{"compute":{"aggregation":"cardinality","interval":86400000,"metric":"@usr.id","rollup":""},"indexes":["main"],"query":"@evt.name:Dashboard","source":"audit"},"description":"Number of users who have used the Dashboard in the last 30 days","display_name":"Active Dashboards","event_query":{"compute":{"aggregation":"count","interval":86400000},"indexes":["main"],"query":"source:cloudtrail"},"metric_query":{"query":"avg:system.cpu.user{*}","reducer":"avg","source":"metrics"},"percentage_query":{"denominator_query":{"query":"avg:system.cpu.user{*}","reducer":"avg","source":"metrics"},"numerator_query":{"query":"avg:system.cpu.user{*}","reducer":"avg","source":"metrics"}},"product":"Usage","query_config":{"chart_type":"line","comparison_shift":"month","default_value":0,"directionality":"neutral","effective_time_window_days":30},"sub_product":"Indexes","time_range":"month","unit_name":"active dashboards","usage_query":{"query":"logs_indexed_events","reducer":"sum"}},"id":"498ee21f-8037-48b8-a961-a488692902f4","type":"insight"}]}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* List insights returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();configuration.unstableOperations["v2.listGovernanceInsights"]=true;constapiInstance=newv2.GovernanceConsoleApi(configuration);apiInstance.listGovernanceInsights().then((data: v2.GovernanceInsightsResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));