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
28 changes: 28 additions & 0 deletions docs/datadog_api_client.v1.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,34 @@ datadog\_api\_client.v1.model.formula\_and\_function\_apm\_dependency\_stats\_qu
:members:
:show-inheritance:

datadog\_api\_client.v1.model.formula\_and\_function\_apm\_metric\_stat\_name module
------------------------------------------------------------------------------------

.. automodule:: datadog_api_client.v1.model.formula_and_function_apm_metric_stat_name
:members:
:show-inheritance:

datadog\_api\_client.v1.model.formula\_and\_function\_apm\_metrics\_data\_source module
---------------------------------------------------------------------------------------

.. automodule:: datadog_api_client.v1.model.formula_and_function_apm_metrics_data_source
:members:
:show-inheritance:

datadog\_api\_client.v1.model.formula\_and\_function\_apm\_metrics\_query\_definition module
--------------------------------------------------------------------------------------------

.. automodule:: datadog_api_client.v1.model.formula_and_function_apm_metrics_query_definition
:members:
:show-inheritance:

datadog\_api\_client.v1.model.formula\_and\_function\_apm\_metrics\_span\_kind module
-------------------------------------------------------------------------------------

.. automodule:: datadog_api_client.v1.model.formula_and_function_apm_metrics_span_kind
:members:
:show-inheritance:

datadog\_api\_client.v1.model.formula\_and\_function\_apm\_resource\_stat\_name module
--------------------------------------------------------------------------------------

Expand Down
67 changes: 67 additions & 0 deletions examples/v1/dashboards/CreateDashboard_2252738813.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
"""
Create a new dashboard with apm metrics widget
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.dashboards_api import DashboardsApi
from datadog_api_client.v1.model.dashboard import Dashboard
from datadog_api_client.v1.model.dashboard_layout_type import DashboardLayoutType
from datadog_api_client.v1.model.formula_and_function_apm_metric_stat_name import FormulaAndFunctionApmMetricStatName
from datadog_api_client.v1.model.formula_and_function_apm_metrics_data_source import (
FormulaAndFunctionApmMetricsDataSource,
)
from datadog_api_client.v1.model.formula_and_function_apm_metrics_query_definition import (
FormulaAndFunctionApmMetricsQueryDefinition,
)
from datadog_api_client.v1.model.formula_and_function_response_format import FormulaAndFunctionResponseFormat
from datadog_api_client.v1.model.table_widget_definition import TableWidgetDefinition
from datadog_api_client.v1.model.table_widget_definition_type import TableWidgetDefinitionType
from datadog_api_client.v1.model.table_widget_request import TableWidgetRequest
from datadog_api_client.v1.model.widget import Widget
from datadog_api_client.v1.model.widget_layout import WidgetLayout
from datadog_api_client.v1.model.widget_text_align import WidgetTextAlign

body = Dashboard(
title="Example-Dashboard",
widgets=[
Widget(
definition=TableWidgetDefinition(
title="",
title_size="16",
title_align=WidgetTextAlign.LEFT,
type=TableWidgetDefinitionType.QUERY_TABLE,
requests=[
TableWidgetRequest(
response_format=FormulaAndFunctionResponseFormat.SCALAR,
queries=[
FormulaAndFunctionApmMetricsQueryDefinition(
stat=FormulaAndFunctionApmMetricStatName.HITS,
name="query1",
service="web-store",
data_source=FormulaAndFunctionApmMetricsDataSource.APM_METRICS,
query_filter="env:prod",
group_by=[
"resource_name",
],
),
],
),
],
),
layout=WidgetLayout(
x=0,
y=0,
width=4,
height=4,
),
),
],
layout_type=DashboardLayoutType.ORDERED,
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = DashboardsApi(api_client)
response = api_instance.create_dashboard(body=body)

print(response)
4 changes: 4 additions & 0 deletions src/datadog_api_client/v1/model/bar_chart_widget_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
from datadog_api_client.v1.model.formula_and_function_apm_resource_stats_query_definition import (
FormulaAndFunctionApmResourceStatsQueryDefinition,
)
from datadog_api_client.v1.model.formula_and_function_apm_metrics_query_definition import (
FormulaAndFunctionApmMetricsQueryDefinition,
)
from datadog_api_client.v1.model.formula_and_function_slo_query_definition import (
FormulaAndFunctionSLOQueryDefinition,
)
Expand Down Expand Up @@ -116,6 +119,7 @@ def __init__(
FormulaAndFunctionProcessQueryDefinition,
FormulaAndFunctionApmDependencyStatsQueryDefinition,
FormulaAndFunctionApmResourceStatsQueryDefinition,
FormulaAndFunctionApmMetricsQueryDefinition,
FormulaAndFunctionSLOQueryDefinition,
FormulaAndFunctionCloudCostQueryDefinition,
]
Expand Down
4 changes: 4 additions & 0 deletions src/datadog_api_client/v1/model/change_widget_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
from datadog_api_client.v1.model.formula_and_function_apm_resource_stats_query_definition import (
FormulaAndFunctionApmResourceStatsQueryDefinition,
)
from datadog_api_client.v1.model.formula_and_function_apm_metrics_query_definition import (
FormulaAndFunctionApmMetricsQueryDefinition,
)
from datadog_api_client.v1.model.formula_and_function_slo_query_definition import (
FormulaAndFunctionSLOQueryDefinition,
)
Expand Down Expand Up @@ -125,6 +128,7 @@ def __init__(
FormulaAndFunctionProcessQueryDefinition,
FormulaAndFunctionApmDependencyStatsQueryDefinition,
FormulaAndFunctionApmResourceStatsQueryDefinition,
FormulaAndFunctionApmMetricsQueryDefinition,
FormulaAndFunctionSLOQueryDefinition,
FormulaAndFunctionCloudCostQueryDefinition,
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
from datadog_api_client.v1.model.formula_and_function_apm_resource_stats_query_definition import (
FormulaAndFunctionApmResourceStatsQueryDefinition,
)
from datadog_api_client.v1.model.formula_and_function_apm_metrics_query_definition import (
FormulaAndFunctionApmMetricsQueryDefinition,
)
from datadog_api_client.v1.model.formula_and_function_slo_query_definition import (
FormulaAndFunctionSLOQueryDefinition,
)
Expand Down Expand Up @@ -121,6 +124,7 @@ def __init__(
FormulaAndFunctionProcessQueryDefinition,
FormulaAndFunctionApmDependencyStatsQueryDefinition,
FormulaAndFunctionApmResourceStatsQueryDefinition,
FormulaAndFunctionApmMetricsQueryDefinition,
FormulaAndFunctionSLOQueryDefinition,
FormulaAndFunctionCloudCostQueryDefinition,
]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# 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 2019-Present Datadog, Inc.
from __future__ import annotations


from datadog_api_client.model_utils import (
ModelSimple,
cached_property,
)

from typing import ClassVar


class FormulaAndFunctionApmMetricStatName(ModelSimple):
"""
APM metric stat name.

:param value: Must be one of ["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"].
:type value: str
"""

allowed_values = {
"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",
}
ERRORS: ClassVar["FormulaAndFunctionApmMetricStatName"]
ERROR_RATE: ClassVar["FormulaAndFunctionApmMetricStatName"]
ERRORS_PER_SECOND: ClassVar["FormulaAndFunctionApmMetricStatName"]
LATENCY_AVG: ClassVar["FormulaAndFunctionApmMetricStatName"]
LATENCY_MAX: ClassVar["FormulaAndFunctionApmMetricStatName"]
LATENCY_P50: ClassVar["FormulaAndFunctionApmMetricStatName"]
LATENCY_P75: ClassVar["FormulaAndFunctionApmMetricStatName"]
LATENCY_P90: ClassVar["FormulaAndFunctionApmMetricStatName"]
LATENCY_P95: ClassVar["FormulaAndFunctionApmMetricStatName"]
LATENCY_P99: ClassVar["FormulaAndFunctionApmMetricStatName"]
LATENCY_P999: ClassVar["FormulaAndFunctionApmMetricStatName"]
LATENCY_DISTRIBUTION: ClassVar["FormulaAndFunctionApmMetricStatName"]
HITS: ClassVar["FormulaAndFunctionApmMetricStatName"]
HITS_PER_SECOND: ClassVar["FormulaAndFunctionApmMetricStatName"]
TOTAL_TIME: ClassVar["FormulaAndFunctionApmMetricStatName"]
APDEX: ClassVar["FormulaAndFunctionApmMetricStatName"]

@cached_property
def openapi_types(_):
return {
"value": (str,),
}


FormulaAndFunctionApmMetricStatName.ERRORS = FormulaAndFunctionApmMetricStatName("errors")
FormulaAndFunctionApmMetricStatName.ERROR_RATE = FormulaAndFunctionApmMetricStatName("error_rate")
FormulaAndFunctionApmMetricStatName.ERRORS_PER_SECOND = FormulaAndFunctionApmMetricStatName("errors_per_second")
FormulaAndFunctionApmMetricStatName.LATENCY_AVG = FormulaAndFunctionApmMetricStatName("latency_avg")
FormulaAndFunctionApmMetricStatName.LATENCY_MAX = FormulaAndFunctionApmMetricStatName("latency_max")
FormulaAndFunctionApmMetricStatName.LATENCY_P50 = FormulaAndFunctionApmMetricStatName("latency_p50")
FormulaAndFunctionApmMetricStatName.LATENCY_P75 = FormulaAndFunctionApmMetricStatName("latency_p75")
FormulaAndFunctionApmMetricStatName.LATENCY_P90 = FormulaAndFunctionApmMetricStatName("latency_p90")
FormulaAndFunctionApmMetricStatName.LATENCY_P95 = FormulaAndFunctionApmMetricStatName("latency_p95")
FormulaAndFunctionApmMetricStatName.LATENCY_P99 = FormulaAndFunctionApmMetricStatName("latency_p99")
FormulaAndFunctionApmMetricStatName.LATENCY_P999 = FormulaAndFunctionApmMetricStatName("latency_p999")
FormulaAndFunctionApmMetricStatName.LATENCY_DISTRIBUTION = FormulaAndFunctionApmMetricStatName("latency_distribution")
FormulaAndFunctionApmMetricStatName.HITS = FormulaAndFunctionApmMetricStatName("hits")
FormulaAndFunctionApmMetricStatName.HITS_PER_SECOND = FormulaAndFunctionApmMetricStatName("hits_per_second")
FormulaAndFunctionApmMetricStatName.TOTAL_TIME = FormulaAndFunctionApmMetricStatName("total_time")
FormulaAndFunctionApmMetricStatName.APDEX = FormulaAndFunctionApmMetricStatName("apdex")
Loading
Loading