Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 122 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2855,6 +2855,127 @@ components:
- service
- name
type: object
FormulaAndFunctionApmMetricStatName:
description: APM metric stat name.
enum:
- errors
- error_rate
- errors_per_second
- latency_avg
- latency_max
- latency_p50
- latency_p75
- latency_p90
- latency_p95
- latency_p99
- latency_p999
- latency_distribution
- hits
- hits_per_second
- total_time
- apdex
example: hits
type: string
x-enum-varnames:
- ERRORS
- ERROR_RATE
- ERRORS_PER_SECOND
- LATENCY_AVG
- LATENCY_MAX
- LATENCY_P50
- LATENCY_P75
- LATENCY_P90
- LATENCY_P95
- LATENCY_P99
- LATENCY_P999
- LATENCY_DISTRIBUTION
- HITS
- HITS_PER_SECOND
- TOTAL_TIME
- APDEX
FormulaAndFunctionApmMetricsDataSource:
description: Data source for APM metrics queries.
enum:
- apm_metrics
example: apm_metrics
type: string
x-enum-varnames:
- APM_METRICS
FormulaAndFunctionApmMetricsQueryDefinition:
description: A formula and functions APM metrics query.
properties:
data_source:
$ref: '#/components/schemas/FormulaAndFunctionApmMetricsDataSource'
group_by:
description: Optional fields to group the query results by.
items:
description: A field to group results by.
example: resource_name
type: string
type: array
name:
description: Name of this query to use in formulas.
example: query_errors
type: string
operation_mode:
description: Optional operation mode to aggregate across operation names.
example: primary
type: string
operation_name:
description: Name of operation on service. If not provided, the primary
operation name is used.
example: web.request
type: string
peer_tags:
description: Tags to query for a specific downstream entity (peer.service,
peer.db_instance, peer.s3, peer.s3.bucket, etc.).
items:
example: peer.service:my-service
type: string
type: array
query_filter:
description: Additional filters for the query using metrics query syntax
(e.g., env, primary_tag).
example: env:prod
type: string
resource_hash:
description: The hash of a specific resource to filter by.
example: abc123
type: string
resource_name:
description: The full name of a specific resource to filter by.
example: GET /api/v1/users
type: string
service:
description: APM service name.
example: web-store
type: string
span_kind:
$ref: '#/components/schemas/FormulaAndFunctionApmMetricsSpanKind'
stat:
$ref: '#/components/schemas/FormulaAndFunctionApmMetricStatName'
required:
- data_source
- name
- stat
type: object
FormulaAndFunctionApmMetricsSpanKind:
description: Describes the relationship between the span, its parents, and its
children in a trace.
enum:
- consumer
- server
- client
- producer
- internal
example: server
type: string
x-enum-varnames:
- CONSUMER
- SERVER
- CLIENT
- PRODUCER
- INTERNAL
FormulaAndFunctionApmResourceStatName:
description: APM resource stat name.
enum:
Expand Down Expand Up @@ -3296,6 +3417,7 @@ components:
- $ref: '#/components/schemas/FormulaAndFunctionProcessQueryDefinition'
- $ref: '#/components/schemas/FormulaAndFunctionApmDependencyStatsQueryDefinition'
- $ref: '#/components/schemas/FormulaAndFunctionApmResourceStatsQueryDefinition'
- $ref: '#/components/schemas/FormulaAndFunctionApmMetricsQueryDefinition'
- $ref: '#/components/schemas/FormulaAndFunctionSLOQueryDefinition'
- $ref: '#/components/schemas/FormulaAndFunctionCloudCostQueryDefinition'
FormulaAndFunctionResponseFormat:
Expand Down
7 changes: 7 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102212,6 +102212,13 @@ paths:
get:
description: Get the list of all critical assets.
operationId: ListSecurityMonitoringCriticalAssets
parameters:
- description: Query string.
in: query
name: query
required: false
schema:
type: string
responses:
'200':
content:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"2025-02-20T10:00:00.000Z"
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"log": {
"_recordingName": "Dashboards/Create a new dashboard with apm metrics widget",
"creator": {
"comment": "persister:fs",
"name": "Polly.JS",
"version": "6.0.5"
},
"entries": [
{
"_id": "1cfcf5ccd2e7dff3d4f3b05c53d79057",
"_order": 0,
"cache": {},
"request": {
"bodySize": 433,
"cookies": [],
"headers": [
{
"_fromType": "array",
"name": "accept",
"value": "application/json"
},
{
"_fromType": "array",
"name": "content-type",
"value": "application/json"
}
],
"headersSize": 560,
"httpVersion": "HTTP/1.1",
"method": "POST",
"postData": {
"mimeType": "application/json",
"params": [],
"text": "{\"layout_type\":\"ordered\",\"title\":\"Test-Create_a_new_dashboard_with_apm_metrics_widget-1740045600\",\"widgets\":[{\"definition\":{\"requests\":[{\"queries\":[{\"data_source\":\"apm_metrics\",\"group_by\":[\"resource_name\"],\"name\":\"query1\",\"query_filter\":\"env:prod\",\"service\":\"web-store\",\"stat\":\"hits\"}],\"response_format\":\"scalar\"}],\"title\":\"\",\"title_align\":\"left\",\"title_size\":\"16\",\"type\":\"query_table\"},\"layout\":{\"height\":4,\"width\":4,\"x\":0,\"y\":0}}]}"
},
"queryString": [],
"url": "https://api.datadoghq.com/api/v1/dashboard"
},
"response": {
"bodySize": 819,
"content": {
"mimeType": "application/json",
"size": 819,
"text": "{\"id\":\"apm-met-ric\",\"title\":\"Test-Create_a_new_dashboard_with_apm_metrics_widget-1740045600\",\"description\":null,\"author_handle\":\"test@datadoghq.com\",\"author_name\":null,\"layout_type\":\"ordered\",\"url\":\"/dashboard/apm-met-ric/testcreateanewdashboardwithapmmetricswidget1740045600\",\"is_read_only\":false,\"template_variables\":null,\"widgets\":[{\"definition\":{\"requests\":[{\"queries\":[{\"data_source\":\"apm_metrics\",\"group_by\":[\"resource_name\"],\"name\":\"query1\",\"query_filter\":\"env:prod\",\"service\":\"web-store\",\"stat\":\"hits\"}],\"response_format\":\"scalar\"}],\"title\":\"\",\"title_align\":\"left\",\"title_size\":\"16\",\"type\":\"query_table\"},\"layout\":{\"height\":4,\"width\":4,\"x\":0,\"y\":0},\"id\":1234567890123456}],\"notify_list\":null,\"created_at\":\"2025-02-20T10:00:01.000000+00:00\",\"modified_at\":\"2025-02-20T10:00:01.000000+00:00\",\"restricted_roles\":[]}"
},
"cookies": [],
"headers": [
{
"name": "content-type",
"value": "application/json"
}
],
"headersSize": 381,
"httpVersion": "HTTP/1.1",
"redirectURL": "",
"status": 200,
"statusText": "OK"
},
"startedDateTime": "2025-02-20T10:00:00.015Z",
"time": 430
},
{
"_id": "71162de52581d0f391d949ff27e2aac0",
"_order": 0,
"cache": {},
"request": {
"bodySize": 0,
"cookies": [],
"headers": [
{
"_fromType": "array",
"name": "accept",
"value": "application/json"
}
],
"headersSize": 520,
"httpVersion": "HTTP/1.1",
"method": "DELETE",
"queryString": [],
"url": "https://api.datadoghq.com/api/v1/dashboard/apm-met-ric"
},
"response": {
"bodySize": 38,
"content": {
"mimeType": "application/json",
"size": 38,
"text": "{\"deleted_dashboard_id\":\"apm-met-ric\"}"
},
"cookies": [],
"headers": [
{
"name": "content-type",
"value": "application/json"
}
],
"headersSize": 379,
"httpVersion": "HTTP/1.1",
"redirectURL": "",
"status": 200,
"statusText": "OK"
},
"startedDateTime": "2025-02-20T10:00:00.460Z",
"time": 380
}
],
"pages": [],
"version": "1.2"
}
}
55 changes: 55 additions & 0 deletions examples/v1/dashboards/CreateDashboard_2252738813.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/**
* Create a new dashboard with apm metrics widget
*/

import { client, v1 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v1.DashboardsApi(configuration);

const params: v1.DashboardsApiCreateDashboardRequest = {
body: {
title: "Example-Dashboard",
widgets: [
{
definition: {
title: "",
titleSize: "16",
titleAlign: "left",
type: "query_table",
requests: [
{
responseFormat: "scalar",
queries: [
{
stat: "hits",
name: "query1",
service: "web-store",
dataSource: "apm_metrics",
queryFilter: "env:prod",
groupBy: ["resource_name"],
},
],
},
],
},
layout: {
x: 0,
y: 0,
width: 4,
height: 4,
},
},
],
layoutType: "ordered",
},
};

apiInstance
.createDashboard(params)
.then((data: v1.Dashboard) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
4 changes: 4 additions & 0 deletions features/support/scenarios_model_mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4590,6 +4590,10 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = {
"operationResponseType": "ListVulnerableAssetsResponse",
},
"v2.ListSecurityMonitoringCriticalAssets": {
"query": {
"type": "string",
"format": "",
},
"operationResponseType": "SecurityMonitoringCriticalAssetsResponse",
},
"v2.CreateSecurityMonitoringCriticalAsset": {
Expand Down
14 changes: 14 additions & 0 deletions features/v1/dashboards.feature
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,20 @@ Feature: Dashboards
And the response "widgets[0].definition.requests[0].queries[0].primary_tag_name" is equal to "datacenter"
And the response "widgets[0].definition.requests[0].queries[0].operation_name" is equal to "cassandra.query"

@team:DataDog/dashboards-backend
Scenario: Create a new dashboard with apm metrics widget
Given new "CreateDashboard" request
And body with value { "title": "{{ unique }}", "widgets": [{"definition": { "title": "", "title_size": "16", "title_align": "left", "type": "query_table", "requests": [ { "response_format": "scalar", "queries": [ { "stat": "hits", "name": "query1", "service": "web-store", "data_source": "apm_metrics", "query_filter": "env:prod", "group_by": ["resource_name"] } ] } ] }, "layout": { "x": 0, "y": 0, "width": 4, "height": 4 } } ], "layout_type": "ordered" }
When the request is sent
Then the response status is 200 OK
And the response "widgets[0].definition.requests[0].response_format" is equal to "scalar"
And the response "widgets[0].definition.requests[0].queries[0].stat" is equal to "hits"
And the response "widgets[0].definition.requests[0].queries[0].group_by[0]" is equal to "resource_name"
And the response "widgets[0].definition.requests[0].queries[0].name" is equal to "query1"
And the response "widgets[0].definition.requests[0].queries[0].service" is equal to "web-store"
And the response "widgets[0].definition.requests[0].queries[0].data_source" is equal to "apm_metrics"
And the response "widgets[0].definition.requests[0].queries[0].query_filter" is equal to "env:prod"

@team:DataDog/dashboards-backend
Scenario: Create a new dashboard with apm resource stats widget
Given new "CreateDashboard" request
Expand Down
4 changes: 4 additions & 0 deletions packages/datadog-api-client-v1/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,10 @@ export { EventTimelineWidgetDefinitionType } from "./models/EventTimelineWidgetD
export { FormulaAndFunctionApmDependencyStatName } from "./models/FormulaAndFunctionApmDependencyStatName";
export { FormulaAndFunctionApmDependencyStatsDataSource } from "./models/FormulaAndFunctionApmDependencyStatsDataSource";
export { FormulaAndFunctionApmDependencyStatsQueryDefinition } from "./models/FormulaAndFunctionApmDependencyStatsQueryDefinition";
export { FormulaAndFunctionApmMetricsDataSource } from "./models/FormulaAndFunctionApmMetricsDataSource";
export { FormulaAndFunctionApmMetricsQueryDefinition } from "./models/FormulaAndFunctionApmMetricsQueryDefinition";
export { FormulaAndFunctionApmMetricsSpanKind } from "./models/FormulaAndFunctionApmMetricsSpanKind";
export { FormulaAndFunctionApmMetricStatName } from "./models/FormulaAndFunctionApmMetricStatName";
export { FormulaAndFunctionApmResourceStatName } from "./models/FormulaAndFunctionApmResourceStatName";
export { FormulaAndFunctionApmResourceStatsDataSource } from "./models/FormulaAndFunctionApmResourceStatsDataSource";
export { FormulaAndFunctionApmResourceStatsQueryDefinition } from "./models/FormulaAndFunctionApmResourceStatsQueryDefinition";
Expand Down
Loading
Loading