Skip to content
Merged
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
118 changes: 118 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2709,6 +2709,123 @@ 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 @@ -3138,6 +3255,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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2025-02-20T10:00:00.000Z

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions examples/v1/dashboards/CreateDashboard_2252738813.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Create a new dashboard with apm metrics widget

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::DashboardsAPI.new

body = DatadogAPIClient::V1::Dashboard.new({
title: "Example-Dashboard",
widgets: [
DatadogAPIClient::V1::Widget.new({
definition: DatadogAPIClient::V1::TableWidgetDefinition.new({
title: "",
title_size: "16",
title_align: DatadogAPIClient::V1::WidgetTextAlign::LEFT,
type: DatadogAPIClient::V1::TableWidgetDefinitionType::QUERY_TABLE,
requests: [
DatadogAPIClient::V1::TableWidgetRequest.new({
response_format: DatadogAPIClient::V1::FormulaAndFunctionResponseFormat::SCALAR,
queries: [
DatadogAPIClient::V1::FormulaAndFunctionApmMetricsQueryDefinition.new({
stat: DatadogAPIClient::V1::FormulaAndFunctionApmMetricStatName::HITS,
name: "query1",
service: "web-store",
data_source: DatadogAPIClient::V1::FormulaAndFunctionApmMetricsDataSource::APM_METRICS,
query_filter: "env:prod",
group_by: [
"resource_name",
],
}),
],
}),
],
}),
layout: DatadogAPIClient::V1::WidgetLayout.new({
x: 0,
y: 0,
width: 4,
height: 4,
}),
}),
],
layout_type: DatadogAPIClient::V1::DashboardLayoutType::ORDERED,
})
p api_instance.create_dashboard(body)
14 changes: 14 additions & 0 deletions features/v1/dashboards.feature
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,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 lib/datadog_api_client/inflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ def overrides
"v1.formula_and_function_apm_dependency_stat_name" => "FormulaAndFunctionApmDependencyStatName",
"v1.formula_and_function_apm_dependency_stats_data_source" => "FormulaAndFunctionApmDependencyStatsDataSource",
"v1.formula_and_function_apm_dependency_stats_query_definition" => "FormulaAndFunctionApmDependencyStatsQueryDefinition",
"v1.formula_and_function_apm_metrics_data_source" => "FormulaAndFunctionApmMetricsDataSource",
"v1.formula_and_function_apm_metrics_query_definition" => "FormulaAndFunctionApmMetricsQueryDefinition",
"v1.formula_and_function_apm_metrics_span_kind" => "FormulaAndFunctionApmMetricsSpanKind",
"v1.formula_and_function_apm_metric_stat_name" => "FormulaAndFunctionApmMetricStatName",
"v1.formula_and_function_apm_resource_stat_name" => "FormulaAndFunctionApmResourceStatName",
"v1.formula_and_function_apm_resource_stats_data_source" => "FormulaAndFunctionApmResourceStatsDataSource",
"v1.formula_and_function_apm_resource_stats_query_definition" => "FormulaAndFunctionApmResourceStatsQueryDefinition",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
=begin
#Datadog API V1 Collection

#Collection of all Datadog Public endpoints.

The version of the OpenAPI document: 1.0
Contact: support@datadoghq.com
Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator

Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
This product includes software developed at Datadog (https://www.datadoghq.com/).
Copyright 2020-Present Datadog, Inc.

=end

require 'date'
require 'time'

module DatadogAPIClient::V1
# APM metric stat name.
class FormulaAndFunctionApmMetricStatName
include BaseEnumModel

ERRORS = "errors".freeze
ERROR_RATE = "error_rate".freeze
ERRORS_PER_SECOND = "errors_per_second".freeze
LATENCY_AVG = "latency_avg".freeze
LATENCY_MAX = "latency_max".freeze
LATENCY_P50 = "latency_p50".freeze
LATENCY_P75 = "latency_p75".freeze
LATENCY_P90 = "latency_p90".freeze
LATENCY_P95 = "latency_p95".freeze
LATENCY_P99 = "latency_p99".freeze
LATENCY_P999 = "latency_p999".freeze
LATENCY_DISTRIBUTION = "latency_distribution".freeze
HITS = "hits".freeze
HITS_PER_SECOND = "hits_per_second".freeze
TOTAL_TIME = "total_time".freeze
APDEX = "apdex".freeze
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
=begin
#Datadog API V1 Collection

#Collection of all Datadog Public endpoints.

The version of the OpenAPI document: 1.0
Contact: support@datadoghq.com
Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator

Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
This product includes software developed at Datadog (https://www.datadoghq.com/).
Copyright 2020-Present Datadog, Inc.

=end

require 'date'
require 'time'

module DatadogAPIClient::V1
# Data source for APM metrics queries.
class FormulaAndFunctionApmMetricsDataSource
include BaseEnumModel

APM_METRICS = "apm_metrics".freeze
end
end
Loading
Loading