diff --git a/.apigentools-info b/.apigentools-info
index 718f7af0f9e..5e3e0ae0ee7 100644
--- a/.apigentools-info
+++ b/.apigentools-info
@@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.4",
- "regenerated": "2023-03-30 18:44:41.335023",
- "spec_repo_commit": "69b7dfb1"
+ "regenerated": "2023-03-30 19:47:30.946726",
+ "spec_repo_commit": "ba5c9739"
},
"v2": {
"apigentools_version": "1.6.4",
- "regenerated": "2023-03-30 18:44:41.347457",
- "spec_repo_commit": "69b7dfb1"
+ "regenerated": "2023-03-30 19:47:30.961120",
+ "spec_repo_commit": "ba5c9739"
}
}
}
\ No newline at end of file
diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml
index ebc5d019156..6815e9b5b07 100644
--- a/.generator/schemas/v2/openapi.yaml
+++ b/.generator/schemas/v2/openapi.yaml
@@ -428,6 +428,13 @@ components:
required: true
schema:
type: string
+ SpansMetricIDParameter:
+ description: The name of the span-based metric.
+ in: path
+ name: metric_id
+ required: true
+ schema:
+ type: string
UserID:
description: The ID of the user.
in: path
@@ -12846,6 +12853,226 @@ components:
- channel_name
- redirect_url
type: object
+ SpansMetricCompute:
+ description: The compute rule to compute the span-based metric.
+ properties:
+ aggregation_type:
+ $ref: '#/components/schemas/SpansMetricComputeAggregationType'
+ include_percentiles:
+ $ref: '#/components/schemas/SpansMetricComputeIncludePercentiles'
+ path:
+ description: The path to the value the span-based metric will aggregate
+ on (only used if the aggregation type is a "distribution").
+ example: '@duration'
+ type: string
+ required:
+ - aggregation_type
+ type: object
+ SpansMetricComputeAggregationType:
+ description: The type of aggregation to use.
+ enum:
+ - count
+ - distribution
+ example: distribution
+ type: string
+ x-enum-varnames:
+ - COUNT
+ - DISTRIBUTION
+ SpansMetricComputeIncludePercentiles:
+ description: 'Toggle to include or exclude percentile aggregations for distribution
+ metrics.
+
+ Only present when the `aggregation_type` is `distribution`.'
+ example: false
+ type: boolean
+ SpansMetricCreateAttributes:
+ description: The object describing the Datadog span-based metric to create.
+ properties:
+ compute:
+ $ref: '#/components/schemas/SpansMetricCompute'
+ filter:
+ $ref: '#/components/schemas/SpansMetricFilter'
+ group_by:
+ description: The rules for the group by.
+ items:
+ $ref: '#/components/schemas/SpansMetricGroupBy'
+ type: array
+ required:
+ - compute
+ type: object
+ SpansMetricCreateData:
+ description: The new span-based metric properties.
+ properties:
+ attributes:
+ $ref: '#/components/schemas/SpansMetricCreateAttributes'
+ id:
+ $ref: '#/components/schemas/SpansMetricID'
+ type:
+ $ref: '#/components/schemas/SpansMetricType'
+ required:
+ - id
+ - type
+ - attributes
+ type: object
+ SpansMetricCreateRequest:
+ description: The new span-based metric body.
+ properties:
+ data:
+ $ref: '#/components/schemas/SpansMetricCreateData'
+ required:
+ - data
+ type: object
+ SpansMetricFilter:
+ description: The span-based metric filter. Spans matching this filter will be
+ aggregated in this metric.
+ properties:
+ query:
+ default: '*'
+ description: The search query - following the span search syntax.
+ example: '@http.status_code:200 service:my-service'
+ type: string
+ type: object
+ SpansMetricGroupBy:
+ description: A group by rule.
+ properties:
+ path:
+ description: The path to the value the span-based metric will be aggregated
+ over.
+ example: resource_name
+ type: string
+ tag_name:
+ description: Eventual name of the tag that gets created. By default, the
+ path attribute is used as the tag name.
+ example: resource_name
+ type: string
+ required:
+ - path
+ type: object
+ SpansMetricID:
+ description: The name of the span-based metric.
+ example: my.metric
+ type: string
+ SpansMetricResponse:
+ description: The span-based metric object.
+ properties:
+ data:
+ $ref: '#/components/schemas/SpansMetricResponseData'
+ type: object
+ SpansMetricResponseAttributes:
+ description: The object describing a Datadog span-based metric.
+ properties:
+ compute:
+ $ref: '#/components/schemas/SpansMetricResponseCompute'
+ filter:
+ $ref: '#/components/schemas/SpansMetricResponseFilter'
+ group_by:
+ description: The rules for the group by.
+ items:
+ $ref: '#/components/schemas/SpansMetricResponseGroupBy'
+ type: array
+ type: object
+ SpansMetricResponseCompute:
+ description: The compute rule to compute the span-based metric.
+ properties:
+ aggregation_type:
+ $ref: '#/components/schemas/SpansMetricComputeAggregationType'
+ include_percentiles:
+ $ref: '#/components/schemas/SpansMetricComputeIncludePercentiles'
+ path:
+ description: The path to the value the span-based metric will aggregate
+ on (only used if the aggregation type is a "distribution").
+ example: '@duration'
+ type: string
+ type: object
+ SpansMetricResponseData:
+ description: The span-based metric properties.
+ properties:
+ attributes:
+ $ref: '#/components/schemas/SpansMetricResponseAttributes'
+ id:
+ $ref: '#/components/schemas/SpansMetricID'
+ type:
+ $ref: '#/components/schemas/SpansMetricType'
+ type: object
+ SpansMetricResponseFilter:
+ description: The span-based metric filter. Spans matching this filter will be
+ aggregated in this metric.
+ properties:
+ query:
+ description: The search query - following the span search syntax.
+ example: '@http.status_code:200 service:my-service'
+ type: string
+ type: object
+ SpansMetricResponseGroupBy:
+ description: A group by rule.
+ properties:
+ path:
+ description: The path to the value the span-based metric will be aggregated
+ over.
+ example: resource_name
+ type: string
+ tag_name:
+ description: Eventual name of the tag that gets created. By default, the
+ path attribute is used as the tag name.
+ example: resource_name
+ type: string
+ type: object
+ SpansMetricType:
+ default: spans_metrics
+ description: The type of resource. The value should always be spans_metrics.
+ enum:
+ - spans_metrics
+ example: spans_metrics
+ type: string
+ x-enum-varnames:
+ - SPANS_METRICS
+ SpansMetricUpdateAttributes:
+ description: The span-based metric properties that will be updated.
+ properties:
+ compute:
+ $ref: '#/components/schemas/SpansMetricUpdateCompute'
+ filter:
+ $ref: '#/components/schemas/SpansMetricFilter'
+ group_by:
+ description: The rules for the group by.
+ items:
+ $ref: '#/components/schemas/SpansMetricGroupBy'
+ type: array
+ type: object
+ SpansMetricUpdateCompute:
+ description: The compute rule to compute the span-based metric.
+ properties:
+ include_percentiles:
+ $ref: '#/components/schemas/SpansMetricComputeIncludePercentiles'
+ type: object
+ SpansMetricUpdateData:
+ description: The new span-based metric properties.
+ properties:
+ attributes:
+ $ref: '#/components/schemas/SpansMetricUpdateAttributes'
+ type:
+ $ref: '#/components/schemas/SpansMetricType'
+ required:
+ - type
+ - attributes
+ type: object
+ SpansMetricUpdateRequest:
+ description: The new span-based metric body.
+ properties:
+ data:
+ $ref: '#/components/schemas/SpansMetricUpdateData'
+ required:
+ - data
+ type: object
+ SpansMetricsResponse:
+ description: All the available span-based metric objects.
+ properties:
+ data:
+ description: A list of span-based metric objects.
+ items:
+ $ref: '#/components/schemas/SpansMetricResponseData'
+ type: array
+ type: object
TagsEventAttribute:
description: Array of tags associated with your event.
example:
@@ -14212,6 +14439,137 @@ paths:
tags:
- Key Management
x-codegen-request-body-name: body
+ /api/v2/apm/config/metrics:
+ get:
+ description: Get the list of configured span-based metrics with their definitions.
+ operationId: ListSpansMetrics
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SpansMetricsResponse'
+ description: OK
+ '403':
+ $ref: '#/components/responses/NotAuthorizedResponse'
+ '429':
+ $ref: '#/components/responses/TooManyRequestsResponse'
+ security:
+ - apiKeyAuth: []
+ appKeyAuth: []
+ - AuthZ: []
+ summary: Get all span-based metrics
+ tags:
+ - Spans Metrics
+ post:
+ description: 'Create a metric based on your ingested spans in your organization.
+
+ Returns the span-based metric object from the request body when the request
+ is successful.'
+ operationId: CreateSpansMetric
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SpansMetricCreateRequest'
+ description: The definition of the new span-based metric.
+ required: true
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SpansMetricResponse'
+ description: OK
+ '400':
+ $ref: '#/components/responses/BadRequestResponse'
+ '403':
+ $ref: '#/components/responses/NotAuthorizedResponse'
+ '409':
+ $ref: '#/components/responses/ConflictResponse'
+ '429':
+ $ref: '#/components/responses/TooManyRequestsResponse'
+ summary: Create a span-based metric
+ tags:
+ - Spans Metrics
+ x-codegen-request-body-name: body
+ /api/v2/apm/config/metrics/{metric_id}:
+ delete:
+ description: Delete a specific span-based metric from your organization.
+ operationId: DeleteSpansMetric
+ parameters:
+ - $ref: '#/components/parameters/SpansMetricIDParameter'
+ responses:
+ '200':
+ description: OK
+ '403':
+ $ref: '#/components/responses/NotAuthorizedResponse'
+ '404':
+ $ref: '#/components/responses/NotFoundResponse'
+ '429':
+ $ref: '#/components/responses/TooManyRequestsResponse'
+ summary: Delete a span-based metric
+ tags:
+ - Spans Metrics
+ get:
+ description: Get a specific span-based metric from your organization.
+ operationId: GetSpansMetric
+ parameters:
+ - $ref: '#/components/parameters/SpansMetricIDParameter'
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SpansMetricResponse'
+ description: OK
+ '403':
+ $ref: '#/components/responses/NotAuthorizedResponse'
+ '404':
+ $ref: '#/components/responses/NotFoundResponse'
+ '429':
+ $ref: '#/components/responses/TooManyRequestsResponse'
+ security:
+ - apiKeyAuth: []
+ appKeyAuth: []
+ - AuthZ: []
+ summary: Get a span-based metric
+ tags:
+ - Spans Metrics
+ patch:
+ description: 'Update a specific span-based metric from your organization.
+
+ Returns the span-based metric object from the request body when the request
+ is successful.'
+ operationId: UpdateSpansMetric
+ parameters:
+ - $ref: '#/components/parameters/SpansMetricIDParameter'
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SpansMetricUpdateRequest'
+ description: New definition of the span-based metric.
+ required: true
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SpansMetricResponse'
+ description: OK
+ '400':
+ $ref: '#/components/responses/BadRequestResponse'
+ '403':
+ $ref: '#/components/responses/NotAuthorizedResponse'
+ '404':
+ $ref: '#/components/responses/NotFoundResponse'
+ '429':
+ $ref: '#/components/responses/TooManyRequestsResponse'
+ summary: Update a span-based metric
+ tags:
+ - Spans Metrics
+ x-codegen-request-body-name: body
/api/v2/application_keys:
get:
description: List all application keys available for your org
@@ -23536,6 +23894,12 @@ tags:
externalDocs:
url: https://docs.datadoghq.com/tracing/service_catalog/
name: Service Definition
+- description: Manage configuration of [span-based metrics](https://app.datadoghq.com/apm/traces/generate-metrics)
+ for your organization.
+ externalDocs:
+ description: Find out more at
+ url: https://docs.datadoghq.com/tracing/metrics/metrics_namespace/
+ name: Spans Metrics
- description: "Datadog Synthetics uses simulated user requests and browser rendering
to help you ensure uptime,\nidentify regional issues, and track your application
performance. Datadog Synthetics tests come in\ntwo different flavors, [API tests](https://docs.datadoghq.com/synthetics/api_tests/)\nand
diff --git a/examples/v2/spans-metrics/CreateSpansMetric.java b/examples/v2/spans-metrics/CreateSpansMetric.java
new file mode 100644
index 00000000000..8163ee614fa
--- /dev/null
+++ b/examples/v2/spans-metrics/CreateSpansMetric.java
@@ -0,0 +1,55 @@
+// Create a span-based metric returns "OK" response
+
+import com.datadog.api.client.ApiClient;
+import com.datadog.api.client.ApiException;
+import com.datadog.api.client.v2.api.SpansMetricsApi;
+import com.datadog.api.client.v2.model.SpansMetricCompute;
+import com.datadog.api.client.v2.model.SpansMetricComputeAggregationType;
+import com.datadog.api.client.v2.model.SpansMetricCreateAttributes;
+import com.datadog.api.client.v2.model.SpansMetricCreateData;
+import com.datadog.api.client.v2.model.SpansMetricCreateRequest;
+import com.datadog.api.client.v2.model.SpansMetricFilter;
+import com.datadog.api.client.v2.model.SpansMetricGroupBy;
+import com.datadog.api.client.v2.model.SpansMetricResponse;
+import com.datadog.api.client.v2.model.SpansMetricType;
+import java.util.Collections;
+
+public class Example {
+ public static void main(String[] args) {
+ ApiClient defaultClient = ApiClient.getDefaultApiClient();
+ SpansMetricsApi apiInstance = new SpansMetricsApi(defaultClient);
+
+ SpansMetricCreateRequest body =
+ new SpansMetricCreateRequest()
+ .data(
+ new SpansMetricCreateData()
+ .attributes(
+ new SpansMetricCreateAttributes()
+ .compute(
+ new SpansMetricCompute()
+ .aggregationType(SpansMetricComputeAggregationType.DISTRIBUTION)
+ .includePercentiles(false)
+ .path("@duration"))
+ .filter(
+ new SpansMetricFilter()
+ .query("@http.status_code:200 service:my-service"))
+ .groupBy(
+ Collections.singletonList(
+ new SpansMetricGroupBy()
+ .path("resource_name")
+ .tagName("resource_name"))))
+ .id("ExampleCreateaspanbasedmetricreturnsOKresponse")
+ .type(SpansMetricType.SPANS_METRICS));
+
+ try {
+ SpansMetricResponse result = apiInstance.createSpansMetric(body);
+ System.out.println(result);
+ } catch (ApiException e) {
+ System.err.println("Exception when calling SpansMetricsApi#createSpansMetric");
+ System.err.println("Status code: " + e.getCode());
+ System.err.println("Reason: " + e.getResponseBody());
+ System.err.println("Response headers: " + e.getResponseHeaders());
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/examples/v2/spans-metrics/DeleteSpansMetric.java b/examples/v2/spans-metrics/DeleteSpansMetric.java
new file mode 100644
index 00000000000..1f14baf4d12
--- /dev/null
+++ b/examples/v2/spans-metrics/DeleteSpansMetric.java
@@ -0,0 +1,25 @@
+// Delete a span-based metric returns "OK" response
+
+import com.datadog.api.client.ApiClient;
+import com.datadog.api.client.ApiException;
+import com.datadog.api.client.v2.api.SpansMetricsApi;
+
+public class Example {
+ public static void main(String[] args) {
+ ApiClient defaultClient = ApiClient.getDefaultApiClient();
+ SpansMetricsApi apiInstance = new SpansMetricsApi(defaultClient);
+
+ // there is a valid "spans_metric" in the system
+ String SPANS_METRIC_DATA_ID = System.getenv("SPANS_METRIC_DATA_ID");
+
+ try {
+ apiInstance.deleteSpansMetric(SPANS_METRIC_DATA_ID);
+ } catch (ApiException e) {
+ System.err.println("Exception when calling SpansMetricsApi#deleteSpansMetric");
+ System.err.println("Status code: " + e.getCode());
+ System.err.println("Reason: " + e.getResponseBody());
+ System.err.println("Response headers: " + e.getResponseHeaders());
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/examples/v2/spans-metrics/GetSpansMetric.java b/examples/v2/spans-metrics/GetSpansMetric.java
new file mode 100644
index 00000000000..9081b7dc34e
--- /dev/null
+++ b/examples/v2/spans-metrics/GetSpansMetric.java
@@ -0,0 +1,27 @@
+// Get a span-based metric returns "OK" response
+
+import com.datadog.api.client.ApiClient;
+import com.datadog.api.client.ApiException;
+import com.datadog.api.client.v2.api.SpansMetricsApi;
+import com.datadog.api.client.v2.model.SpansMetricResponse;
+
+public class Example {
+ public static void main(String[] args) {
+ ApiClient defaultClient = ApiClient.getDefaultApiClient();
+ SpansMetricsApi apiInstance = new SpansMetricsApi(defaultClient);
+
+ // there is a valid "spans_metric" in the system
+ String SPANS_METRIC_DATA_ID = System.getenv("SPANS_METRIC_DATA_ID");
+
+ try {
+ SpansMetricResponse result = apiInstance.getSpansMetric(SPANS_METRIC_DATA_ID);
+ System.out.println(result);
+ } catch (ApiException e) {
+ System.err.println("Exception when calling SpansMetricsApi#getSpansMetric");
+ System.err.println("Status code: " + e.getCode());
+ System.err.println("Reason: " + e.getResponseBody());
+ System.err.println("Response headers: " + e.getResponseHeaders());
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/examples/v2/spans-metrics/ListSpansMetrics.java b/examples/v2/spans-metrics/ListSpansMetrics.java
new file mode 100644
index 00000000000..2b25b0b270d
--- /dev/null
+++ b/examples/v2/spans-metrics/ListSpansMetrics.java
@@ -0,0 +1,24 @@
+// Get all span-based metrics returns "OK" response
+
+import com.datadog.api.client.ApiClient;
+import com.datadog.api.client.ApiException;
+import com.datadog.api.client.v2.api.SpansMetricsApi;
+import com.datadog.api.client.v2.model.SpansMetricsResponse;
+
+public class Example {
+ public static void main(String[] args) {
+ ApiClient defaultClient = ApiClient.getDefaultApiClient();
+ SpansMetricsApi apiInstance = new SpansMetricsApi(defaultClient);
+
+ try {
+ SpansMetricsResponse result = apiInstance.listSpansMetrics();
+ System.out.println(result);
+ } catch (ApiException e) {
+ System.err.println("Exception when calling SpansMetricsApi#listSpansMetrics");
+ System.err.println("Status code: " + e.getCode());
+ System.err.println("Reason: " + e.getResponseBody());
+ System.err.println("Response headers: " + e.getResponseHeaders());
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/examples/v2/spans-metrics/UpdateSpansMetric.java b/examples/v2/spans-metrics/UpdateSpansMetric.java
new file mode 100644
index 00000000000..60d9763e26f
--- /dev/null
+++ b/examples/v2/spans-metrics/UpdateSpansMetric.java
@@ -0,0 +1,54 @@
+// Update a span-based metric returns "OK" response
+
+import com.datadog.api.client.ApiClient;
+import com.datadog.api.client.ApiException;
+import com.datadog.api.client.v2.api.SpansMetricsApi;
+import com.datadog.api.client.v2.model.SpansMetricFilter;
+import com.datadog.api.client.v2.model.SpansMetricGroupBy;
+import com.datadog.api.client.v2.model.SpansMetricResponse;
+import com.datadog.api.client.v2.model.SpansMetricType;
+import com.datadog.api.client.v2.model.SpansMetricUpdateAttributes;
+import com.datadog.api.client.v2.model.SpansMetricUpdateCompute;
+import com.datadog.api.client.v2.model.SpansMetricUpdateData;
+import com.datadog.api.client.v2.model.SpansMetricUpdateRequest;
+import java.util.Collections;
+
+public class Example {
+ public static void main(String[] args) {
+ ApiClient defaultClient = ApiClient.getDefaultApiClient();
+ SpansMetricsApi apiInstance = new SpansMetricsApi(defaultClient);
+
+ // there is a valid "spans_metric" in the system
+ String SPANS_METRIC_DATA_ATTRIBUTES_FILTER_QUERY =
+ System.getenv("SPANS_METRIC_DATA_ATTRIBUTES_FILTER_QUERY");
+ String SPANS_METRIC_DATA_ID = System.getenv("SPANS_METRIC_DATA_ID");
+
+ SpansMetricUpdateRequest body =
+ new SpansMetricUpdateRequest()
+ .data(
+ new SpansMetricUpdateData()
+ .attributes(
+ new SpansMetricUpdateAttributes()
+ .compute(new SpansMetricUpdateCompute().includePercentiles(false))
+ .filter(
+ new SpansMetricFilter()
+ .query("@http.status_code:200 service:my-service-updated"))
+ .groupBy(
+ Collections.singletonList(
+ new SpansMetricGroupBy()
+ .path("resource_name")
+ .tagName("resource_name"))))
+ .type(SpansMetricType.SPANS_METRICS));
+
+ try {
+ SpansMetricResponse result = apiInstance.updateSpansMetric(SPANS_METRIC_DATA_ID, body);
+ System.out.println(result);
+ } catch (ApiException e) {
+ System.err.println("Exception when calling SpansMetricsApi#updateSpansMetric");
+ System.err.println("Status code: " + e.getCode());
+ System.err.println("Reason: " + e.getResponseBody());
+ System.err.println("Response headers: " + e.getResponseHeaders());
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/src/main/java/com/datadog/api/client/v2/api/SpansMetricsApi.java b/src/main/java/com/datadog/api/client/v2/api/SpansMetricsApi.java
new file mode 100644
index 00000000000..08d668b0f0c
--- /dev/null
+++ b/src/main/java/com/datadog/api/client/v2/api/SpansMetricsApi.java
@@ -0,0 +1,716 @@
+package com.datadog.api.client.v2.api;
+
+import com.datadog.api.client.ApiClient;
+import com.datadog.api.client.ApiException;
+import com.datadog.api.client.ApiResponse;
+import com.datadog.api.client.Pair;
+import com.datadog.api.client.v2.model.SpansMetricCreateRequest;
+import com.datadog.api.client.v2.model.SpansMetricResponse;
+import com.datadog.api.client.v2.model.SpansMetricUpdateRequest;
+import com.datadog.api.client.v2.model.SpansMetricsResponse;
+import jakarta.ws.rs.client.Invocation;
+import jakarta.ws.rs.core.GenericType;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.CompletableFuture;
+
+@jakarta.annotation.Generated(
+ value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
+public class SpansMetricsApi {
+ private ApiClient apiClient;
+
+ public SpansMetricsApi() {
+ this(ApiClient.getDefaultApiClient());
+ }
+
+ public SpansMetricsApi(ApiClient apiClient) {
+ this.apiClient = apiClient;
+ }
+
+ /**
+ * Get the API client.
+ *
+ * @return API client
+ */
+ public ApiClient getApiClient() {
+ return apiClient;
+ }
+
+ /**
+ * Set the API client.
+ *
+ * @param apiClient an instance of API client
+ */
+ public void setApiClient(ApiClient apiClient) {
+ this.apiClient = apiClient;
+ }
+
+ /**
+ * Create a span-based metric.
+ *
+ *
See {@link #createSpansMetricWithHttpInfo}.
+ *
+ * @param body The definition of the new span-based metric. (required)
+ * @return SpansMetricResponse
+ * @throws ApiException if fails to make API call
+ */
+ public SpansMetricResponse createSpansMetric(SpansMetricCreateRequest body) throws ApiException {
+ return createSpansMetricWithHttpInfo(body).getData();
+ }
+
+ /**
+ * Create a span-based metric.
+ *
+ *
See {@link #createSpansMetricWithHttpInfoAsync}.
+ *
+ * @param body The definition of the new span-based metric. (required)
+ * @return CompletableFuture<SpansMetricResponse>
+ */
+ public CompletableFuture createSpansMetricAsync(
+ SpansMetricCreateRequest body) {
+ return createSpansMetricWithHttpInfoAsync(body)
+ .thenApply(
+ response -> {
+ return response.getData();
+ });
+ }
+
+ /**
+ * Create a metric based on your ingested spans in your organization. Returns the span-based
+ * metric object from the request body when the request is successful.
+ *
+ * @param body The definition of the new span-based metric. (required)
+ * @return ApiResponse<SpansMetricResponse>
+ * @throws ApiException if fails to make API call
+ * @http.response.details
+ *
+ * Response details
+ * | Status Code | Description | Response Headers |
+ * | 200 | OK | - |
+ * | 400 | Bad Request | - |
+ * | 403 | Not Authorized | - |
+ * | 409 | Conflict | - |
+ * | 429 | Too many requests | - |
+ *
+ */
+ public ApiResponse createSpansMetricWithHttpInfo(
+ SpansMetricCreateRequest body) throws ApiException {
+ Object localVarPostBody = body;
+
+ // verify the required parameter 'body' is set
+ if (body == null) {
+ throw new ApiException(
+ 400, "Missing the required parameter 'body' when calling createSpansMetric");
+ }
+ // create path and map variables
+ String localVarPath = "/api/v2/apm/config/metrics";
+
+ Map localVarHeaderParams = new HashMap();
+
+ Invocation.Builder builder =
+ apiClient.createBuilder(
+ "v2.SpansMetricsApi.createSpansMetric",
+ localVarPath,
+ new ArrayList(),
+ localVarHeaderParams,
+ new HashMap(),
+ new String[] {"application/json"},
+ new String[] {"apiKeyAuth", "appKeyAuth"});
+ return apiClient.invokeAPI(
+ "POST",
+ builder,
+ localVarHeaderParams,
+ new String[] {"application/json"},
+ localVarPostBody,
+ new HashMap(),
+ false,
+ new GenericType() {});
+ }
+
+ /**
+ * Create a span-based metric.
+ *
+ * See {@link #createSpansMetricWithHttpInfo}.
+ *
+ * @param body The definition of the new span-based metric. (required)
+ * @return CompletableFuture<ApiResponse<SpansMetricResponse>>
+ */
+ public CompletableFuture> createSpansMetricWithHttpInfoAsync(
+ SpansMetricCreateRequest body) {
+ Object localVarPostBody = body;
+
+ // verify the required parameter 'body' is set
+ if (body == null) {
+ CompletableFuture> result = new CompletableFuture<>();
+ result.completeExceptionally(
+ new ApiException(
+ 400, "Missing the required parameter 'body' when calling createSpansMetric"));
+ return result;
+ }
+ // create path and map variables
+ String localVarPath = "/api/v2/apm/config/metrics";
+
+ Map localVarHeaderParams = new HashMap();
+
+ Invocation.Builder builder;
+ try {
+ builder =
+ apiClient.createBuilder(
+ "v2.SpansMetricsApi.createSpansMetric",
+ localVarPath,
+ new ArrayList(),
+ localVarHeaderParams,
+ new HashMap(),
+ new String[] {"application/json"},
+ new String[] {"apiKeyAuth", "appKeyAuth"});
+ } catch (ApiException ex) {
+ CompletableFuture> result = new CompletableFuture<>();
+ result.completeExceptionally(ex);
+ return result;
+ }
+ return apiClient.invokeAPIAsync(
+ "POST",
+ builder,
+ localVarHeaderParams,
+ new String[] {"application/json"},
+ localVarPostBody,
+ new HashMap(),
+ false,
+ new GenericType() {});
+ }
+
+ /**
+ * Delete a span-based metric.
+ *
+ * See {@link #deleteSpansMetricWithHttpInfo}.
+ *
+ * @param metricId The name of the span-based metric. (required)
+ * @throws ApiException if fails to make API call
+ */
+ public void deleteSpansMetric(String metricId) throws ApiException {
+ deleteSpansMetricWithHttpInfo(metricId);
+ }
+
+ /**
+ * Delete a span-based metric.
+ *
+ *
See {@link #deleteSpansMetricWithHttpInfoAsync}.
+ *
+ * @param metricId The name of the span-based metric. (required)
+ * @return CompletableFuture
+ */
+ public CompletableFuture deleteSpansMetricAsync(String metricId) {
+ return deleteSpansMetricWithHttpInfoAsync(metricId)
+ .thenApply(
+ response -> {
+ return response.getData();
+ });
+ }
+
+ /**
+ * Delete a specific span-based metric from your organization.
+ *
+ * @param metricId The name of the span-based metric. (required)
+ * @return ApiResponse<Void>
+ * @throws ApiException if fails to make API call
+ * @http.response.details
+ *
+ * Response details
+ * | Status Code | Description | Response Headers |
+ * | 200 | OK | - |
+ * | 403 | Not Authorized | - |
+ * | 404 | Not Found | - |
+ * | 429 | Too many requests | - |
+ *
+ */
+ public ApiResponse deleteSpansMetricWithHttpInfo(String metricId) throws ApiException {
+ Object localVarPostBody = null;
+
+ // verify the required parameter 'metricId' is set
+ if (metricId == null) {
+ throw new ApiException(
+ 400, "Missing the required parameter 'metricId' when calling deleteSpansMetric");
+ }
+ // create path and map variables
+ String localVarPath =
+ "/api/v2/apm/config/metrics/{metric_id}"
+ .replaceAll("\\{" + "metric_id" + "\\}", apiClient.escapeString(metricId.toString()));
+
+ Map localVarHeaderParams = new HashMap();
+
+ Invocation.Builder builder =
+ apiClient.createBuilder(
+ "v2.SpansMetricsApi.deleteSpansMetric",
+ localVarPath,
+ new ArrayList(),
+ localVarHeaderParams,
+ new HashMap(),
+ new String[] {"*/*"},
+ new String[] {"apiKeyAuth", "appKeyAuth"});
+ return apiClient.invokeAPI(
+ "DELETE",
+ builder,
+ localVarHeaderParams,
+ new String[] {},
+ localVarPostBody,
+ new HashMap(),
+ false,
+ null);
+ }
+
+ /**
+ * Delete a span-based metric.
+ *
+ * See {@link #deleteSpansMetricWithHttpInfo}.
+ *
+ * @param metricId The name of the span-based metric. (required)
+ * @return CompletableFuture<ApiResponse<Void>>
+ */
+ public CompletableFuture> deleteSpansMetricWithHttpInfoAsync(String metricId) {
+ Object localVarPostBody = null;
+
+ // verify the required parameter 'metricId' is set
+ if (metricId == null) {
+ CompletableFuture> result = new CompletableFuture<>();
+ result.completeExceptionally(
+ new ApiException(
+ 400, "Missing the required parameter 'metricId' when calling deleteSpansMetric"));
+ return result;
+ }
+ // create path and map variables
+ String localVarPath =
+ "/api/v2/apm/config/metrics/{metric_id}"
+ .replaceAll("\\{" + "metric_id" + "\\}", apiClient.escapeString(metricId.toString()));
+
+ Map localVarHeaderParams = new HashMap();
+
+ Invocation.Builder builder;
+ try {
+ builder =
+ apiClient.createBuilder(
+ "v2.SpansMetricsApi.deleteSpansMetric",
+ localVarPath,
+ new ArrayList(),
+ localVarHeaderParams,
+ new HashMap(),
+ new String[] {"*/*"},
+ new String[] {"apiKeyAuth", "appKeyAuth"});
+ } catch (ApiException ex) {
+ CompletableFuture> result = new CompletableFuture<>();
+ result.completeExceptionally(ex);
+ return result;
+ }
+ return apiClient.invokeAPIAsync(
+ "DELETE",
+ builder,
+ localVarHeaderParams,
+ new String[] {},
+ localVarPostBody,
+ new HashMap(),
+ false,
+ null);
+ }
+
+ /**
+ * Get a span-based metric.
+ *
+ * See {@link #getSpansMetricWithHttpInfo}.
+ *
+ * @param metricId The name of the span-based metric. (required)
+ * @return SpansMetricResponse
+ * @throws ApiException if fails to make API call
+ */
+ public SpansMetricResponse getSpansMetric(String metricId) throws ApiException {
+ return getSpansMetricWithHttpInfo(metricId).getData();
+ }
+
+ /**
+ * Get a span-based metric.
+ *
+ *
See {@link #getSpansMetricWithHttpInfoAsync}.
+ *
+ * @param metricId The name of the span-based metric. (required)
+ * @return CompletableFuture<SpansMetricResponse>
+ */
+ public CompletableFuture getSpansMetricAsync(String metricId) {
+ return getSpansMetricWithHttpInfoAsync(metricId)
+ .thenApply(
+ response -> {
+ return response.getData();
+ });
+ }
+
+ /**
+ * Get a specific span-based metric from your organization.
+ *
+ * @param metricId The name of the span-based metric. (required)
+ * @return ApiResponse<SpansMetricResponse>
+ * @throws ApiException if fails to make API call
+ * @http.response.details
+ *
+ * Response details
+ * | Status Code | Description | Response Headers |
+ * | 200 | OK | - |
+ * | 403 | Not Authorized | - |
+ * | 404 | Not Found | - |
+ * | 429 | Too many requests | - |
+ *
+ */
+ public ApiResponse getSpansMetricWithHttpInfo(String metricId)
+ throws ApiException {
+ Object localVarPostBody = null;
+
+ // verify the required parameter 'metricId' is set
+ if (metricId == null) {
+ throw new ApiException(
+ 400, "Missing the required parameter 'metricId' when calling getSpansMetric");
+ }
+ // create path and map variables
+ String localVarPath =
+ "/api/v2/apm/config/metrics/{metric_id}"
+ .replaceAll("\\{" + "metric_id" + "\\}", apiClient.escapeString(metricId.toString()));
+
+ Map localVarHeaderParams = new HashMap();
+
+ Invocation.Builder builder =
+ apiClient.createBuilder(
+ "v2.SpansMetricsApi.getSpansMetric",
+ localVarPath,
+ new ArrayList(),
+ localVarHeaderParams,
+ new HashMap(),
+ new String[] {"application/json"},
+ new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"});
+ return apiClient.invokeAPI(
+ "GET",
+ builder,
+ localVarHeaderParams,
+ new String[] {},
+ localVarPostBody,
+ new HashMap(),
+ false,
+ new GenericType() {});
+ }
+
+ /**
+ * Get a span-based metric.
+ *
+ * See {@link #getSpansMetricWithHttpInfo}.
+ *
+ * @param metricId The name of the span-based metric. (required)
+ * @return CompletableFuture<ApiResponse<SpansMetricResponse>>
+ */
+ public CompletableFuture> getSpansMetricWithHttpInfoAsync(
+ String metricId) {
+ Object localVarPostBody = null;
+
+ // verify the required parameter 'metricId' is set
+ if (metricId == null) {
+ CompletableFuture> result = new CompletableFuture<>();
+ result.completeExceptionally(
+ new ApiException(
+ 400, "Missing the required parameter 'metricId' when calling getSpansMetric"));
+ return result;
+ }
+ // create path and map variables
+ String localVarPath =
+ "/api/v2/apm/config/metrics/{metric_id}"
+ .replaceAll("\\{" + "metric_id" + "\\}", apiClient.escapeString(metricId.toString()));
+
+ Map localVarHeaderParams = new HashMap();
+
+ Invocation.Builder builder;
+ try {
+ builder =
+ apiClient.createBuilder(
+ "v2.SpansMetricsApi.getSpansMetric",
+ localVarPath,
+ new ArrayList(),
+ localVarHeaderParams,
+ new HashMap(),
+ new String[] {"application/json"},
+ new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"});
+ } catch (ApiException ex) {
+ CompletableFuture> result = new CompletableFuture<>();
+ result.completeExceptionally(ex);
+ return result;
+ }
+ return apiClient.invokeAPIAsync(
+ "GET",
+ builder,
+ localVarHeaderParams,
+ new String[] {},
+ localVarPostBody,
+ new HashMap(),
+ false,
+ new GenericType() {});
+ }
+
+ /**
+ * Get all span-based metrics.
+ *
+ * See {@link #listSpansMetricsWithHttpInfo}.
+ *
+ * @return SpansMetricsResponse
+ * @throws ApiException if fails to make API call
+ */
+ public SpansMetricsResponse listSpansMetrics() throws ApiException {
+ return listSpansMetricsWithHttpInfo().getData();
+ }
+
+ /**
+ * Get all span-based metrics.
+ *
+ *
See {@link #listSpansMetricsWithHttpInfoAsync}.
+ *
+ * @return CompletableFuture<SpansMetricsResponse>
+ */
+ public CompletableFuture listSpansMetricsAsync() {
+ return listSpansMetricsWithHttpInfoAsync()
+ .thenApply(
+ response -> {
+ return response.getData();
+ });
+ }
+
+ /**
+ * Get the list of configured span-based metrics with their definitions.
+ *
+ * @return ApiResponse<SpansMetricsResponse>
+ * @throws ApiException if fails to make API call
+ * @http.response.details
+ *
+ * Response details
+ * | Status Code | Description | Response Headers |
+ * | 200 | OK | - |
+ * | 403 | Not Authorized | - |
+ * | 429 | Too many requests | - |
+ *
+ */
+ public ApiResponse listSpansMetricsWithHttpInfo() throws ApiException {
+ Object localVarPostBody = null;
+ // create path and map variables
+ String localVarPath = "/api/v2/apm/config/metrics";
+
+ Map localVarHeaderParams = new HashMap();
+
+ Invocation.Builder builder =
+ apiClient.createBuilder(
+ "v2.SpansMetricsApi.listSpansMetrics",
+ localVarPath,
+ new ArrayList(),
+ localVarHeaderParams,
+ new HashMap(),
+ new String[] {"application/json"},
+ new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"});
+ return apiClient.invokeAPI(
+ "GET",
+ builder,
+ localVarHeaderParams,
+ new String[] {},
+ localVarPostBody,
+ new HashMap(),
+ false,
+ new GenericType() {});
+ }
+
+ /**
+ * Get all span-based metrics.
+ *
+ * See {@link #listSpansMetricsWithHttpInfo}.
+ *
+ * @return CompletableFuture<ApiResponse<SpansMetricsResponse>>
+ */
+ public CompletableFuture> listSpansMetricsWithHttpInfoAsync() {
+ Object localVarPostBody = null;
+ // create path and map variables
+ String localVarPath = "/api/v2/apm/config/metrics";
+
+ Map localVarHeaderParams = new HashMap();
+
+ Invocation.Builder builder;
+ try {
+ builder =
+ apiClient.createBuilder(
+ "v2.SpansMetricsApi.listSpansMetrics",
+ localVarPath,
+ new ArrayList(),
+ localVarHeaderParams,
+ new HashMap(),
+ new String[] {"application/json"},
+ new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"});
+ } catch (ApiException ex) {
+ CompletableFuture> result = new CompletableFuture<>();
+ result.completeExceptionally(ex);
+ return result;
+ }
+ return apiClient.invokeAPIAsync(
+ "GET",
+ builder,
+ localVarHeaderParams,
+ new String[] {},
+ localVarPostBody,
+ new HashMap(),
+ false,
+ new GenericType() {});
+ }
+
+ /**
+ * Update a span-based metric.
+ *
+ * See {@link #updateSpansMetricWithHttpInfo}.
+ *
+ * @param metricId The name of the span-based metric. (required)
+ * @param body New definition of the span-based metric. (required)
+ * @return SpansMetricResponse
+ * @throws ApiException if fails to make API call
+ */
+ public SpansMetricResponse updateSpansMetric(String metricId, SpansMetricUpdateRequest body)
+ throws ApiException {
+ return updateSpansMetricWithHttpInfo(metricId, body).getData();
+ }
+
+ /**
+ * Update a span-based metric.
+ *
+ *
See {@link #updateSpansMetricWithHttpInfoAsync}.
+ *
+ * @param metricId The name of the span-based metric. (required)
+ * @param body New definition of the span-based metric. (required)
+ * @return CompletableFuture<SpansMetricResponse>
+ */
+ public CompletableFuture updateSpansMetricAsync(
+ String metricId, SpansMetricUpdateRequest body) {
+ return updateSpansMetricWithHttpInfoAsync(metricId, body)
+ .thenApply(
+ response -> {
+ return response.getData();
+ });
+ }
+
+ /**
+ * Update a specific span-based metric from your organization. Returns the span-based metric
+ * object from the request body when the request is successful.
+ *
+ * @param metricId The name of the span-based metric. (required)
+ * @param body New definition of the span-based metric. (required)
+ * @return ApiResponse<SpansMetricResponse>
+ * @throws ApiException if fails to make API call
+ * @http.response.details
+ *
+ * Response details
+ * | Status Code | Description | Response Headers |
+ * | 200 | OK | - |
+ * | 400 | Bad Request | - |
+ * | 403 | Not Authorized | - |
+ * | 404 | Not Found | - |
+ * | 429 | Too many requests | - |
+ *
+ */
+ public ApiResponse updateSpansMetricWithHttpInfo(
+ String metricId, SpansMetricUpdateRequest body) throws ApiException {
+ Object localVarPostBody = body;
+
+ // verify the required parameter 'metricId' is set
+ if (metricId == null) {
+ throw new ApiException(
+ 400, "Missing the required parameter 'metricId' when calling updateSpansMetric");
+ }
+
+ // verify the required parameter 'body' is set
+ if (body == null) {
+ throw new ApiException(
+ 400, "Missing the required parameter 'body' when calling updateSpansMetric");
+ }
+ // create path and map variables
+ String localVarPath =
+ "/api/v2/apm/config/metrics/{metric_id}"
+ .replaceAll("\\{" + "metric_id" + "\\}", apiClient.escapeString(metricId.toString()));
+
+ Map localVarHeaderParams = new HashMap();
+
+ Invocation.Builder builder =
+ apiClient.createBuilder(
+ "v2.SpansMetricsApi.updateSpansMetric",
+ localVarPath,
+ new ArrayList(),
+ localVarHeaderParams,
+ new HashMap(),
+ new String[] {"application/json"},
+ new String[] {"apiKeyAuth", "appKeyAuth"});
+ return apiClient.invokeAPI(
+ "PATCH",
+ builder,
+ localVarHeaderParams,
+ new String[] {"application/json"},
+ localVarPostBody,
+ new HashMap(),
+ false,
+ new GenericType() {});
+ }
+
+ /**
+ * Update a span-based metric.
+ *
+ * See {@link #updateSpansMetricWithHttpInfo}.
+ *
+ * @param metricId The name of the span-based metric. (required)
+ * @param body New definition of the span-based metric. (required)
+ * @return CompletableFuture<ApiResponse<SpansMetricResponse>>
+ */
+ public CompletableFuture> updateSpansMetricWithHttpInfoAsync(
+ String metricId, SpansMetricUpdateRequest body) {
+ Object localVarPostBody = body;
+
+ // verify the required parameter 'metricId' is set
+ if (metricId == null) {
+ CompletableFuture> result = new CompletableFuture<>();
+ result.completeExceptionally(
+ new ApiException(
+ 400, "Missing the required parameter 'metricId' when calling updateSpansMetric"));
+ return result;
+ }
+
+ // verify the required parameter 'body' is set
+ if (body == null) {
+ CompletableFuture> result = new CompletableFuture<>();
+ result.completeExceptionally(
+ new ApiException(
+ 400, "Missing the required parameter 'body' when calling updateSpansMetric"));
+ return result;
+ }
+ // create path and map variables
+ String localVarPath =
+ "/api/v2/apm/config/metrics/{metric_id}"
+ .replaceAll("\\{" + "metric_id" + "\\}", apiClient.escapeString(metricId.toString()));
+
+ Map localVarHeaderParams = new HashMap();
+
+ Invocation.Builder builder;
+ try {
+ builder =
+ apiClient.createBuilder(
+ "v2.SpansMetricsApi.updateSpansMetric",
+ localVarPath,
+ new ArrayList(),
+ localVarHeaderParams,
+ new HashMap(),
+ new String[] {"application/json"},
+ new String[] {"apiKeyAuth", "appKeyAuth"});
+ } catch (ApiException ex) {
+ CompletableFuture> result = new CompletableFuture<>();
+ result.completeExceptionally(ex);
+ return result;
+ }
+ return apiClient.invokeAPIAsync(
+ "PATCH",
+ builder,
+ localVarHeaderParams,
+ new String[] {"application/json"},
+ localVarPostBody,
+ new HashMap(),
+ false,
+ new GenericType() {});
+ }
+}
diff --git a/src/main/java/com/datadog/api/client/v2/model/SpansMetricCompute.java b/src/main/java/com/datadog/api/client/v2/model/SpansMetricCompute.java
new file mode 100644
index 00000000000..38016478257
--- /dev/null
+++ b/src/main/java/com/datadog/api/client/v2/model/SpansMetricCompute.java
@@ -0,0 +1,153 @@
+/*
+ * 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.
+ */
+
+package com.datadog.api.client.v2.model;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import java.util.Objects;
+
+/** The compute rule to compute the span-based metric. */
+@JsonPropertyOrder({
+ SpansMetricCompute.JSON_PROPERTY_AGGREGATION_TYPE,
+ SpansMetricCompute.JSON_PROPERTY_INCLUDE_PERCENTILES,
+ SpansMetricCompute.JSON_PROPERTY_PATH
+})
+@jakarta.annotation.Generated(
+ value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
+public class SpansMetricCompute {
+ @JsonIgnore public boolean unparsed = false;
+ public static final String JSON_PROPERTY_AGGREGATION_TYPE = "aggregation_type";
+ private SpansMetricComputeAggregationType aggregationType;
+
+ public static final String JSON_PROPERTY_INCLUDE_PERCENTILES = "include_percentiles";
+ private Boolean includePercentiles;
+
+ public static final String JSON_PROPERTY_PATH = "path";
+ private String path;
+
+ public SpansMetricCompute() {}
+
+ @JsonCreator
+ public SpansMetricCompute(
+ @JsonProperty(required = true, value = JSON_PROPERTY_AGGREGATION_TYPE)
+ SpansMetricComputeAggregationType aggregationType) {
+ this.aggregationType = aggregationType;
+ this.unparsed |= !aggregationType.isValid();
+ }
+
+ public SpansMetricCompute aggregationType(SpansMetricComputeAggregationType aggregationType) {
+ this.aggregationType = aggregationType;
+ this.unparsed |= !aggregationType.isValid();
+ return this;
+ }
+
+ /**
+ * The type of aggregation to use.
+ *
+ * @return aggregationType
+ */
+ @JsonProperty(JSON_PROPERTY_AGGREGATION_TYPE)
+ @JsonInclude(value = JsonInclude.Include.ALWAYS)
+ public SpansMetricComputeAggregationType getAggregationType() {
+ return aggregationType;
+ }
+
+ public void setAggregationType(SpansMetricComputeAggregationType aggregationType) {
+ if (!aggregationType.isValid()) {
+ this.unparsed = true;
+ }
+ this.aggregationType = aggregationType;
+ }
+
+ public SpansMetricCompute includePercentiles(Boolean includePercentiles) {
+ this.includePercentiles = includePercentiles;
+ return this;
+ }
+
+ /**
+ * Toggle to include or exclude percentile aggregations for distribution metrics. Only present
+ * when the aggregation_type is distribution.
+ *
+ * @return includePercentiles
+ */
+ @jakarta.annotation.Nullable
+ @JsonProperty(JSON_PROPERTY_INCLUDE_PERCENTILES)
+ @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
+ public Boolean getIncludePercentiles() {
+ return includePercentiles;
+ }
+
+ public void setIncludePercentiles(Boolean includePercentiles) {
+ this.includePercentiles = includePercentiles;
+ }
+
+ public SpansMetricCompute path(String path) {
+ this.path = path;
+ return this;
+ }
+
+ /**
+ * The path to the value the span-based metric will aggregate on (only used if the aggregation
+ * type is a "distribution").
+ *
+ * @return path
+ */
+ @jakarta.annotation.Nullable
+ @JsonProperty(JSON_PROPERTY_PATH)
+ @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ /** Return true if this SpansMetricCompute object is equal to o. */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SpansMetricCompute spansMetricCompute = (SpansMetricCompute) o;
+ return Objects.equals(this.aggregationType, spansMetricCompute.aggregationType)
+ && Objects.equals(this.includePercentiles, spansMetricCompute.includePercentiles)
+ && Objects.equals(this.path, spansMetricCompute.path);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(aggregationType, includePercentiles, path);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class SpansMetricCompute {\n");
+ sb.append(" aggregationType: ").append(toIndentedString(aggregationType)).append("\n");
+ sb.append(" includePercentiles: ").append(toIndentedString(includePercentiles)).append("\n");
+ sb.append(" path: ").append(toIndentedString(path)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+}
diff --git a/src/main/java/com/datadog/api/client/v2/model/SpansMetricComputeAggregationType.java b/src/main/java/com/datadog/api/client/v2/model/SpansMetricComputeAggregationType.java
new file mode 100644
index 00000000000..89e73aff9dd
--- /dev/null
+++ b/src/main/java/com/datadog/api/client/v2/model/SpansMetricComputeAggregationType.java
@@ -0,0 +1,98 @@
+/*
+ * 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.
+ */
+
+package com.datadog.api.client.v2.model;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonValue;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.StdSerializer;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Objects;
+import java.util.Set;
+
+/** The type of aggregation to use. */
+@JsonSerialize(
+ using = SpansMetricComputeAggregationType.SpansMetricComputeAggregationTypeSerializer.class)
+public class SpansMetricComputeAggregationType {
+
+ public static final SpansMetricComputeAggregationType COUNT =
+ new SpansMetricComputeAggregationType("count");
+ public static final SpansMetricComputeAggregationType DISTRIBUTION =
+ new SpansMetricComputeAggregationType("distribution");
+
+ private static final Set allowedValues =
+ new HashSet(Arrays.asList("count", "distribution"));
+
+ private String value;
+
+ public boolean isValid() {
+ return allowedValues.contains(this.value);
+ }
+
+ SpansMetricComputeAggregationType(String value) {
+ this.value = value;
+ }
+
+ public static class SpansMetricComputeAggregationTypeSerializer
+ extends StdSerializer {
+ public SpansMetricComputeAggregationTypeSerializer(Class t) {
+ super(t);
+ }
+
+ public SpansMetricComputeAggregationTypeSerializer() {
+ this(null);
+ }
+
+ @Override
+ public void serialize(
+ SpansMetricComputeAggregationType value, JsonGenerator jgen, SerializerProvider provider)
+ throws IOException, JsonProcessingException {
+ jgen.writeObject(value.value);
+ }
+ }
+
+ @JsonValue
+ public String getValue() {
+ return this.value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ /** Return true if this SpansMetricComputeAggregationType object is equal to o. */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ return this.value.equals(((SpansMetricComputeAggregationType) o).value);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(value);
+ }
+
+ @Override
+ public String toString() {
+ return String.valueOf(value);
+ }
+
+ @JsonCreator
+ public static SpansMetricComputeAggregationType fromValue(String value) {
+ return new SpansMetricComputeAggregationType(value);
+ }
+}
diff --git a/src/main/java/com/datadog/api/client/v2/model/SpansMetricCreateAttributes.java b/src/main/java/com/datadog/api/client/v2/model/SpansMetricCreateAttributes.java
new file mode 100644
index 00000000000..fd23398c535
--- /dev/null
+++ b/src/main/java/com/datadog/api/client/v2/model/SpansMetricCreateAttributes.java
@@ -0,0 +1,162 @@
+/*
+ * 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.
+ */
+
+package com.datadog.api.client.v2.model;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+/** The object describing the Datadog span-based metric to create. */
+@JsonPropertyOrder({
+ SpansMetricCreateAttributes.JSON_PROPERTY_COMPUTE,
+ SpansMetricCreateAttributes.JSON_PROPERTY_FILTER,
+ SpansMetricCreateAttributes.JSON_PROPERTY_GROUP_BY
+})
+@jakarta.annotation.Generated(
+ value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
+public class SpansMetricCreateAttributes {
+ @JsonIgnore public boolean unparsed = false;
+ public static final String JSON_PROPERTY_COMPUTE = "compute";
+ private SpansMetricCompute compute;
+
+ public static final String JSON_PROPERTY_FILTER = "filter";
+ private SpansMetricFilter filter;
+
+ public static final String JSON_PROPERTY_GROUP_BY = "group_by";
+ private List groupBy = null;
+
+ public SpansMetricCreateAttributes() {}
+
+ @JsonCreator
+ public SpansMetricCreateAttributes(
+ @JsonProperty(required = true, value = JSON_PROPERTY_COMPUTE) SpansMetricCompute compute) {
+ this.compute = compute;
+ this.unparsed |= compute.unparsed;
+ }
+
+ public SpansMetricCreateAttributes compute(SpansMetricCompute compute) {
+ this.compute = compute;
+ this.unparsed |= compute.unparsed;
+ return this;
+ }
+
+ /**
+ * The compute rule to compute the span-based metric.
+ *
+ * @return compute
+ */
+ @JsonProperty(JSON_PROPERTY_COMPUTE)
+ @JsonInclude(value = JsonInclude.Include.ALWAYS)
+ public SpansMetricCompute getCompute() {
+ return compute;
+ }
+
+ public void setCompute(SpansMetricCompute compute) {
+ this.compute = compute;
+ }
+
+ public SpansMetricCreateAttributes filter(SpansMetricFilter filter) {
+ this.filter = filter;
+ this.unparsed |= filter.unparsed;
+ return this;
+ }
+
+ /**
+ * The span-based metric filter. Spans matching this filter will be aggregated in this metric.
+ *
+ * @return filter
+ */
+ @jakarta.annotation.Nullable
+ @JsonProperty(JSON_PROPERTY_FILTER)
+ @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
+ public SpansMetricFilter getFilter() {
+ return filter;
+ }
+
+ public void setFilter(SpansMetricFilter filter) {
+ this.filter = filter;
+ }
+
+ public SpansMetricCreateAttributes groupBy(List groupBy) {
+ this.groupBy = groupBy;
+ for (SpansMetricGroupBy item : groupBy) {
+ this.unparsed |= item.unparsed;
+ }
+ return this;
+ }
+
+ public SpansMetricCreateAttributes addGroupByItem(SpansMetricGroupBy groupByItem) {
+ if (this.groupBy == null) {
+ this.groupBy = new ArrayList<>();
+ }
+ this.groupBy.add(groupByItem);
+ this.unparsed |= groupByItem.unparsed;
+ return this;
+ }
+
+ /**
+ * The rules for the group by.
+ *
+ * @return groupBy
+ */
+ @jakarta.annotation.Nullable
+ @JsonProperty(JSON_PROPERTY_GROUP_BY)
+ @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
+ public List getGroupBy() {
+ return groupBy;
+ }
+
+ public void setGroupBy(List groupBy) {
+ this.groupBy = groupBy;
+ }
+
+ /** Return true if this SpansMetricCreateAttributes object is equal to o. */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SpansMetricCreateAttributes spansMetricCreateAttributes = (SpansMetricCreateAttributes) o;
+ return Objects.equals(this.compute, spansMetricCreateAttributes.compute)
+ && Objects.equals(this.filter, spansMetricCreateAttributes.filter)
+ && Objects.equals(this.groupBy, spansMetricCreateAttributes.groupBy);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(compute, filter, groupBy);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class SpansMetricCreateAttributes {\n");
+ sb.append(" compute: ").append(toIndentedString(compute)).append("\n");
+ sb.append(" filter: ").append(toIndentedString(filter)).append("\n");
+ sb.append(" groupBy: ").append(toIndentedString(groupBy)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+}
diff --git a/src/main/java/com/datadog/api/client/v2/model/SpansMetricCreateData.java b/src/main/java/com/datadog/api/client/v2/model/SpansMetricCreateData.java
new file mode 100644
index 00000000000..d8fa9fa597e
--- /dev/null
+++ b/src/main/java/com/datadog/api/client/v2/model/SpansMetricCreateData.java
@@ -0,0 +1,155 @@
+/*
+ * 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.
+ */
+
+package com.datadog.api.client.v2.model;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import java.util.Objects;
+
+/** The new span-based metric properties. */
+@JsonPropertyOrder({
+ SpansMetricCreateData.JSON_PROPERTY_ATTRIBUTES,
+ SpansMetricCreateData.JSON_PROPERTY_ID,
+ SpansMetricCreateData.JSON_PROPERTY_TYPE
+})
+@jakarta.annotation.Generated(
+ value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
+public class SpansMetricCreateData {
+ @JsonIgnore public boolean unparsed = false;
+ public static final String JSON_PROPERTY_ATTRIBUTES = "attributes";
+ private SpansMetricCreateAttributes attributes;
+
+ public static final String JSON_PROPERTY_ID = "id";
+ private String id;
+
+ public static final String JSON_PROPERTY_TYPE = "type";
+ private SpansMetricType type = SpansMetricType.SPANS_METRICS;
+
+ public SpansMetricCreateData() {}
+
+ @JsonCreator
+ public SpansMetricCreateData(
+ @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES)
+ SpansMetricCreateAttributes attributes,
+ @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id,
+ @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) SpansMetricType type) {
+ this.attributes = attributes;
+ this.unparsed |= attributes.unparsed;
+ this.id = id;
+ this.type = type;
+ this.unparsed |= !type.isValid();
+ }
+
+ public SpansMetricCreateData attributes(SpansMetricCreateAttributes attributes) {
+ this.attributes = attributes;
+ this.unparsed |= attributes.unparsed;
+ return this;
+ }
+
+ /**
+ * The object describing the Datadog span-based metric to create.
+ *
+ * @return attributes
+ */
+ @JsonProperty(JSON_PROPERTY_ATTRIBUTES)
+ @JsonInclude(value = JsonInclude.Include.ALWAYS)
+ public SpansMetricCreateAttributes getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(SpansMetricCreateAttributes attributes) {
+ this.attributes = attributes;
+ }
+
+ public SpansMetricCreateData id(String id) {
+ this.id = id;
+ return this;
+ }
+
+ /**
+ * The name of the span-based metric.
+ *
+ * @return id
+ */
+ @JsonProperty(JSON_PROPERTY_ID)
+ @JsonInclude(value = JsonInclude.Include.ALWAYS)
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public SpansMetricCreateData type(SpansMetricType type) {
+ this.type = type;
+ this.unparsed |= !type.isValid();
+ return this;
+ }
+
+ /**
+ * The type of resource. The value should always be spans_metrics.
+ *
+ * @return type
+ */
+ @JsonProperty(JSON_PROPERTY_TYPE)
+ @JsonInclude(value = JsonInclude.Include.ALWAYS)
+ public SpansMetricType getType() {
+ return type;
+ }
+
+ public void setType(SpansMetricType type) {
+ if (!type.isValid()) {
+ this.unparsed = true;
+ }
+ this.type = type;
+ }
+
+ /** Return true if this SpansMetricCreateData object is equal to o. */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SpansMetricCreateData spansMetricCreateData = (SpansMetricCreateData) o;
+ return Objects.equals(this.attributes, spansMetricCreateData.attributes)
+ && Objects.equals(this.id, spansMetricCreateData.id)
+ && Objects.equals(this.type, spansMetricCreateData.type);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(attributes, id, type);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class SpansMetricCreateData {\n");
+ sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n");
+ sb.append(" id: ").append(toIndentedString(id)).append("\n");
+ sb.append(" type: ").append(toIndentedString(type)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+}
diff --git a/src/main/java/com/datadog/api/client/v2/model/SpansMetricCreateRequest.java b/src/main/java/com/datadog/api/client/v2/model/SpansMetricCreateRequest.java
new file mode 100644
index 00000000000..996143d276d
--- /dev/null
+++ b/src/main/java/com/datadog/api/client/v2/model/SpansMetricCreateRequest.java
@@ -0,0 +1,91 @@
+/*
+ * 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.
+ */
+
+package com.datadog.api.client.v2.model;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import java.util.Objects;
+
+/** The new span-based metric body. */
+@JsonPropertyOrder({SpansMetricCreateRequest.JSON_PROPERTY_DATA})
+@jakarta.annotation.Generated(
+ value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
+public class SpansMetricCreateRequest {
+ @JsonIgnore public boolean unparsed = false;
+ public static final String JSON_PROPERTY_DATA = "data";
+ private SpansMetricCreateData data;
+
+ public SpansMetricCreateRequest() {}
+
+ @JsonCreator
+ public SpansMetricCreateRequest(
+ @JsonProperty(required = true, value = JSON_PROPERTY_DATA) SpansMetricCreateData data) {
+ this.data = data;
+ this.unparsed |= data.unparsed;
+ }
+
+ public SpansMetricCreateRequest data(SpansMetricCreateData data) {
+ this.data = data;
+ this.unparsed |= data.unparsed;
+ return this;
+ }
+
+ /**
+ * The new span-based metric properties.
+ *
+ * @return data
+ */
+ @JsonProperty(JSON_PROPERTY_DATA)
+ @JsonInclude(value = JsonInclude.Include.ALWAYS)
+ public SpansMetricCreateData getData() {
+ return data;
+ }
+
+ public void setData(SpansMetricCreateData data) {
+ this.data = data;
+ }
+
+ /** Return true if this SpansMetricCreateRequest object is equal to o. */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SpansMetricCreateRequest spansMetricCreateRequest = (SpansMetricCreateRequest) o;
+ return Objects.equals(this.data, spansMetricCreateRequest.data);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(data);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class SpansMetricCreateRequest {\n");
+ sb.append(" data: ").append(toIndentedString(data)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+}
diff --git a/src/main/java/com/datadog/api/client/v2/model/SpansMetricFilter.java b/src/main/java/com/datadog/api/client/v2/model/SpansMetricFilter.java
new file mode 100644
index 00000000000..e21b228dfb8
--- /dev/null
+++ b/src/main/java/com/datadog/api/client/v2/model/SpansMetricFilter.java
@@ -0,0 +1,81 @@
+/*
+ * 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.
+ */
+
+package com.datadog.api.client.v2.model;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import java.util.Objects;
+
+/** The span-based metric filter. Spans matching this filter will be aggregated in this metric. */
+@JsonPropertyOrder({SpansMetricFilter.JSON_PROPERTY_QUERY})
+@jakarta.annotation.Generated(
+ value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
+public class SpansMetricFilter {
+ @JsonIgnore public boolean unparsed = false;
+ public static final String JSON_PROPERTY_QUERY = "query";
+ private String query = "*";
+
+ public SpansMetricFilter query(String query) {
+ this.query = query;
+ return this;
+ }
+
+ /**
+ * The search query - following the span search syntax.
+ *
+ * @return query
+ */
+ @jakarta.annotation.Nullable
+ @JsonProperty(JSON_PROPERTY_QUERY)
+ @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
+ public String getQuery() {
+ return query;
+ }
+
+ public void setQuery(String query) {
+ this.query = query;
+ }
+
+ /** Return true if this SpansMetricFilter object is equal to o. */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SpansMetricFilter spansMetricFilter = (SpansMetricFilter) o;
+ return Objects.equals(this.query, spansMetricFilter.query);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(query);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class SpansMetricFilter {\n");
+ sb.append(" query: ").append(toIndentedString(query)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+}
diff --git a/src/main/java/com/datadog/api/client/v2/model/SpansMetricGroupBy.java b/src/main/java/com/datadog/api/client/v2/model/SpansMetricGroupBy.java
new file mode 100644
index 00000000000..3f4e2d7ea9f
--- /dev/null
+++ b/src/main/java/com/datadog/api/client/v2/model/SpansMetricGroupBy.java
@@ -0,0 +1,119 @@
+/*
+ * 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.
+ */
+
+package com.datadog.api.client.v2.model;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import java.util.Objects;
+
+/** A group by rule. */
+@JsonPropertyOrder({
+ SpansMetricGroupBy.JSON_PROPERTY_PATH,
+ SpansMetricGroupBy.JSON_PROPERTY_TAG_NAME
+})
+@jakarta.annotation.Generated(
+ value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
+public class SpansMetricGroupBy {
+ @JsonIgnore public boolean unparsed = false;
+ public static final String JSON_PROPERTY_PATH = "path";
+ private String path;
+
+ public static final String JSON_PROPERTY_TAG_NAME = "tag_name";
+ private String tagName;
+
+ public SpansMetricGroupBy() {}
+
+ @JsonCreator
+ public SpansMetricGroupBy(
+ @JsonProperty(required = true, value = JSON_PROPERTY_PATH) String path) {
+ this.path = path;
+ }
+
+ public SpansMetricGroupBy path(String path) {
+ this.path = path;
+ return this;
+ }
+
+ /**
+ * The path to the value the span-based metric will be aggregated over.
+ *
+ * @return path
+ */
+ @JsonProperty(JSON_PROPERTY_PATH)
+ @JsonInclude(value = JsonInclude.Include.ALWAYS)
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ public SpansMetricGroupBy tagName(String tagName) {
+ this.tagName = tagName;
+ return this;
+ }
+
+ /**
+ * Eventual name of the tag that gets created. By default, the path attribute is used as the tag
+ * name.
+ *
+ * @return tagName
+ */
+ @jakarta.annotation.Nullable
+ @JsonProperty(JSON_PROPERTY_TAG_NAME)
+ @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
+ public String getTagName() {
+ return tagName;
+ }
+
+ public void setTagName(String tagName) {
+ this.tagName = tagName;
+ }
+
+ /** Return true if this SpansMetricGroupBy object is equal to o. */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SpansMetricGroupBy spansMetricGroupBy = (SpansMetricGroupBy) o;
+ return Objects.equals(this.path, spansMetricGroupBy.path)
+ && Objects.equals(this.tagName, spansMetricGroupBy.tagName);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(path, tagName);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class SpansMetricGroupBy {\n");
+ sb.append(" path: ").append(toIndentedString(path)).append("\n");
+ sb.append(" tagName: ").append(toIndentedString(tagName)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+}
diff --git a/src/main/java/com/datadog/api/client/v2/model/SpansMetricResponse.java b/src/main/java/com/datadog/api/client/v2/model/SpansMetricResponse.java
new file mode 100644
index 00000000000..f06532254fd
--- /dev/null
+++ b/src/main/java/com/datadog/api/client/v2/model/SpansMetricResponse.java
@@ -0,0 +1,82 @@
+/*
+ * 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.
+ */
+
+package com.datadog.api.client.v2.model;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import java.util.Objects;
+
+/** The span-based metric object. */
+@JsonPropertyOrder({SpansMetricResponse.JSON_PROPERTY_DATA})
+@jakarta.annotation.Generated(
+ value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
+public class SpansMetricResponse {
+ @JsonIgnore public boolean unparsed = false;
+ public static final String JSON_PROPERTY_DATA = "data";
+ private SpansMetricResponseData data;
+
+ public SpansMetricResponse data(SpansMetricResponseData data) {
+ this.data = data;
+ this.unparsed |= data.unparsed;
+ return this;
+ }
+
+ /**
+ * The span-based metric properties.
+ *
+ * @return data
+ */
+ @jakarta.annotation.Nullable
+ @JsonProperty(JSON_PROPERTY_DATA)
+ @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
+ public SpansMetricResponseData getData() {
+ return data;
+ }
+
+ public void setData(SpansMetricResponseData data) {
+ this.data = data;
+ }
+
+ /** Return true if this SpansMetricResponse object is equal to o. */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SpansMetricResponse spansMetricResponse = (SpansMetricResponse) o;
+ return Objects.equals(this.data, spansMetricResponse.data);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(data);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class SpansMetricResponse {\n");
+ sb.append(" data: ").append(toIndentedString(data)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+}
diff --git a/src/main/java/com/datadog/api/client/v2/model/SpansMetricResponseAttributes.java b/src/main/java/com/datadog/api/client/v2/model/SpansMetricResponseAttributes.java
new file mode 100644
index 00000000000..14c21af9a5b
--- /dev/null
+++ b/src/main/java/com/datadog/api/client/v2/model/SpansMetricResponseAttributes.java
@@ -0,0 +1,153 @@
+/*
+ * 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.
+ */
+
+package com.datadog.api.client.v2.model;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+/** The object describing a Datadog span-based metric. */
+@JsonPropertyOrder({
+ SpansMetricResponseAttributes.JSON_PROPERTY_COMPUTE,
+ SpansMetricResponseAttributes.JSON_PROPERTY_FILTER,
+ SpansMetricResponseAttributes.JSON_PROPERTY_GROUP_BY
+})
+@jakarta.annotation.Generated(
+ value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
+public class SpansMetricResponseAttributes {
+ @JsonIgnore public boolean unparsed = false;
+ public static final String JSON_PROPERTY_COMPUTE = "compute";
+ private SpansMetricResponseCompute compute;
+
+ public static final String JSON_PROPERTY_FILTER = "filter";
+ private SpansMetricResponseFilter filter;
+
+ public static final String JSON_PROPERTY_GROUP_BY = "group_by";
+ private List groupBy = null;
+
+ public SpansMetricResponseAttributes compute(SpansMetricResponseCompute compute) {
+ this.compute = compute;
+ this.unparsed |= compute.unparsed;
+ return this;
+ }
+
+ /**
+ * The compute rule to compute the span-based metric.
+ *
+ * @return compute
+ */
+ @jakarta.annotation.Nullable
+ @JsonProperty(JSON_PROPERTY_COMPUTE)
+ @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
+ public SpansMetricResponseCompute getCompute() {
+ return compute;
+ }
+
+ public void setCompute(SpansMetricResponseCompute compute) {
+ this.compute = compute;
+ }
+
+ public SpansMetricResponseAttributes filter(SpansMetricResponseFilter filter) {
+ this.filter = filter;
+ this.unparsed |= filter.unparsed;
+ return this;
+ }
+
+ /**
+ * The span-based metric filter. Spans matching this filter will be aggregated in this metric.
+ *
+ * @return filter
+ */
+ @jakarta.annotation.Nullable
+ @JsonProperty(JSON_PROPERTY_FILTER)
+ @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
+ public SpansMetricResponseFilter getFilter() {
+ return filter;
+ }
+
+ public void setFilter(SpansMetricResponseFilter filter) {
+ this.filter = filter;
+ }
+
+ public SpansMetricResponseAttributes groupBy(List groupBy) {
+ this.groupBy = groupBy;
+ for (SpansMetricResponseGroupBy item : groupBy) {
+ this.unparsed |= item.unparsed;
+ }
+ return this;
+ }
+
+ public SpansMetricResponseAttributes addGroupByItem(SpansMetricResponseGroupBy groupByItem) {
+ if (this.groupBy == null) {
+ this.groupBy = new ArrayList<>();
+ }
+ this.groupBy.add(groupByItem);
+ this.unparsed |= groupByItem.unparsed;
+ return this;
+ }
+
+ /**
+ * The rules for the group by.
+ *
+ * @return groupBy
+ */
+ @jakarta.annotation.Nullable
+ @JsonProperty(JSON_PROPERTY_GROUP_BY)
+ @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
+ public List getGroupBy() {
+ return groupBy;
+ }
+
+ public void setGroupBy(List groupBy) {
+ this.groupBy = groupBy;
+ }
+
+ /** Return true if this SpansMetricResponseAttributes object is equal to o. */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SpansMetricResponseAttributes spansMetricResponseAttributes = (SpansMetricResponseAttributes) o;
+ return Objects.equals(this.compute, spansMetricResponseAttributes.compute)
+ && Objects.equals(this.filter, spansMetricResponseAttributes.filter)
+ && Objects.equals(this.groupBy, spansMetricResponseAttributes.groupBy);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(compute, filter, groupBy);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class SpansMetricResponseAttributes {\n");
+ sb.append(" compute: ").append(toIndentedString(compute)).append("\n");
+ sb.append(" filter: ").append(toIndentedString(filter)).append("\n");
+ sb.append(" groupBy: ").append(toIndentedString(groupBy)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+}
diff --git a/src/main/java/com/datadog/api/client/v2/model/SpansMetricResponseCompute.java b/src/main/java/com/datadog/api/client/v2/model/SpansMetricResponseCompute.java
new file mode 100644
index 00000000000..a7606f24730
--- /dev/null
+++ b/src/main/java/com/datadog/api/client/v2/model/SpansMetricResponseCompute.java
@@ -0,0 +1,144 @@
+/*
+ * 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.
+ */
+
+package com.datadog.api.client.v2.model;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import java.util.Objects;
+
+/** The compute rule to compute the span-based metric. */
+@JsonPropertyOrder({
+ SpansMetricResponseCompute.JSON_PROPERTY_AGGREGATION_TYPE,
+ SpansMetricResponseCompute.JSON_PROPERTY_INCLUDE_PERCENTILES,
+ SpansMetricResponseCompute.JSON_PROPERTY_PATH
+})
+@jakarta.annotation.Generated(
+ value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
+public class SpansMetricResponseCompute {
+ @JsonIgnore public boolean unparsed = false;
+ public static final String JSON_PROPERTY_AGGREGATION_TYPE = "aggregation_type";
+ private SpansMetricComputeAggregationType aggregationType;
+
+ public static final String JSON_PROPERTY_INCLUDE_PERCENTILES = "include_percentiles";
+ private Boolean includePercentiles;
+
+ public static final String JSON_PROPERTY_PATH = "path";
+ private String path;
+
+ public SpansMetricResponseCompute aggregationType(
+ SpansMetricComputeAggregationType aggregationType) {
+ this.aggregationType = aggregationType;
+ this.unparsed |= !aggregationType.isValid();
+ return this;
+ }
+
+ /**
+ * The type of aggregation to use.
+ *
+ * @return aggregationType
+ */
+ @jakarta.annotation.Nullable
+ @JsonProperty(JSON_PROPERTY_AGGREGATION_TYPE)
+ @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
+ public SpansMetricComputeAggregationType getAggregationType() {
+ return aggregationType;
+ }
+
+ public void setAggregationType(SpansMetricComputeAggregationType aggregationType) {
+ if (!aggregationType.isValid()) {
+ this.unparsed = true;
+ }
+ this.aggregationType = aggregationType;
+ }
+
+ public SpansMetricResponseCompute includePercentiles(Boolean includePercentiles) {
+ this.includePercentiles = includePercentiles;
+ return this;
+ }
+
+ /**
+ * Toggle to include or exclude percentile aggregations for distribution metrics. Only present
+ * when the aggregation_type is distribution.
+ *
+ * @return includePercentiles
+ */
+ @jakarta.annotation.Nullable
+ @JsonProperty(JSON_PROPERTY_INCLUDE_PERCENTILES)
+ @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
+ public Boolean getIncludePercentiles() {
+ return includePercentiles;
+ }
+
+ public void setIncludePercentiles(Boolean includePercentiles) {
+ this.includePercentiles = includePercentiles;
+ }
+
+ public SpansMetricResponseCompute path(String path) {
+ this.path = path;
+ return this;
+ }
+
+ /**
+ * The path to the value the span-based metric will aggregate on (only used if the aggregation
+ * type is a "distribution").
+ *
+ * @return path
+ */
+ @jakarta.annotation.Nullable
+ @JsonProperty(JSON_PROPERTY_PATH)
+ @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ /** Return true if this SpansMetricResponseCompute object is equal to o. */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SpansMetricResponseCompute spansMetricResponseCompute = (SpansMetricResponseCompute) o;
+ return Objects.equals(this.aggregationType, spansMetricResponseCompute.aggregationType)
+ && Objects.equals(this.includePercentiles, spansMetricResponseCompute.includePercentiles)
+ && Objects.equals(this.path, spansMetricResponseCompute.path);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(aggregationType, includePercentiles, path);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class SpansMetricResponseCompute {\n");
+ sb.append(" aggregationType: ").append(toIndentedString(aggregationType)).append("\n");
+ sb.append(" includePercentiles: ").append(toIndentedString(includePercentiles)).append("\n");
+ sb.append(" path: ").append(toIndentedString(path)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+}
diff --git a/src/main/java/com/datadog/api/client/v2/model/SpansMetricResponseData.java b/src/main/java/com/datadog/api/client/v2/model/SpansMetricResponseData.java
new file mode 100644
index 00000000000..745d4df9ed2
--- /dev/null
+++ b/src/main/java/com/datadog/api/client/v2/model/SpansMetricResponseData.java
@@ -0,0 +1,142 @@
+/*
+ * 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.
+ */
+
+package com.datadog.api.client.v2.model;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import java.util.Objects;
+
+/** The span-based metric properties. */
+@JsonPropertyOrder({
+ SpansMetricResponseData.JSON_PROPERTY_ATTRIBUTES,
+ SpansMetricResponseData.JSON_PROPERTY_ID,
+ SpansMetricResponseData.JSON_PROPERTY_TYPE
+})
+@jakarta.annotation.Generated(
+ value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
+public class SpansMetricResponseData {
+ @JsonIgnore public boolean unparsed = false;
+ public static final String JSON_PROPERTY_ATTRIBUTES = "attributes";
+ private SpansMetricResponseAttributes attributes;
+
+ public static final String JSON_PROPERTY_ID = "id";
+ private String id;
+
+ public static final String JSON_PROPERTY_TYPE = "type";
+ private SpansMetricType type = SpansMetricType.SPANS_METRICS;
+
+ public SpansMetricResponseData attributes(SpansMetricResponseAttributes attributes) {
+ this.attributes = attributes;
+ this.unparsed |= attributes.unparsed;
+ return this;
+ }
+
+ /**
+ * The object describing a Datadog span-based metric.
+ *
+ * @return attributes
+ */
+ @jakarta.annotation.Nullable
+ @JsonProperty(JSON_PROPERTY_ATTRIBUTES)
+ @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
+ public SpansMetricResponseAttributes getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(SpansMetricResponseAttributes attributes) {
+ this.attributes = attributes;
+ }
+
+ public SpansMetricResponseData id(String id) {
+ this.id = id;
+ return this;
+ }
+
+ /**
+ * The name of the span-based metric.
+ *
+ * @return id
+ */
+ @jakarta.annotation.Nullable
+ @JsonProperty(JSON_PROPERTY_ID)
+ @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public SpansMetricResponseData type(SpansMetricType type) {
+ this.type = type;
+ this.unparsed |= !type.isValid();
+ return this;
+ }
+
+ /**
+ * The type of resource. The value should always be spans_metrics.
+ *
+ * @return type
+ */
+ @jakarta.annotation.Nullable
+ @JsonProperty(JSON_PROPERTY_TYPE)
+ @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
+ public SpansMetricType getType() {
+ return type;
+ }
+
+ public void setType(SpansMetricType type) {
+ if (!type.isValid()) {
+ this.unparsed = true;
+ }
+ this.type = type;
+ }
+
+ /** Return true if this SpansMetricResponseData object is equal to o. */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SpansMetricResponseData spansMetricResponseData = (SpansMetricResponseData) o;
+ return Objects.equals(this.attributes, spansMetricResponseData.attributes)
+ && Objects.equals(this.id, spansMetricResponseData.id)
+ && Objects.equals(this.type, spansMetricResponseData.type);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(attributes, id, type);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class SpansMetricResponseData {\n");
+ sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n");
+ sb.append(" id: ").append(toIndentedString(id)).append("\n");
+ sb.append(" type: ").append(toIndentedString(type)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+}
diff --git a/src/main/java/com/datadog/api/client/v2/model/SpansMetricResponseFilter.java b/src/main/java/com/datadog/api/client/v2/model/SpansMetricResponseFilter.java
new file mode 100644
index 00000000000..4171c024ffc
--- /dev/null
+++ b/src/main/java/com/datadog/api/client/v2/model/SpansMetricResponseFilter.java
@@ -0,0 +1,81 @@
+/*
+ * 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.
+ */
+
+package com.datadog.api.client.v2.model;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import java.util.Objects;
+
+/** The span-based metric filter. Spans matching this filter will be aggregated in this metric. */
+@JsonPropertyOrder({SpansMetricResponseFilter.JSON_PROPERTY_QUERY})
+@jakarta.annotation.Generated(
+ value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
+public class SpansMetricResponseFilter {
+ @JsonIgnore public boolean unparsed = false;
+ public static final String JSON_PROPERTY_QUERY = "query";
+ private String query;
+
+ public SpansMetricResponseFilter query(String query) {
+ this.query = query;
+ return this;
+ }
+
+ /**
+ * The search query - following the span search syntax.
+ *
+ * @return query
+ */
+ @jakarta.annotation.Nullable
+ @JsonProperty(JSON_PROPERTY_QUERY)
+ @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
+ public String getQuery() {
+ return query;
+ }
+
+ public void setQuery(String query) {
+ this.query = query;
+ }
+
+ /** Return true if this SpansMetricResponseFilter object is equal to o. */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SpansMetricResponseFilter spansMetricResponseFilter = (SpansMetricResponseFilter) o;
+ return Objects.equals(this.query, spansMetricResponseFilter.query);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(query);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class SpansMetricResponseFilter {\n");
+ sb.append(" query: ").append(toIndentedString(query)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+}
diff --git a/src/main/java/com/datadog/api/client/v2/model/SpansMetricResponseGroupBy.java b/src/main/java/com/datadog/api/client/v2/model/SpansMetricResponseGroupBy.java
new file mode 100644
index 00000000000..2325b2d090d
--- /dev/null
+++ b/src/main/java/com/datadog/api/client/v2/model/SpansMetricResponseGroupBy.java
@@ -0,0 +1,111 @@
+/*
+ * 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.
+ */
+
+package com.datadog.api.client.v2.model;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import java.util.Objects;
+
+/** A group by rule. */
+@JsonPropertyOrder({
+ SpansMetricResponseGroupBy.JSON_PROPERTY_PATH,
+ SpansMetricResponseGroupBy.JSON_PROPERTY_TAG_NAME
+})
+@jakarta.annotation.Generated(
+ value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
+public class SpansMetricResponseGroupBy {
+ @JsonIgnore public boolean unparsed = false;
+ public static final String JSON_PROPERTY_PATH = "path";
+ private String path;
+
+ public static final String JSON_PROPERTY_TAG_NAME = "tag_name";
+ private String tagName;
+
+ public SpansMetricResponseGroupBy path(String path) {
+ this.path = path;
+ return this;
+ }
+
+ /**
+ * The path to the value the span-based metric will be aggregated over.
+ *
+ * @return path
+ */
+ @jakarta.annotation.Nullable
+ @JsonProperty(JSON_PROPERTY_PATH)
+ @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ public SpansMetricResponseGroupBy tagName(String tagName) {
+ this.tagName = tagName;
+ return this;
+ }
+
+ /**
+ * Eventual name of the tag that gets created. By default, the path attribute is used as the tag
+ * name.
+ *
+ * @return tagName
+ */
+ @jakarta.annotation.Nullable
+ @JsonProperty(JSON_PROPERTY_TAG_NAME)
+ @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
+ public String getTagName() {
+ return tagName;
+ }
+
+ public void setTagName(String tagName) {
+ this.tagName = tagName;
+ }
+
+ /** Return true if this SpansMetricResponseGroupBy object is equal to o. */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SpansMetricResponseGroupBy spansMetricResponseGroupBy = (SpansMetricResponseGroupBy) o;
+ return Objects.equals(this.path, spansMetricResponseGroupBy.path)
+ && Objects.equals(this.tagName, spansMetricResponseGroupBy.tagName);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(path, tagName);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class SpansMetricResponseGroupBy {\n");
+ sb.append(" path: ").append(toIndentedString(path)).append("\n");
+ sb.append(" tagName: ").append(toIndentedString(tagName)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+}
diff --git a/src/main/java/com/datadog/api/client/v2/model/SpansMetricType.java b/src/main/java/com/datadog/api/client/v2/model/SpansMetricType.java
new file mode 100644
index 00000000000..14e92dac5ec
--- /dev/null
+++ b/src/main/java/com/datadog/api/client/v2/model/SpansMetricType.java
@@ -0,0 +1,92 @@
+/*
+ * 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.
+ */
+
+package com.datadog.api.client.v2.model;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonValue;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.StdSerializer;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Objects;
+import java.util.Set;
+
+/** The type of resource. The value should always be spans_metrics. */
+@JsonSerialize(using = SpansMetricType.SpansMetricTypeSerializer.class)
+public class SpansMetricType {
+
+ public static final SpansMetricType SPANS_METRICS = new SpansMetricType("spans_metrics");
+
+ private static final Set allowedValues =
+ new HashSet(Arrays.asList("spans_metrics"));
+
+ private String value;
+
+ public boolean isValid() {
+ return allowedValues.contains(this.value);
+ }
+
+ SpansMetricType(String value) {
+ this.value = value;
+ }
+
+ public static class SpansMetricTypeSerializer extends StdSerializer {
+ public SpansMetricTypeSerializer(Class t) {
+ super(t);
+ }
+
+ public SpansMetricTypeSerializer() {
+ this(null);
+ }
+
+ @Override
+ public void serialize(SpansMetricType value, JsonGenerator jgen, SerializerProvider provider)
+ throws IOException, JsonProcessingException {
+ jgen.writeObject(value.value);
+ }
+ }
+
+ @JsonValue
+ public String getValue() {
+ return this.value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ /** Return true if this SpansMetricType object is equal to o. */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ return this.value.equals(((SpansMetricType) o).value);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(value);
+ }
+
+ @Override
+ public String toString() {
+ return String.valueOf(value);
+ }
+
+ @JsonCreator
+ public static SpansMetricType fromValue(String value) {
+ return new SpansMetricType(value);
+ }
+}
diff --git a/src/main/java/com/datadog/api/client/v2/model/SpansMetricUpdateAttributes.java b/src/main/java/com/datadog/api/client/v2/model/SpansMetricUpdateAttributes.java
new file mode 100644
index 00000000000..16507968229
--- /dev/null
+++ b/src/main/java/com/datadog/api/client/v2/model/SpansMetricUpdateAttributes.java
@@ -0,0 +1,153 @@
+/*
+ * 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.
+ */
+
+package com.datadog.api.client.v2.model;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+/** The span-based metric properties that will be updated. */
+@JsonPropertyOrder({
+ SpansMetricUpdateAttributes.JSON_PROPERTY_COMPUTE,
+ SpansMetricUpdateAttributes.JSON_PROPERTY_FILTER,
+ SpansMetricUpdateAttributes.JSON_PROPERTY_GROUP_BY
+})
+@jakarta.annotation.Generated(
+ value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
+public class SpansMetricUpdateAttributes {
+ @JsonIgnore public boolean unparsed = false;
+ public static final String JSON_PROPERTY_COMPUTE = "compute";
+ private SpansMetricUpdateCompute compute;
+
+ public static final String JSON_PROPERTY_FILTER = "filter";
+ private SpansMetricFilter filter;
+
+ public static final String JSON_PROPERTY_GROUP_BY = "group_by";
+ private List groupBy = null;
+
+ public SpansMetricUpdateAttributes compute(SpansMetricUpdateCompute compute) {
+ this.compute = compute;
+ this.unparsed |= compute.unparsed;
+ return this;
+ }
+
+ /**
+ * The compute rule to compute the span-based metric.
+ *
+ * @return compute
+ */
+ @jakarta.annotation.Nullable
+ @JsonProperty(JSON_PROPERTY_COMPUTE)
+ @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
+ public SpansMetricUpdateCompute getCompute() {
+ return compute;
+ }
+
+ public void setCompute(SpansMetricUpdateCompute compute) {
+ this.compute = compute;
+ }
+
+ public SpansMetricUpdateAttributes filter(SpansMetricFilter filter) {
+ this.filter = filter;
+ this.unparsed |= filter.unparsed;
+ return this;
+ }
+
+ /**
+ * The span-based metric filter. Spans matching this filter will be aggregated in this metric.
+ *
+ * @return filter
+ */
+ @jakarta.annotation.Nullable
+ @JsonProperty(JSON_PROPERTY_FILTER)
+ @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
+ public SpansMetricFilter getFilter() {
+ return filter;
+ }
+
+ public void setFilter(SpansMetricFilter filter) {
+ this.filter = filter;
+ }
+
+ public SpansMetricUpdateAttributes groupBy(List groupBy) {
+ this.groupBy = groupBy;
+ for (SpansMetricGroupBy item : groupBy) {
+ this.unparsed |= item.unparsed;
+ }
+ return this;
+ }
+
+ public SpansMetricUpdateAttributes addGroupByItem(SpansMetricGroupBy groupByItem) {
+ if (this.groupBy == null) {
+ this.groupBy = new ArrayList<>();
+ }
+ this.groupBy.add(groupByItem);
+ this.unparsed |= groupByItem.unparsed;
+ return this;
+ }
+
+ /**
+ * The rules for the group by.
+ *
+ * @return groupBy
+ */
+ @jakarta.annotation.Nullable
+ @JsonProperty(JSON_PROPERTY_GROUP_BY)
+ @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
+ public List getGroupBy() {
+ return groupBy;
+ }
+
+ public void setGroupBy(List groupBy) {
+ this.groupBy = groupBy;
+ }
+
+ /** Return true if this SpansMetricUpdateAttributes object is equal to o. */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SpansMetricUpdateAttributes spansMetricUpdateAttributes = (SpansMetricUpdateAttributes) o;
+ return Objects.equals(this.compute, spansMetricUpdateAttributes.compute)
+ && Objects.equals(this.filter, spansMetricUpdateAttributes.filter)
+ && Objects.equals(this.groupBy, spansMetricUpdateAttributes.groupBy);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(compute, filter, groupBy);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class SpansMetricUpdateAttributes {\n");
+ sb.append(" compute: ").append(toIndentedString(compute)).append("\n");
+ sb.append(" filter: ").append(toIndentedString(filter)).append("\n");
+ sb.append(" groupBy: ").append(toIndentedString(groupBy)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+}
diff --git a/src/main/java/com/datadog/api/client/v2/model/SpansMetricUpdateCompute.java b/src/main/java/com/datadog/api/client/v2/model/SpansMetricUpdateCompute.java
new file mode 100644
index 00000000000..3928cac6a73
--- /dev/null
+++ b/src/main/java/com/datadog/api/client/v2/model/SpansMetricUpdateCompute.java
@@ -0,0 +1,82 @@
+/*
+ * 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.
+ */
+
+package com.datadog.api.client.v2.model;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import java.util.Objects;
+
+/** The compute rule to compute the span-based metric. */
+@JsonPropertyOrder({SpansMetricUpdateCompute.JSON_PROPERTY_INCLUDE_PERCENTILES})
+@jakarta.annotation.Generated(
+ value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
+public class SpansMetricUpdateCompute {
+ @JsonIgnore public boolean unparsed = false;
+ public static final String JSON_PROPERTY_INCLUDE_PERCENTILES = "include_percentiles";
+ private Boolean includePercentiles;
+
+ public SpansMetricUpdateCompute includePercentiles(Boolean includePercentiles) {
+ this.includePercentiles = includePercentiles;
+ return this;
+ }
+
+ /**
+ * Toggle to include or exclude percentile aggregations for distribution metrics. Only present
+ * when the aggregation_type is distribution.
+ *
+ * @return includePercentiles
+ */
+ @jakarta.annotation.Nullable
+ @JsonProperty(JSON_PROPERTY_INCLUDE_PERCENTILES)
+ @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
+ public Boolean getIncludePercentiles() {
+ return includePercentiles;
+ }
+
+ public void setIncludePercentiles(Boolean includePercentiles) {
+ this.includePercentiles = includePercentiles;
+ }
+
+ /** Return true if this SpansMetricUpdateCompute object is equal to o. */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SpansMetricUpdateCompute spansMetricUpdateCompute = (SpansMetricUpdateCompute) o;
+ return Objects.equals(this.includePercentiles, spansMetricUpdateCompute.includePercentiles);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(includePercentiles);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class SpansMetricUpdateCompute {\n");
+ sb.append(" includePercentiles: ").append(toIndentedString(includePercentiles)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+}
diff --git a/src/main/java/com/datadog/api/client/v2/model/SpansMetricUpdateData.java b/src/main/java/com/datadog/api/client/v2/model/SpansMetricUpdateData.java
new file mode 100644
index 00000000000..791bef5c1b4
--- /dev/null
+++ b/src/main/java/com/datadog/api/client/v2/model/SpansMetricUpdateData.java
@@ -0,0 +1,127 @@
+/*
+ * 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.
+ */
+
+package com.datadog.api.client.v2.model;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import java.util.Objects;
+
+/** The new span-based metric properties. */
+@JsonPropertyOrder({
+ SpansMetricUpdateData.JSON_PROPERTY_ATTRIBUTES,
+ SpansMetricUpdateData.JSON_PROPERTY_TYPE
+})
+@jakarta.annotation.Generated(
+ value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
+public class SpansMetricUpdateData {
+ @JsonIgnore public boolean unparsed = false;
+ public static final String JSON_PROPERTY_ATTRIBUTES = "attributes";
+ private SpansMetricUpdateAttributes attributes;
+
+ public static final String JSON_PROPERTY_TYPE = "type";
+ private SpansMetricType type = SpansMetricType.SPANS_METRICS;
+
+ public SpansMetricUpdateData() {}
+
+ @JsonCreator
+ public SpansMetricUpdateData(
+ @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES)
+ SpansMetricUpdateAttributes attributes,
+ @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) SpansMetricType type) {
+ this.attributes = attributes;
+ this.unparsed |= attributes.unparsed;
+ this.type = type;
+ this.unparsed |= !type.isValid();
+ }
+
+ public SpansMetricUpdateData attributes(SpansMetricUpdateAttributes attributes) {
+ this.attributes = attributes;
+ this.unparsed |= attributes.unparsed;
+ return this;
+ }
+
+ /**
+ * The span-based metric properties that will be updated.
+ *
+ * @return attributes
+ */
+ @JsonProperty(JSON_PROPERTY_ATTRIBUTES)
+ @JsonInclude(value = JsonInclude.Include.ALWAYS)
+ public SpansMetricUpdateAttributes getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(SpansMetricUpdateAttributes attributes) {
+ this.attributes = attributes;
+ }
+
+ public SpansMetricUpdateData type(SpansMetricType type) {
+ this.type = type;
+ this.unparsed |= !type.isValid();
+ return this;
+ }
+
+ /**
+ * The type of resource. The value should always be spans_metrics.
+ *
+ * @return type
+ */
+ @JsonProperty(JSON_PROPERTY_TYPE)
+ @JsonInclude(value = JsonInclude.Include.ALWAYS)
+ public SpansMetricType getType() {
+ return type;
+ }
+
+ public void setType(SpansMetricType type) {
+ if (!type.isValid()) {
+ this.unparsed = true;
+ }
+ this.type = type;
+ }
+
+ /** Return true if this SpansMetricUpdateData object is equal to o. */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SpansMetricUpdateData spansMetricUpdateData = (SpansMetricUpdateData) o;
+ return Objects.equals(this.attributes, spansMetricUpdateData.attributes)
+ && Objects.equals(this.type, spansMetricUpdateData.type);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(attributes, type);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class SpansMetricUpdateData {\n");
+ sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n");
+ sb.append(" type: ").append(toIndentedString(type)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+}
diff --git a/src/main/java/com/datadog/api/client/v2/model/SpansMetricUpdateRequest.java b/src/main/java/com/datadog/api/client/v2/model/SpansMetricUpdateRequest.java
new file mode 100644
index 00000000000..a73e8fdaeee
--- /dev/null
+++ b/src/main/java/com/datadog/api/client/v2/model/SpansMetricUpdateRequest.java
@@ -0,0 +1,91 @@
+/*
+ * 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.
+ */
+
+package com.datadog.api.client.v2.model;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import java.util.Objects;
+
+/** The new span-based metric body. */
+@JsonPropertyOrder({SpansMetricUpdateRequest.JSON_PROPERTY_DATA})
+@jakarta.annotation.Generated(
+ value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
+public class SpansMetricUpdateRequest {
+ @JsonIgnore public boolean unparsed = false;
+ public static final String JSON_PROPERTY_DATA = "data";
+ private SpansMetricUpdateData data;
+
+ public SpansMetricUpdateRequest() {}
+
+ @JsonCreator
+ public SpansMetricUpdateRequest(
+ @JsonProperty(required = true, value = JSON_PROPERTY_DATA) SpansMetricUpdateData data) {
+ this.data = data;
+ this.unparsed |= data.unparsed;
+ }
+
+ public SpansMetricUpdateRequest data(SpansMetricUpdateData data) {
+ this.data = data;
+ this.unparsed |= data.unparsed;
+ return this;
+ }
+
+ /**
+ * The new span-based metric properties.
+ *
+ * @return data
+ */
+ @JsonProperty(JSON_PROPERTY_DATA)
+ @JsonInclude(value = JsonInclude.Include.ALWAYS)
+ public SpansMetricUpdateData getData() {
+ return data;
+ }
+
+ public void setData(SpansMetricUpdateData data) {
+ this.data = data;
+ }
+
+ /** Return true if this SpansMetricUpdateRequest object is equal to o. */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SpansMetricUpdateRequest spansMetricUpdateRequest = (SpansMetricUpdateRequest) o;
+ return Objects.equals(this.data, spansMetricUpdateRequest.data);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(data);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class SpansMetricUpdateRequest {\n");
+ sb.append(" data: ").append(toIndentedString(data)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+}
diff --git a/src/main/java/com/datadog/api/client/v2/model/SpansMetricsResponse.java b/src/main/java/com/datadog/api/client/v2/model/SpansMetricsResponse.java
new file mode 100644
index 00000000000..9e8be093368
--- /dev/null
+++ b/src/main/java/com/datadog/api/client/v2/model/SpansMetricsResponse.java
@@ -0,0 +1,95 @@
+/*
+ * 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.
+ */
+
+package com.datadog.api.client.v2.model;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+/** All the available span-based metric objects. */
+@JsonPropertyOrder({SpansMetricsResponse.JSON_PROPERTY_DATA})
+@jakarta.annotation.Generated(
+ value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
+public class SpansMetricsResponse {
+ @JsonIgnore public boolean unparsed = false;
+ public static final String JSON_PROPERTY_DATA = "data";
+ private List data = null;
+
+ public SpansMetricsResponse data(List data) {
+ this.data = data;
+ for (SpansMetricResponseData item : data) {
+ this.unparsed |= item.unparsed;
+ }
+ return this;
+ }
+
+ public SpansMetricsResponse addDataItem(SpansMetricResponseData dataItem) {
+ if (this.data == null) {
+ this.data = new ArrayList<>();
+ }
+ this.data.add(dataItem);
+ this.unparsed |= dataItem.unparsed;
+ return this;
+ }
+
+ /**
+ * A list of span-based metric objects.
+ *
+ * @return data
+ */
+ @jakarta.annotation.Nullable
+ @JsonProperty(JSON_PROPERTY_DATA)
+ @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
+ public List getData() {
+ return data;
+ }
+
+ public void setData(List data) {
+ this.data = data;
+ }
+
+ /** Return true if this SpansMetricsResponse object is equal to o. */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SpansMetricsResponse spansMetricsResponse = (SpansMetricsResponse) o;
+ return Objects.equals(this.data, spansMetricsResponse.data);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(data);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class SpansMetricsResponse {\n");
+ sb.append(" data: ").append(toIndentedString(data)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+}
diff --git a/src/test/resources/cassettes/features/v2/Create_a_span_based_metric_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Create_a_span_based_metric_returns_OK_response.freeze
new file mode 100644
index 00000000000..f3b2847bb10
--- /dev/null
+++ b/src/test/resources/cassettes/features/v2/Create_a_span_based_metric_returns_OK_response.freeze
@@ -0,0 +1 @@
+2023-03-28T14:55:24.186Z
\ No newline at end of file
diff --git a/src/test/resources/cassettes/features/v2/Create_a_span_based_metric_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Create_a_span_based_metric_returns_OK_response.json
new file mode 100644
index 00000000000..64eaa9d56a4
--- /dev/null
+++ b/src/test/resources/cassettes/features/v2/Create_a_span_based_metric_returns_OK_response.json
@@ -0,0 +1,58 @@
+[
+ {
+ "httpRequest": {
+ "body": {
+ "type": "JSON",
+ "json": "{\"data\":{\"attributes\":{\"compute\":{\"aggregation_type\":\"distribution\",\"include_percentiles\":false,\"path\":\"@duration\"},\"filter\":{\"query\":\"@http.status_code:200 service:my-service\"},\"group_by\":[{\"path\":\"resource_name\",\"tag_name\":\"resource_name\"}]},\"id\":\"TestCreateaspanbasedmetricreturnsOKresponse1680015324\",\"type\":\"spans_metrics\"}}"
+ },
+ "headers": {},
+ "method": "POST",
+ "path": "/api/v2/apm/config/metrics",
+ "keepAlive": false,
+ "secure": true
+ },
+ "httpResponse": {
+ "body": "{\"data\":{\"id\":\"TestCreateaspanbasedmetricreturnsOKresponse1680015324\",\"attributes\":{\"filter\":{\"query\":\"@http.status_code:200 service:my-service\"},\"group_by\":[{\"path\":\"resource_name\",\"tag_name\":\"resource_name\"}],\"compute\":{\"aggregation_type\":\"distribution\",\"path\":\"@duration\",\"include_percentiles\":false}},\"type\":\"spans_metrics\"}}\n",
+ "headers": {
+ "Content-Type": [
+ "application/json"
+ ]
+ },
+ "statusCode": 200,
+ "reasonPhrase": "OK"
+ },
+ "times": {
+ "remainingTimes": 1
+ },
+ "timeToLive": {
+ "unlimited": true
+ },
+ "id": "d8d17e9a-71ea-2913-da2e-d502c39588e4"
+ },
+ {
+ "httpRequest": {
+ "headers": {},
+ "method": "DELETE",
+ "path": "/api/v2/apm/config/metrics/TestCreateaspanbasedmetricreturnsOKresponse1680015324",
+ "keepAlive": false,
+ "secure": true
+ },
+ "httpResponse": {
+ "body": "{}\n",
+ "headers": {
+ "Content-Type": [
+ "application/json"
+ ]
+ },
+ "statusCode": 200,
+ "reasonPhrase": "OK"
+ },
+ "times": {
+ "remainingTimes": 1
+ },
+ "timeToLive": {
+ "unlimited": true
+ },
+ "id": "0034064f-78a5-3405-c074-e39f47bc8166"
+ }
+]
\ No newline at end of file
diff --git a/src/test/resources/cassettes/features/v2/Delete_a_span_based_metric_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Delete_a_span_based_metric_returns_OK_response.freeze
new file mode 100644
index 00000000000..34bf144f923
--- /dev/null
+++ b/src/test/resources/cassettes/features/v2/Delete_a_span_based_metric_returns_OK_response.freeze
@@ -0,0 +1 @@
+2023-03-28T14:55:25.279Z
\ No newline at end of file
diff --git a/src/test/resources/cassettes/features/v2/Delete_a_span_based_metric_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Delete_a_span_based_metric_returns_OK_response.json
new file mode 100644
index 00000000000..c967718524b
--- /dev/null
+++ b/src/test/resources/cassettes/features/v2/Delete_a_span_based_metric_returns_OK_response.json
@@ -0,0 +1,84 @@
+[
+ {
+ "httpRequest": {
+ "body": {
+ "type": "JSON",
+ "json": "{\"data\":{\"attributes\":{\"compute\":{\"aggregation_type\":\"distribution\",\"include_percentiles\":false,\"path\":\"@duration\"},\"filter\":{\"query\":\"source:Test-Delete_a_span_based_metric_returns_OK_response-1680015325\"},\"group_by\":[{\"path\":\"resource_name\",\"tag_name\":\"resource_name\"}]},\"id\":\"Test-Delete_a_span_based_metric_returns_OK_response-1680015325\",\"type\":\"spans_metrics\"}}"
+ },
+ "headers": {},
+ "method": "POST",
+ "path": "/api/v2/apm/config/metrics",
+ "keepAlive": false,
+ "secure": true
+ },
+ "httpResponse": {
+ "body": "{\"data\":{\"id\":\"Test_Delete_a_span_based_metric_returns_OK_response_1680015325\",\"attributes\":{\"filter\":{\"query\":\"source:Test-Delete_a_span_based_metric_returns_OK_response-1680015325\"},\"group_by\":[{\"path\":\"resource_name\",\"tag_name\":\"resource_name\"}],\"compute\":{\"aggregation_type\":\"distribution\",\"path\":\"@duration\",\"include_percentiles\":false}},\"type\":\"spans_metrics\"}}\n",
+ "headers": {
+ "Content-Type": [
+ "application/json"
+ ]
+ },
+ "statusCode": 200,
+ "reasonPhrase": "OK"
+ },
+ "times": {
+ "remainingTimes": 1
+ },
+ "timeToLive": {
+ "unlimited": true
+ },
+ "id": "3cbb3815-f6e0-7de4-b0ae-7bfa2b3acbbe"
+ },
+ {
+ "httpRequest": {
+ "headers": {},
+ "method": "DELETE",
+ "path": "/api/v2/apm/config/metrics/Test_Delete_a_span_based_metric_returns_OK_response_1680015325",
+ "keepAlive": false,
+ "secure": true
+ },
+ "httpResponse": {
+ "body": "{}\n",
+ "headers": {
+ "Content-Type": [
+ "application/json"
+ ]
+ },
+ "statusCode": 200,
+ "reasonPhrase": "OK"
+ },
+ "times": {
+ "remainingTimes": 1
+ },
+ "timeToLive": {
+ "unlimited": true
+ },
+ "id": "42dcd81b-5868-9091-5d89-cbab9977880d"
+ },
+ {
+ "httpRequest": {
+ "headers": {},
+ "method": "DELETE",
+ "path": "/api/v2/apm/config/metrics/Test_Delete_a_span_based_metric_returns_OK_response_1680015325",
+ "keepAlive": false,
+ "secure": true
+ },
+ "httpResponse": {
+ "body": "{\"errors\":[\"not_found(Metric with name 'Test_Delete_a_span_based_metric_returns_OK_response_1680015325' not found)\"]}\n",
+ "headers": {
+ "Content-Type": [
+ "application/json"
+ ]
+ },
+ "statusCode": 404,
+ "reasonPhrase": "Not Found"
+ },
+ "times": {
+ "remainingTimes": 1
+ },
+ "timeToLive": {
+ "unlimited": true
+ },
+ "id": "42dcd81b-5868-9091-5d89-cbab9977880e"
+ }
+]
\ No newline at end of file
diff --git a/src/test/resources/cassettes/features/v2/Get_a_span_based_metric_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Get_a_span_based_metric_returns_OK_response.freeze
new file mode 100644
index 00000000000..ae074a2e89b
--- /dev/null
+++ b/src/test/resources/cassettes/features/v2/Get_a_span_based_metric_returns_OK_response.freeze
@@ -0,0 +1 @@
+2023-03-28T14:55:26.853Z
\ No newline at end of file
diff --git a/src/test/resources/cassettes/features/v2/Get_a_span_based_metric_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Get_a_span_based_metric_returns_OK_response.json
new file mode 100644
index 00000000000..4fa49e07f3e
--- /dev/null
+++ b/src/test/resources/cassettes/features/v2/Get_a_span_based_metric_returns_OK_response.json
@@ -0,0 +1,84 @@
+[
+ {
+ "httpRequest": {
+ "body": {
+ "type": "JSON",
+ "json": "{\"data\":{\"attributes\":{\"compute\":{\"aggregation_type\":\"distribution\",\"include_percentiles\":false,\"path\":\"@duration\"},\"filter\":{\"query\":\"source:Test-Get_a_span_based_metric_returns_OK_response-1680015326\"},\"group_by\":[{\"path\":\"resource_name\",\"tag_name\":\"resource_name\"}]},\"id\":\"Test-Get_a_span_based_metric_returns_OK_response-1680015326\",\"type\":\"spans_metrics\"}}"
+ },
+ "headers": {},
+ "method": "POST",
+ "path": "/api/v2/apm/config/metrics",
+ "keepAlive": false,
+ "secure": true
+ },
+ "httpResponse": {
+ "body": "{\"data\":{\"id\":\"Test_Get_a_span_based_metric_returns_OK_response_1680015326\",\"attributes\":{\"filter\":{\"query\":\"source:Test-Get_a_span_based_metric_returns_OK_response-1680015326\"},\"group_by\":[{\"path\":\"resource_name\",\"tag_name\":\"resource_name\"}],\"compute\":{\"aggregation_type\":\"distribution\",\"path\":\"@duration\",\"include_percentiles\":false}},\"type\":\"spans_metrics\"}}\n",
+ "headers": {
+ "Content-Type": [
+ "application/json"
+ ]
+ },
+ "statusCode": 200,
+ "reasonPhrase": "OK"
+ },
+ "times": {
+ "remainingTimes": 1
+ },
+ "timeToLive": {
+ "unlimited": true
+ },
+ "id": "0b963c08-a602-3d50-71f3-d5781d10b92c"
+ },
+ {
+ "httpRequest": {
+ "headers": {},
+ "method": "GET",
+ "path": "/api/v2/apm/config/metrics/Test_Get_a_span_based_metric_returns_OK_response_1680015326",
+ "keepAlive": false,
+ "secure": true
+ },
+ "httpResponse": {
+ "body": "{\"data\":{\"id\":\"Test_Get_a_span_based_metric_returns_OK_response_1680015326\",\"attributes\":{\"filter\":{\"query\":\"source:Test-Get_a_span_based_metric_returns_OK_response-1680015326\"},\"group_by\":[{\"path\":\"resource_name\",\"tag_name\":\"resource_name\"}],\"compute\":{\"aggregation_type\":\"distribution\",\"path\":\"@duration\",\"include_percentiles\":false}},\"type\":\"spans_metrics\"}}\n",
+ "headers": {
+ "Content-Type": [
+ "application/json"
+ ]
+ },
+ "statusCode": 200,
+ "reasonPhrase": "OK"
+ },
+ "times": {
+ "remainingTimes": 1
+ },
+ "timeToLive": {
+ "unlimited": true
+ },
+ "id": "1cd8eb19-3b37-d28f-f1fe-8b8c4d772175"
+ },
+ {
+ "httpRequest": {
+ "headers": {},
+ "method": "DELETE",
+ "path": "/api/v2/apm/config/metrics/Test_Get_a_span_based_metric_returns_OK_response_1680015326",
+ "keepAlive": false,
+ "secure": true
+ },
+ "httpResponse": {
+ "body": "{}\n",
+ "headers": {
+ "Content-Type": [
+ "application/json"
+ ]
+ },
+ "statusCode": 200,
+ "reasonPhrase": "OK"
+ },
+ "times": {
+ "remainingTimes": 1
+ },
+ "timeToLive": {
+ "unlimited": true
+ },
+ "id": "2164ea7c-24cb-a22d-80b7-4518bb734810"
+ }
+]
\ No newline at end of file
diff --git a/src/test/resources/cassettes/features/v2/Get_all_span_based_metrics_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Get_all_span_based_metrics_returns_OK_response.freeze
new file mode 100644
index 00000000000..f225f0ae5ab
--- /dev/null
+++ b/src/test/resources/cassettes/features/v2/Get_all_span_based_metrics_returns_OK_response.freeze
@@ -0,0 +1 @@
+2023-03-28T14:55:28.293Z
\ No newline at end of file
diff --git a/src/test/resources/cassettes/features/v2/Get_all_span_based_metrics_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Get_all_span_based_metrics_returns_OK_response.json
new file mode 100644
index 00000000000..06266934e3c
--- /dev/null
+++ b/src/test/resources/cassettes/features/v2/Get_all_span_based_metrics_returns_OK_response.json
@@ -0,0 +1,84 @@
+[
+ {
+ "httpRequest": {
+ "body": {
+ "type": "JSON",
+ "json": "{\"data\":{\"attributes\":{\"compute\":{\"aggregation_type\":\"distribution\",\"include_percentiles\":false,\"path\":\"@duration\"},\"filter\":{\"query\":\"source:Test-Get_all_span_based_metrics_returns_OK_response-1680015328\"},\"group_by\":[{\"path\":\"resource_name\",\"tag_name\":\"resource_name\"}]},\"id\":\"Test-Get_all_span_based_metrics_returns_OK_response-1680015328\",\"type\":\"spans_metrics\"}}"
+ },
+ "headers": {},
+ "method": "POST",
+ "path": "/api/v2/apm/config/metrics",
+ "keepAlive": false,
+ "secure": true
+ },
+ "httpResponse": {
+ "body": "{\"data\":{\"id\":\"Test_Get_all_span_based_metrics_returns_OK_response_1680015328\",\"attributes\":{\"filter\":{\"query\":\"source:Test-Get_all_span_based_metrics_returns_OK_response-1680015328\"},\"group_by\":[{\"path\":\"resource_name\",\"tag_name\":\"resource_name\"}],\"compute\":{\"aggregation_type\":\"distribution\",\"path\":\"@duration\",\"include_percentiles\":false}},\"type\":\"spans_metrics\"}}\n",
+ "headers": {
+ "Content-Type": [
+ "application/json"
+ ]
+ },
+ "statusCode": 200,
+ "reasonPhrase": "OK"
+ },
+ "times": {
+ "remainingTimes": 1
+ },
+ "timeToLive": {
+ "unlimited": true
+ },
+ "id": "11613ee2-a818-9555-9fe1-97614130d480"
+ },
+ {
+ "httpRequest": {
+ "headers": {},
+ "method": "GET",
+ "path": "/api/v2/apm/config/metrics",
+ "keepAlive": false,
+ "secure": true
+ },
+ "httpResponse": {
+ "body": "{\"data\":[{\"id\":\"Test_Get_all_span_based_metrics_returns_OK_response_1680015328\",\"attributes\":{\"filter\":{\"query\":\"source:Test-Get_all_span_based_metrics_returns_OK_response-1680015328\"},\"group_by\":[{\"path\":\"resource_name\",\"tag_name\":\"resource_name\"}],\"compute\":{\"aggregation_type\":\"distribution\",\"path\":\"@duration\",\"include_percentiles\":false}},\"type\":\"spans_metrics\"}]}\n",
+ "headers": {
+ "Content-Type": [
+ "application/json"
+ ]
+ },
+ "statusCode": 200,
+ "reasonPhrase": "OK"
+ },
+ "times": {
+ "remainingTimes": 1
+ },
+ "timeToLive": {
+ "unlimited": true
+ },
+ "id": "12e22974-e910-226f-8ea0-9bd7c368d3f5"
+ },
+ {
+ "httpRequest": {
+ "headers": {},
+ "method": "DELETE",
+ "path": "/api/v2/apm/config/metrics/Test_Get_all_span_based_metrics_returns_OK_response_1680015328",
+ "keepAlive": false,
+ "secure": true
+ },
+ "httpResponse": {
+ "body": "{}\n",
+ "headers": {
+ "Content-Type": [
+ "application/json"
+ ]
+ },
+ "statusCode": 200,
+ "reasonPhrase": "OK"
+ },
+ "times": {
+ "remainingTimes": 1
+ },
+ "timeToLive": {
+ "unlimited": true
+ },
+ "id": "57fe563d-c5d8-c911-90f2-72199213f16c"
+ }
+]
\ No newline at end of file
diff --git a/src/test/resources/cassettes/features/v2/Update_a_span_based_metric_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Update_a_span_based_metric_returns_OK_response.freeze
new file mode 100644
index 00000000000..9541e59fc6c
--- /dev/null
+++ b/src/test/resources/cassettes/features/v2/Update_a_span_based_metric_returns_OK_response.freeze
@@ -0,0 +1 @@
+2023-03-28T14:55:29.570Z
\ No newline at end of file
diff --git a/src/test/resources/cassettes/features/v2/Update_a_span_based_metric_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Update_a_span_based_metric_returns_OK_response.json
new file mode 100644
index 00000000000..a955da4c828
--- /dev/null
+++ b/src/test/resources/cassettes/features/v2/Update_a_span_based_metric_returns_OK_response.json
@@ -0,0 +1,88 @@
+[
+ {
+ "httpRequest": {
+ "body": {
+ "type": "JSON",
+ "json": "{\"data\":{\"attributes\":{\"compute\":{\"aggregation_type\":\"distribution\",\"include_percentiles\":false,\"path\":\"@duration\"},\"filter\":{\"query\":\"source:Test-Update_a_span_based_metric_returns_OK_response-1680015329\"},\"group_by\":[{\"path\":\"resource_name\",\"tag_name\":\"resource_name\"}]},\"id\":\"Test-Update_a_span_based_metric_returns_OK_response-1680015329\",\"type\":\"spans_metrics\"}}"
+ },
+ "headers": {},
+ "method": "POST",
+ "path": "/api/v2/apm/config/metrics",
+ "keepAlive": false,
+ "secure": true
+ },
+ "httpResponse": {
+ "body": "{\"data\":{\"id\":\"Test_Update_a_span_based_metric_returns_OK_response_1680015329\",\"attributes\":{\"filter\":{\"query\":\"source:Test-Update_a_span_based_metric_returns_OK_response-1680015329\"},\"group_by\":[{\"path\":\"resource_name\",\"tag_name\":\"resource_name\"}],\"compute\":{\"aggregation_type\":\"distribution\",\"path\":\"@duration\",\"include_percentiles\":false}},\"type\":\"spans_metrics\"}}\n",
+ "headers": {
+ "Content-Type": [
+ "application/json"
+ ]
+ },
+ "statusCode": 200,
+ "reasonPhrase": "OK"
+ },
+ "times": {
+ "remainingTimes": 1
+ },
+ "timeToLive": {
+ "unlimited": true
+ },
+ "id": "416dda28-e173-7688-7ee1-edf6e4133573"
+ },
+ {
+ "httpRequest": {
+ "body": {
+ "type": "JSON",
+ "json": "{\"data\":{\"attributes\":{\"compute\":{\"include_percentiles\":false},\"filter\":{\"query\":\"source:Test-Update_a_span_based_metric_returns_OK_response-1680015329-updated\"},\"group_by\":[{\"path\":\"resource_name\",\"tag_name\":\"resource_name\"}]},\"type\":\"spans_metrics\"}}"
+ },
+ "headers": {},
+ "method": "PATCH",
+ "path": "/api/v2/apm/config/metrics/Test_Update_a_span_based_metric_returns_OK_response_1680015329",
+ "keepAlive": false,
+ "secure": true
+ },
+ "httpResponse": {
+ "body": "{\"data\":{\"id\":\"Test_Update_a_span_based_metric_returns_OK_response_1680015329\",\"attributes\":{\"filter\":{\"query\":\"source:Test-Update_a_span_based_metric_returns_OK_response-1680015329-updated\"},\"group_by\":[{\"path\":\"resource_name\",\"tag_name\":\"resource_name\"}],\"compute\":{\"aggregation_type\":\"distribution\",\"path\":\"@duration\",\"include_percentiles\":false}},\"type\":\"spans_metrics\"}}\n",
+ "headers": {
+ "Content-Type": [
+ "application/json"
+ ]
+ },
+ "statusCode": 200,
+ "reasonPhrase": "OK"
+ },
+ "times": {
+ "remainingTimes": 1
+ },
+ "timeToLive": {
+ "unlimited": true
+ },
+ "id": "b4b0ae9d-6681-8ca9-4699-72bda82e2c9d"
+ },
+ {
+ "httpRequest": {
+ "headers": {},
+ "method": "DELETE",
+ "path": "/api/v2/apm/config/metrics/Test_Update_a_span_based_metric_returns_OK_response_1680015329",
+ "keepAlive": false,
+ "secure": true
+ },
+ "httpResponse": {
+ "body": "{}\n",
+ "headers": {
+ "Content-Type": [
+ "application/json"
+ ]
+ },
+ "statusCode": 200,
+ "reasonPhrase": "OK"
+ },
+ "times": {
+ "remainingTimes": 1
+ },
+ "timeToLive": {
+ "unlimited": true
+ },
+ "id": "8ec9ba06-d5df-bb01-6f18-8283f52647b5"
+ }
+]
\ No newline at end of file
diff --git a/src/test/resources/com/datadog/api/client/v2/api/given.json b/src/test/resources/com/datadog/api/client/v2/api/given.json
index 4a87b2fe4d9..d686a191cf1 100644
--- a/src/test/resources/com/datadog/api/client/v2/api/given.json
+++ b/src/test/resources/com/datadog/api/client/v2/api/given.json
@@ -11,6 +11,18 @@
"tag": "Key Management",
"operationId": "CreateAPIKey"
},
+ {
+ "parameters": [
+ {
+ "name": "body",
+ "value": "{\n \"data\": {\n \"id\": \"{{ unique }}\",\n \"attributes\": {\n \"filter\": {\n \"query\": \"source:{{ unique }}\"\n },\n \"compute\": {\n \"aggregation_type\": \"distribution\",\n \"path\": \"@duration\",\n \"include_percentiles\": false\n },\n \"group_by\": [\n {\n \"path\": \"resource_name\",\n \"tag_name\": \"resource_name\"\n }\n ]\n },\n \"type\": \"spans_metrics\"\n }\n}"
+ }
+ ],
+ "step": "there is a valid \"spans_metric\" in the system",
+ "key": "spans_metric",
+ "tag": "Spans Metrics",
+ "operationId": "CreateSpansMetric"
+ },
{
"parameters": [
{
diff --git a/src/test/resources/com/datadog/api/client/v2/api/spans_metrics.feature b/src/test/resources/com/datadog/api/client/v2/api/spans_metrics.feature
new file mode 100644
index 00000000000..c0b2e96f349
--- /dev/null
+++ b/src/test/resources/com/datadog/api/client/v2/api/spans_metrics.feature
@@ -0,0 +1,99 @@
+@endpoint(spans-metrics) @endpoint(spans-metrics-v2)
+Feature: Spans Metrics
+ Manage configuration of [span-based
+ metrics](https://app.datadoghq.com/apm/traces/generate-metrics) for your
+ organization.
+
+ Background:
+ Given a valid "apiKeyAuth" key in the system
+ And a valid "appKeyAuth" key in the system
+ And an instance of "SpansMetrics" API
+
+ @generated @skip @team:DataDog/apm
+ Scenario: Create a span-based metric returns "Bad Request" response
+ Given new "CreateSpansMetric" request
+ And body with value {"data": {"attributes": {"compute": {"aggregation_type": "distribution", "include_percentiles": false, "path": "@duration"}, "filter": {"query": "@http.status_code:200 service:my-service"}, "group_by": [{"path": "resource_name", "tag_name": "resource_name"}]}, "id": "my.metric", "type": "spans_metrics"}}
+ When the request is sent
+ Then the response status is 400 Bad Request
+
+ @generated @skip @team:DataDog/apm
+ Scenario: Create a span-based metric returns "Conflict" response
+ Given new "CreateSpansMetric" request
+ And body with value {"data": {"attributes": {"compute": {"aggregation_type": "distribution", "include_percentiles": false, "path": "@duration"}, "filter": {"query": "@http.status_code:200 service:my-service"}, "group_by": [{"path": "resource_name", "tag_name": "resource_name"}]}, "id": "my.metric", "type": "spans_metrics"}}
+ When the request is sent
+ Then the response status is 409 Conflict
+
+ @team:DataDog/apm
+ Scenario: Create a span-based metric returns "OK" response
+ Given new "CreateSpansMetric" request
+ And body with value {"data": {"attributes": {"compute": {"aggregation_type": "distribution", "include_percentiles": false, "path": "@duration"}, "filter": {"query": "@http.status_code:200 service:my-service"}, "group_by": [{"path": "resource_name", "tag_name": "resource_name"}]}, "id": "{{ unique_alnum }}", "type": "spans_metrics"}}
+ When the request is sent
+ Then the response status is 200 OK
+ And the response "data.id" has the same value as "unique_alnum"
+ And the response "data.type" is equal to "spans_metrics"
+ And the response "data.attributes.compute.aggregation_type" is equal to "distribution"
+
+ @generated @skip @team:DataDog/apm
+ Scenario: Delete a span-based metric returns "Not Found" response
+ Given new "DeleteSpansMetric" request
+ And request contains "metric_id" parameter from "REPLACE.ME"
+ When the request is sent
+ Then the response status is 404 Not Found
+
+ @team:DataDog/apm
+ Scenario: Delete a span-based metric returns "OK" response
+ Given there is a valid "spans_metric" in the system
+ And new "DeleteSpansMetric" request
+ And request contains "metric_id" parameter from "spans_metric.data.id"
+ When the request is sent
+ Then the response status is 200 OK
+
+ @generated @skip @team:DataDog/apm
+ Scenario: Get a span-based metric returns "Not Found" response
+ Given new "GetSpansMetric" request
+ And request contains "metric_id" parameter from "REPLACE.ME"
+ When the request is sent
+ Then the response status is 404 Not Found
+
+ @team:DataDog/apm
+ Scenario: Get a span-based metric returns "OK" response
+ Given there is a valid "spans_metric" in the system
+ And new "GetSpansMetric" request
+ And request contains "metric_id" parameter from "spans_metric.data.id"
+ When the request is sent
+ Then the response status is 200 OK
+ And the response "data.attributes.filter.query" has the same value as "spans_metric.data.attributes.filter.query"
+
+ @team:DataDog/apm
+ Scenario: Get all span-based metrics returns "OK" response
+ Given there is a valid "spans_metric" in the system
+ And new "ListSpansMetrics" request
+ When the request is sent
+ Then the response status is 200 OK
+ And the response "data[0].type" is equal to "spans_metrics"
+
+ @generated @skip @team:DataDog/apm
+ Scenario: Update a span-based metric returns "Bad Request" response
+ Given new "UpdateSpansMetric" request
+ And request contains "metric_id" parameter from "REPLACE.ME"
+ And body with value {"data": {"attributes": {"compute": {"include_percentiles": false}, "filter": {"query": "@http.status_code:200 service:my-service"}, "group_by": [{"path": "resource_name", "tag_name": "resource_name"}]}, "type": "spans_metrics"}}
+ When the request is sent
+ Then the response status is 400 Bad Request
+
+ @generated @skip @team:DataDog/apm
+ Scenario: Update a span-based metric returns "Not Found" response
+ Given new "UpdateSpansMetric" request
+ And request contains "metric_id" parameter from "REPLACE.ME"
+ And body with value {"data": {"attributes": {"compute": {"include_percentiles": false}, "filter": {"query": "@http.status_code:200 service:my-service"}, "group_by": [{"path": "resource_name", "tag_name": "resource_name"}]}, "type": "spans_metrics"}}
+ When the request is sent
+ Then the response status is 404 Not Found
+
+ @team:DataDog/apm
+ Scenario: Update a span-based metric returns "OK" response
+ Given there is a valid "spans_metric" in the system
+ And new "UpdateSpansMetric" request
+ And request contains "metric_id" parameter from "spans_metric.data.id"
+ And body with value {"data": {"attributes": {"compute": {"include_percentiles": false}, "filter": {"query": "{{ spans_metric.data.attributes.filter.query }}-updated"}, "group_by": [{"path": "resource_name", "tag_name": "resource_name"}]}, "type": "spans_metrics"}}
+ When the request is sent
+ Then the response status is 200 OK
+ And the response "data.attributes.filter.query" is equal to "{{ spans_metric.data.attributes.filter.query }}-updated"
diff --git a/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json
index 669283a8a2c..83c1ebef5af 100644
--- a/src/test/resources/com/datadog/api/client/v2/api/undo.json
+++ b/src/test/resources/com/datadog/api/client/v2/api/undo.json
@@ -36,6 +36,43 @@
"type": "idempotent"
}
},
+ "ListSpansMetrics": {
+ "tag": "Spans Metrics",
+ "undo": {
+ "type": "safe"
+ }
+ },
+ "CreateSpansMetric": {
+ "tag": "Spans Metrics",
+ "undo": {
+ "operationId": "DeleteSpansMetric",
+ "parameters": [
+ {
+ "name": "metric_id",
+ "source": "data.id"
+ }
+ ],
+ "type": "unsafe"
+ }
+ },
+ "DeleteSpansMetric": {
+ "tag": "Spans Metrics",
+ "undo": {
+ "type": "idempotent"
+ }
+ },
+ "GetSpansMetric": {
+ "tag": "Spans Metrics",
+ "undo": {
+ "type": "safe"
+ }
+ },
+ "UpdateSpansMetric": {
+ "tag": "Spans Metrics",
+ "undo": {
+ "type": "idempotent"
+ }
+ },
"ListApplicationKeys": {
"tag": "Key Management",
"undo": {