diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index bc16917af1e..6a079257295 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1692,6 +1692,16 @@ components: example: 1706803070 format: int64 type: integer + TraceIDPathParameter: + description: |- + The trace ID. Accepts either a 32-character hexadecimal string (128-bit trace ID) + or a decimal string of up to 39 digits. + example: "0000000000000000abc1230000000000" + in: path + name: trace_id + required: true + schema: + type: string UserID: description: "The ID of the user." in: path @@ -2085,6 +2095,126 @@ components: required: - apiTrigger type: object + APMSpanErrorFlag: + description: Error flag for a span. `1` when the span is in error, `0` otherwise. + enum: + - 0 + - 1 + example: 0 + format: int32 + type: integer + x-enum-varnames: + - NO_ERROR + - ERROR + APMTraceSpan: + description: A single APM span returned as part of a trace. + properties: + duration: + description: The duration of the span, in nanoseconds. + example: 500000000 + format: int64 + type: integer + endTime: + description: The end time of the span, in Unix nanoseconds. + example: 1716800000500000000 + format: int64 + type: integer + error: + $ref: "#/components/schemas/APMSpanErrorFlag" + meta: + additionalProperties: + type: string + description: |- + String-valued tags attached to the span. Tag keys starting with `_` are + filtered out of the response. + example: + env: production + http.method: GET + type: object + metrics: + additionalProperties: + format: double + type: number + description: |- + Numeric metrics attached to the span. Metric keys starting with `_` are + filtered out of the response. + example: + http.status_code: 200 + type: object + name: + description: The operation name of the span. + example: web.request + type: string + parentID: + description: The ID of the parent span, or `0` when the span is a trace root. + example: 0 + format: int64 + type: integer + resource: + description: The resource that the span describes. + example: GET /products + type: string + resourceHash: + description: A hash of the resource field. + example: 6a4e9b7f + type: string + restricted: + description: Whether access to the span is restricted by the organization's data access policies. + example: false + type: boolean + self_time: + description: The time spent in the span itself, excluding time spent in child spans, in nanoseconds. + example: 250000000 + format: double + type: number + service: + description: The name of the service that emitted the span. + example: web-store + type: string + spanID: + description: The span ID, as an unsigned 64-bit integer. + example: 9876543210987654321 + format: int64 + type: integer + startTime: + description: The start time of the span, in Unix nanoseconds. + example: 1716800000000000000 + format: int64 + type: integer + traceID: + description: The lower 64 bits of the trace ID, as an unsigned 64-bit integer. + example: 12345678901234567890 + format: int64 + type: integer + traceIDFull: + description: The full 128-bit trace ID, encoded as a 32-character hexadecimal string. + example: "0000000000000000abc1230000000000" + type: string + type: + description: The type of the span (for example, `web`, `db`, or `rpc`). + example: web + type: string + required: + - service + - name + - resource + - traceID + - spanID + - parentID + - startTime + - endTime + - duration + - error + - type + - meta + - metrics + - traceIDFull + type: object + APMTraceSpans: + description: The list of spans that compose the trace. + items: + $ref: "#/components/schemas/APMTraceSpan" + type: array AWSAccountConfigID: description: |- Unique Datadog ID of the AWS Account Integration Config. @@ -65918,6 +66048,60 @@ components: $ref: "#/components/schemas/Project" type: array type: object + PrunedTraceAttributes: + description: The attributes of a pruned trace returned by the Get pruned trace by ID endpoint. + properties: + is_truncated: + description: |- + Indicates whether the underlying trace was truncated because its size + exceeded the maximum that can be retrieved from storage. + example: false + type: boolean + size_bytes: + description: The size, in bytes, of the original (non-pruned) trace before summarization. + example: 12345 + format: int32 + maximum: 2147483647 + type: integer + summarized_trace: + $ref: "#/components/schemas/SummarizedTrace" + required: + - summarized_trace + - is_truncated + - size_bytes + type: object + PrunedTraceData: + description: A pruned trace resource document. + properties: + attributes: + $ref: "#/components/schemas/PrunedTraceAttributes" + id: + description: The full 128-bit trace ID, encoded as a 32-character hexadecimal string. + example: "0000000000000000abc1230000000000" + type: string + type: + $ref: "#/components/schemas/PrunedTraceType" + required: + - id + - type + - attributes + type: object + PrunedTraceResponse: + description: Response containing a single pruned trace. + properties: + data: + $ref: "#/components/schemas/PrunedTraceData" + required: + - data + type: object + PrunedTraceType: + description: The type of the pruned trace resource. The value is always `pruned_trace`. + enum: + - pruned_trace + example: pruned_trace + type: string + x-enum-varnames: + - PRUNED_TRACE PublishAppResponse: description: The response object after an app is successfully published. properties: @@ -83449,6 +83633,110 @@ components: type: string x-enum-varnames: - SUITES_SEARCH + SummarizedSpan: + description: A node in the pruned trace tree. + properties: + children: + description: The child spans of this node in the pruned tree. + example: [] + items: + $ref: "#/components/schemas/SummarizedSpan" + type: array + durationSeconds: + description: The duration of the span, in seconds. + example: 0.5 + format: double + type: number + endTime: + description: The end time of the span, in RFC3339 format. + example: "2026-05-27T12:00:00.5Z" + format: date-time + type: string + error: + $ref: "#/components/schemas/APMSpanErrorFlag" + hidden_child_spans_count: + description: The number of child spans that were pruned from this node when summarizing the trace. + example: 0 + format: int32 + maximum: 2147483647 + type: integer + meta: + additionalProperties: + type: string + description: String-valued tags attached to the span. + example: + env: production + type: object + metrics: + additionalProperties: + format: double + type: number + description: Numeric metrics attached to the span. + example: + http.status_code: 200 + type: object + name: + description: The operation name of the span. + example: web.request + type: string + parentID: + description: The ID of the parent span, or `0` when the span is the trace root. + example: 0 + format: int64 + type: integer + resource: + description: The resource that the span describes. + example: GET /products + type: string + service: + description: The name of the service that emitted the span. + example: web-store + type: string + spanID: + description: The span ID, as an unsigned 64-bit integer. + example: 9876543210987654321 + format: int64 + type: integer + span_kind: + description: |- + The OpenTelemetry span kind, for example `INTERNAL`, `SERVER`, `CLIENT`, + `PRODUCER`, or `CONSUMER`. + example: SERVER + type: string + startTime: + description: The start time of the span, in RFC3339 format. + example: "2026-05-27T12:00:00Z" + format: date-time + type: string + required: + - service + - name + - resource + - parentID + - spanID + - startTime + - endTime + - durationSeconds + - error + - meta + - metrics + - span_kind + - hidden_child_spans_count + - children + type: object + SummarizedTrace: + description: A summarized, hierarchical view of a trace. + properties: + root: + $ref: "#/components/schemas/SummarizedSpan" + traceId: + description: The full 128-bit trace ID, encoded as a 32-character hexadecimal string. + example: "0000000000000000abc1230000000000" + type: string + required: + - traceId + - root + type: object SuppressionVersionHistory: description: Response object containing the version history of a suppression. properties: @@ -90629,6 +90917,51 @@ components: type: string x-enum-varnames: - SECRET + TraceAttributes: + description: The attributes of a trace returned by the Get trace by ID endpoint. + properties: + is_truncated: + description: Indicates whether the trace was truncated because its size exceeded the maximum response payload. + example: false + type: boolean + spans: + $ref: "#/components/schemas/APMTraceSpans" + required: + - is_truncated + - spans + type: object + TraceData: + description: A trace resource document. + properties: + attributes: + $ref: "#/components/schemas/TraceAttributes" + id: + description: The full 128-bit trace ID, encoded as a 32-character hexadecimal string. + example: "0000000000000000abc1230000000000" + type: string + type: + $ref: "#/components/schemas/TraceType" + required: + - id + - type + - attributes + type: object + TraceResponse: + description: Response containing a single trace. + properties: + data: + $ref: "#/components/schemas/TraceData" + required: + - data + type: object + TraceType: + description: The type of the trace resource. The value is always `trace`. + enum: + - trace + example: trace + type: string + x-enum-varnames: + - TRACE Trigger: description: "One of the triggers that can start the execution of a workflow." oneOf: @@ -141040,6 +141373,159 @@ paths: tags: - Rum Audience Management x-unstable: "**Note**: This endpoint may be subject to changes." + /api/v2/pruned_trace/{trace_id}: + get: + description: |- + Retrieve a pruned, hierarchical view of an APM trace by its trace ID. + The trace is summarized as a tree of spans rooted at the trace root and reduced in size + to keep rendering large traces in the UI practical. + This endpoint is rate limited to `60` requests per minute per organization. + operationId: GetPrunedTraceByID + parameters: + - $ref: "#/components/parameters/TraceIDPathParameter" + - description: |- + Span ID to expand and preserve in the pruned tree even when its branch would + normally be summarized. + example: 9876543210987654321 + in: query + name: expand_span_id + required: false + schema: + format: int64 + type: integer + - description: |- + Optional Unix time hint, in seconds, used to optimize the lookup of the trace + in long-term storage. + example: 1716800000 + in: query + name: time_hint + required: false + schema: + format: int32 + maximum: 2147483647 + type: integer + - description: |- + Force the trace to be loaded from a specific source. When unset, the API picks + the source automatically. + example: driveline + in: query + name: force_source + required: false + schema: + type: string + - description: |- + Restrict the pruned tree to spans matching the given `key:value` pairs. + Values may be passed as repeated query parameters. + example: + - service:web-store + in: query + name: include_path + required: false + schema: + items: + type: string + type: array + - description: |- + Regex patterns of tag keys whose values must be included in the pruned spans. + Values may be passed as repeated query parameters. + example: + - "^http\\." + in: query + name: tag_include + required: false + schema: + items: + type: string + type: array + - description: |- + Regex patterns of tag keys whose values must be excluded from the pruned spans. + Values may be passed as repeated query parameters. + example: + - "^_dd\\." + in: query + name: tag_exclude + required: false + schema: + items: + type: string + type: array + - description: When set to `true`, only service entry spans are included in the pruned tree. + example: false + in: query + name: only_service_entry_spans + required: false + schema: + type: boolean + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + is_truncated: false + size_bytes: 12345 + summarized_trace: + root: + children: [] + durationSeconds: 0.5 + endTime: "2026-05-27T12:00:00.5Z" + error: 0 + hidden_child_spans_count: 0 + meta: + env: production + metrics: + http.status_code: 200 + name: web.request + parentID: 0 + resource: GET /products + service: web-store + spanID: 9876543210987654321 + span_kind: SERVER + startTime: "2026-05-27T12:00:00Z" + traceId: "0000000000000000abc1230000000000" + id: "0000000000000000abc1230000000000" + type: pruned_trace + schema: + $ref: "#/components/schemas/PrunedTraceResponse" + description: OK + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + "504": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Gateway Timeout + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - apm_read + summary: Get a pruned trace by ID + tags: + - APM Trace + x-permission: + operator: OR + permissions: + - apm_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/query/scalar: post: description: |- @@ -165634,6 +166120,96 @@ paths: operator: OR permissions: - test_optimization_read + /api/v2/trace/{trace_id}: + get: + description: |- + Retrieve a full APM trace by its trace ID, including every span in the trace. + Traces are returned from live storage when available and fall back to longer-term storage. + This endpoint is rate limited to `60` requests per minute per organization. + operationId: GetTraceByID + parameters: + - $ref: "#/components/parameters/TraceIDPathParameter" + - description: |- + List of span fields to include in the response. When omitted, every available field is returned. + Values may be passed as repeated query parameters or as a single comma-separated value. + example: + - service + - resource_name + in: query + name: include_fields + required: false + schema: + items: + type: string + type: array + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + is_truncated: false + spans: + - duration: 500000000 + endTime: 1716800000500000000 + error: 0 + meta: + env: production + http.method: GET + metrics: + http.status_code: 200 + name: web.request + parentID: 0 + resource: GET /products + service: web-store + spanID: 9876543210987654321 + startTime: 1716800000000000000 + traceID: 12345678901234567890 + traceIDFull: 0000000000000000abc1230000000000 + type: web + id: "0000000000000000abc1230000000000" + type: trace + schema: + $ref: "#/components/schemas/TraceResponse" + description: OK + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "413": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Payload Too Large + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - apm_read + summary: Get a trace by ID + tags: + - APM Trace + x-permission: + operator: OR + permissions: + - apm_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/usage/application_security: get: deprecated: true @@ -168360,6 +168936,8 @@ tags: description: Find out more at url: https://docs.datadoghq.com/tracing/trace_pipeline/trace_retention/ name: APM Retention Filters + - description: Retrieve full or pruned APM traces by trace ID. + name: APM Trace - description: |- Configure your Datadog-AWS integration directly through the Datadog API. For more information, see the [AWS integration page](https://docs.datadoghq.com/integrations/amazon_web_services). diff --git a/examples/v2/apm-trace/GetPrunedTraceByID.java b/examples/v2/apm-trace/GetPrunedTraceByID.java new file mode 100644 index 00000000000..5cc1103f1ab --- /dev/null +++ b/examples/v2/apm-trace/GetPrunedTraceByID.java @@ -0,0 +1,26 @@ +// Get a pruned trace by ID returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.ApmTraceApi; +import com.datadog.api.client.v2.model.PrunedTraceResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getPrunedTraceByID", true); + ApmTraceApi apiInstance = new ApmTraceApi(defaultClient); + + try { + PrunedTraceResponse result = + apiInstance.getPrunedTraceByID("0000000000000000abc1230000000000"); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ApmTraceApi#getPrunedTraceByID"); + 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/apm-trace/GetTraceByID.java b/examples/v2/apm-trace/GetTraceByID.java new file mode 100644 index 00000000000..b4285d39ec4 --- /dev/null +++ b/examples/v2/apm-trace/GetTraceByID.java @@ -0,0 +1,25 @@ +// Get a trace by ID returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.ApmTraceApi; +import com.datadog.api.client.v2.model.TraceResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getTraceByID", true); + ApmTraceApi apiInstance = new ApmTraceApi(defaultClient); + + try { + TraceResponse result = apiInstance.getTraceByID("0000000000000000abc1230000000000"); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ApmTraceApi#getTraceByID"); + 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/ApiClient.java b/src/main/java/com/datadog/api/client/ApiClient.java index 98cec9dd248..9008a3f3900 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -1121,6 +1121,8 @@ public class ApiClient { put("v2.queryEventFilteredUsers", false); put("v2.queryUsers", false); put("v2.updateConnection", false); + put("v2.getPrunedTraceByID", false); + put("v2.getTraceByID", false); put("v2.createScorecardOutcomesBatch", false); put("v2.listEntityRiskScores", false); put("v2.createIncidentService", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/ApmTraceApi.java b/src/main/java/com/datadog/api/client/v2/api/ApmTraceApi.java new file mode 100644 index 00000000000..82e12e56001 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/ApmTraceApi.java @@ -0,0 +1,599 @@ +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.PrunedTraceResponse; +import com.datadog.api.client.v2.model.TraceResponse; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.core.GenericType; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +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 ApmTraceApi { + private ApiClient apiClient; + + public ApmTraceApi() { + this(ApiClient.getDefaultApiClient()); + } + + public ApmTraceApi(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; + } + + /** Manage optional parameters to getPrunedTraceByID. */ + public static class GetPrunedTraceByIDOptionalParameters { + private Long expandSpanId; + private Integer timeHint; + private String forceSource; + private List includePath; + private List tagInclude; + private List tagExclude; + private Boolean onlyServiceEntrySpans; + + /** + * Set expandSpanId. + * + * @param expandSpanId Span ID to expand and preserve in the pruned tree even when its branch + * would normally be summarized. (optional) + * @return GetPrunedTraceByIDOptionalParameters + */ + public GetPrunedTraceByIDOptionalParameters expandSpanId(Long expandSpanId) { + this.expandSpanId = expandSpanId; + return this; + } + + /** + * Set timeHint. + * + * @param timeHint Optional Unix time hint, in seconds, used to optimize the lookup of the trace + * in long-term storage. (optional) + * @return GetPrunedTraceByIDOptionalParameters + */ + public GetPrunedTraceByIDOptionalParameters timeHint(Integer timeHint) { + this.timeHint = timeHint; + return this; + } + + /** + * Set forceSource. + * + * @param forceSource Force the trace to be loaded from a specific source. When unset, the API + * picks the source automatically. (optional) + * @return GetPrunedTraceByIDOptionalParameters + */ + public GetPrunedTraceByIDOptionalParameters forceSource(String forceSource) { + this.forceSource = forceSource; + return this; + } + + /** + * Set includePath. + * + * @param includePath Restrict the pruned tree to spans matching the given key:value + * pairs. Values may be passed as repeated query parameters. (optional) + * @return GetPrunedTraceByIDOptionalParameters + */ + public GetPrunedTraceByIDOptionalParameters includePath(List includePath) { + this.includePath = includePath; + return this; + } + + /** + * Set tagInclude. + * + * @param tagInclude Regex patterns of tag keys whose values must be included in the pruned + * spans. Values may be passed as repeated query parameters. (optional) + * @return GetPrunedTraceByIDOptionalParameters + */ + public GetPrunedTraceByIDOptionalParameters tagInclude(List tagInclude) { + this.tagInclude = tagInclude; + return this; + } + + /** + * Set tagExclude. + * + * @param tagExclude Regex patterns of tag keys whose values must be excluded from the pruned + * spans. Values may be passed as repeated query parameters. (optional) + * @return GetPrunedTraceByIDOptionalParameters + */ + public GetPrunedTraceByIDOptionalParameters tagExclude(List tagExclude) { + this.tagExclude = tagExclude; + return this; + } + + /** + * Set onlyServiceEntrySpans. + * + * @param onlyServiceEntrySpans When set to true, only service entry spans are + * included in the pruned tree. (optional) + * @return GetPrunedTraceByIDOptionalParameters + */ + public GetPrunedTraceByIDOptionalParameters onlyServiceEntrySpans( + Boolean onlyServiceEntrySpans) { + this.onlyServiceEntrySpans = onlyServiceEntrySpans; + return this; + } + } + + /** + * Get a pruned trace by ID. + * + *

See {@link #getPrunedTraceByIDWithHttpInfo}. + * + * @param traceId The trace ID. Accepts either a 32-character hexadecimal string (128-bit trace + * ID) or a decimal string of up to 39 digits. (required) + * @return PrunedTraceResponse + * @throws ApiException if fails to make API call + */ + public PrunedTraceResponse getPrunedTraceByID(String traceId) throws ApiException { + return getPrunedTraceByIDWithHttpInfo(traceId, new GetPrunedTraceByIDOptionalParameters()) + .getData(); + } + + /** + * Get a pruned trace by ID. + * + *

See {@link #getPrunedTraceByIDWithHttpInfoAsync}. + * + * @param traceId The trace ID. Accepts either a 32-character hexadecimal string (128-bit trace + * ID) or a decimal string of up to 39 digits. (required) + * @return CompletableFuture<PrunedTraceResponse> + */ + public CompletableFuture getPrunedTraceByIDAsync(String traceId) { + return getPrunedTraceByIDWithHttpInfoAsync(traceId, new GetPrunedTraceByIDOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get a pruned trace by ID. + * + *

See {@link #getPrunedTraceByIDWithHttpInfo}. + * + * @param traceId The trace ID. Accepts either a 32-character hexadecimal string (128-bit trace + * ID) or a decimal string of up to 39 digits. (required) + * @param parameters Optional parameters for the request. + * @return PrunedTraceResponse + * @throws ApiException if fails to make API call + */ + public PrunedTraceResponse getPrunedTraceByID( + String traceId, GetPrunedTraceByIDOptionalParameters parameters) throws ApiException { + return getPrunedTraceByIDWithHttpInfo(traceId, parameters).getData(); + } + + /** + * Get a pruned trace by ID. + * + *

See {@link #getPrunedTraceByIDWithHttpInfoAsync}. + * + * @param traceId The trace ID. Accepts either a 32-character hexadecimal string (128-bit trace + * ID) or a decimal string of up to 39 digits. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<PrunedTraceResponse> + */ + public CompletableFuture getPrunedTraceByIDAsync( + String traceId, GetPrunedTraceByIDOptionalParameters parameters) { + return getPrunedTraceByIDWithHttpInfoAsync(traceId, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Retrieve a pruned, hierarchical view of an APM trace by its trace ID. The trace is summarized + * as a tree of spans rooted at the trace root and reduced in size to keep rendering large traces + * in the UI practical. This endpoint is rate limited to 60 requests per minute per + * organization. + * + * @param traceId The trace ID. Accepts either a 32-character hexadecimal string (128-bit trace + * ID) or a decimal string of up to 39 digits. (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<PrunedTraceResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
429 Too many requests -
504 Gateway Timeout -
+ */ + public ApiResponse getPrunedTraceByIDWithHttpInfo( + String traceId, GetPrunedTraceByIDOptionalParameters parameters) throws ApiException { + // Check if unstable operation is enabled + String operationId = "getPrunedTraceByID"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'traceId' is set + if (traceId == null) { + throw new ApiException( + 400, "Missing the required parameter 'traceId' when calling getPrunedTraceByID"); + } + Long expandSpanId = parameters.expandSpanId; + Integer timeHint = parameters.timeHint; + String forceSource = parameters.forceSource; + List includePath = parameters.includePath; + List tagInclude = parameters.tagInclude; + List tagExclude = parameters.tagExclude; + Boolean onlyServiceEntrySpans = parameters.onlyServiceEntrySpans; + // create path and map variables + String localVarPath = + "/api/v2/pruned_trace/{trace_id}" + .replaceAll("\\{" + "trace_id" + "\\}", apiClient.escapeString(traceId.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "expand_span_id", expandSpanId)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "time_hint", timeHint)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "force_source", forceSource)); + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "include_path", includePath)); + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "tag_include", tagInclude)); + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "tag_exclude", tagExclude)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "only_service_entry_spans", onlyServiceEntrySpans)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.ApmTraceApi.getPrunedTraceByID", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get a pruned trace by ID. + * + *

See {@link #getPrunedTraceByIDWithHttpInfo}. + * + * @param traceId The trace ID. Accepts either a 32-character hexadecimal string (128-bit trace + * ID) or a decimal string of up to 39 digits. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<PrunedTraceResponse>> + */ + public CompletableFuture> getPrunedTraceByIDWithHttpInfoAsync( + String traceId, GetPrunedTraceByIDOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "getPrunedTraceByID"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'traceId' is set + if (traceId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'traceId' when calling getPrunedTraceByID")); + return result; + } + Long expandSpanId = parameters.expandSpanId; + Integer timeHint = parameters.timeHint; + String forceSource = parameters.forceSource; + List includePath = parameters.includePath; + List tagInclude = parameters.tagInclude; + List tagExclude = parameters.tagExclude; + Boolean onlyServiceEntrySpans = parameters.onlyServiceEntrySpans; + // create path and map variables + String localVarPath = + "/api/v2/pruned_trace/{trace_id}" + .replaceAll("\\{" + "trace_id" + "\\}", apiClient.escapeString(traceId.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "expand_span_id", expandSpanId)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "time_hint", timeHint)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "force_source", forceSource)); + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "include_path", includePath)); + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "tag_include", tagInclude)); + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "tag_exclude", tagExclude)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "only_service_entry_spans", onlyServiceEntrySpans)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.ApmTraceApi.getPrunedTraceByID", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } 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() {}); + } + + /** Manage optional parameters to getTraceByID. */ + public static class GetTraceByIDOptionalParameters { + private List includeFields; + + /** + * Set includeFields. + * + * @param includeFields List of span fields to include in the response. When omitted, every + * available field is returned. Values may be passed as repeated query parameters or as a + * single comma-separated value. (optional) + * @return GetTraceByIDOptionalParameters + */ + public GetTraceByIDOptionalParameters includeFields(List includeFields) { + this.includeFields = includeFields; + return this; + } + } + + /** + * Get a trace by ID. + * + *

See {@link #getTraceByIDWithHttpInfo}. + * + * @param traceId The trace ID. Accepts either a 32-character hexadecimal string (128-bit trace + * ID) or a decimal string of up to 39 digits. (required) + * @return TraceResponse + * @throws ApiException if fails to make API call + */ + public TraceResponse getTraceByID(String traceId) throws ApiException { + return getTraceByIDWithHttpInfo(traceId, new GetTraceByIDOptionalParameters()).getData(); + } + + /** + * Get a trace by ID. + * + *

See {@link #getTraceByIDWithHttpInfoAsync}. + * + * @param traceId The trace ID. Accepts either a 32-character hexadecimal string (128-bit trace + * ID) or a decimal string of up to 39 digits. (required) + * @return CompletableFuture<TraceResponse> + */ + public CompletableFuture getTraceByIDAsync(String traceId) { + return getTraceByIDWithHttpInfoAsync(traceId, new GetTraceByIDOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get a trace by ID. + * + *

See {@link #getTraceByIDWithHttpInfo}. + * + * @param traceId The trace ID. Accepts either a 32-character hexadecimal string (128-bit trace + * ID) or a decimal string of up to 39 digits. (required) + * @param parameters Optional parameters for the request. + * @return TraceResponse + * @throws ApiException if fails to make API call + */ + public TraceResponse getTraceByID(String traceId, GetTraceByIDOptionalParameters parameters) + throws ApiException { + return getTraceByIDWithHttpInfo(traceId, parameters).getData(); + } + + /** + * Get a trace by ID. + * + *

See {@link #getTraceByIDWithHttpInfoAsync}. + * + * @param traceId The trace ID. Accepts either a 32-character hexadecimal string (128-bit trace + * ID) or a decimal string of up to 39 digits. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<TraceResponse> + */ + public CompletableFuture getTraceByIDAsync( + String traceId, GetTraceByIDOptionalParameters parameters) { + return getTraceByIDWithHttpInfoAsync(traceId, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Retrieve a full APM trace by its trace ID, including every span in the trace. Traces are + * returned from live storage when available and fall back to longer-term storage. This endpoint + * is rate limited to 60 requests per minute per organization. + * + * @param traceId The trace ID. Accepts either a 32-character hexadecimal string (128-bit trace + * ID) or a decimal string of up to 39 digits. (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<TraceResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
413 Payload Too Large -
429 Too many requests -
+ */ + public ApiResponse getTraceByIDWithHttpInfo( + String traceId, GetTraceByIDOptionalParameters parameters) throws ApiException { + // Check if unstable operation is enabled + String operationId = "getTraceByID"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'traceId' is set + if (traceId == null) { + throw new ApiException( + 400, "Missing the required parameter 'traceId' when calling getTraceByID"); + } + List includeFields = parameters.includeFields; + // create path and map variables + String localVarPath = + "/api/v2/trace/{trace_id}" + .replaceAll("\\{" + "trace_id" + "\\}", apiClient.escapeString(traceId.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll( + apiClient.parameterToPairs("multi", "include_fields", includeFields)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.ApmTraceApi.getTraceByID", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get a trace by ID. + * + *

See {@link #getTraceByIDWithHttpInfo}. + * + * @param traceId The trace ID. Accepts either a 32-character hexadecimal string (128-bit trace + * ID) or a decimal string of up to 39 digits. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<TraceResponse>> + */ + public CompletableFuture> getTraceByIDWithHttpInfoAsync( + String traceId, GetTraceByIDOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "getTraceByID"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'traceId' is set + if (traceId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'traceId' when calling getTraceByID")); + return result; + } + List includeFields = parameters.includeFields; + // create path and map variables + String localVarPath = + "/api/v2/trace/{trace_id}" + .replaceAll("\\{" + "trace_id" + "\\}", apiClient.escapeString(traceId.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll( + apiClient.parameterToPairs("multi", "include_fields", includeFields)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.ApmTraceApi.getTraceByID", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } 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() {}); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/APMSpanErrorFlag.java b/src/main/java/com/datadog/api/client/v2/model/APMSpanErrorFlag.java new file mode 100644 index 00000000000..df4e0f4843c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/APMSpanErrorFlag.java @@ -0,0 +1,54 @@ +/* + * 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.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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.Set; + +/** Error flag for a span. 1 when the span is in error, 0 otherwise. */ +@JsonSerialize(using = APMSpanErrorFlag.APMSpanErrorFlagSerializer.class) +public class APMSpanErrorFlag extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList(0, 1)); + + public static final APMSpanErrorFlag NO_ERROR = new APMSpanErrorFlag(0); + public static final APMSpanErrorFlag ERROR = new APMSpanErrorFlag(1); + + APMSpanErrorFlag(Integer value) { + super(value, allowedValues); + } + + public static class APMSpanErrorFlagSerializer extends StdSerializer { + public APMSpanErrorFlagSerializer(Class t) { + super(t); + } + + public APMSpanErrorFlagSerializer() { + this(null); + } + + @Override + public void serialize(APMSpanErrorFlag value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static APMSpanErrorFlag fromValue(Integer value) { + return new APMSpanErrorFlag(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/APMTraceSpan.java b/src/main/java/com/datadog/api/client/v2/model/APMTraceSpan.java new file mode 100644 index 00000000000..77100765bfb --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/APMTraceSpan.java @@ -0,0 +1,625 @@ +/* + * 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.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A single APM span returned as part of a trace. */ +@JsonPropertyOrder({ + APMTraceSpan.JSON_PROPERTY_DURATION, + APMTraceSpan.JSON_PROPERTY_END_TIME, + APMTraceSpan.JSON_PROPERTY_ERROR, + APMTraceSpan.JSON_PROPERTY_META, + APMTraceSpan.JSON_PROPERTY_METRICS, + APMTraceSpan.JSON_PROPERTY_NAME, + APMTraceSpan.JSON_PROPERTY_PARENT_ID, + APMTraceSpan.JSON_PROPERTY_RESOURCE, + APMTraceSpan.JSON_PROPERTY_RESOURCE_HASH, + APMTraceSpan.JSON_PROPERTY_RESTRICTED, + APMTraceSpan.JSON_PROPERTY_SELF_TIME, + APMTraceSpan.JSON_PROPERTY_SERVICE, + APMTraceSpan.JSON_PROPERTY_SPAN_ID, + APMTraceSpan.JSON_PROPERTY_START_TIME, + APMTraceSpan.JSON_PROPERTY_TRACE_ID, + APMTraceSpan.JSON_PROPERTY_TRACE_ID_FULL, + APMTraceSpan.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class APMTraceSpan { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DURATION = "duration"; + private Long duration; + + public static final String JSON_PROPERTY_END_TIME = "endTime"; + private Long endTime; + + public static final String JSON_PROPERTY_ERROR = "error"; + private APMSpanErrorFlag error; + + public static final String JSON_PROPERTY_META = "meta"; + private Map meta = new HashMap(); + + public static final String JSON_PROPERTY_METRICS = "metrics"; + private Map metrics = new HashMap(); + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_PARENT_ID = "parentID"; + private Long parentId; + + public static final String JSON_PROPERTY_RESOURCE = "resource"; + private String resource; + + public static final String JSON_PROPERTY_RESOURCE_HASH = "resourceHash"; + private String resourceHash; + + public static final String JSON_PROPERTY_RESTRICTED = "restricted"; + private Boolean restricted; + + public static final String JSON_PROPERTY_SELF_TIME = "self_time"; + private Double selfTime; + + public static final String JSON_PROPERTY_SERVICE = "service"; + private String service; + + public static final String JSON_PROPERTY_SPAN_ID = "spanID"; + private Long spanId; + + public static final String JSON_PROPERTY_START_TIME = "startTime"; + private Long startTime; + + public static final String JSON_PROPERTY_TRACE_ID = "traceID"; + private Long traceId; + + public static final String JSON_PROPERTY_TRACE_ID_FULL = "traceIDFull"; + private String traceIdFull; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public APMTraceSpan() {} + + @JsonCreator + public APMTraceSpan( + @JsonProperty(required = true, value = JSON_PROPERTY_DURATION) Long duration, + @JsonProperty(required = true, value = JSON_PROPERTY_END_TIME) Long endTime, + @JsonProperty(required = true, value = JSON_PROPERTY_ERROR) APMSpanErrorFlag error, + @JsonProperty(required = true, value = JSON_PROPERTY_META) Map meta, + @JsonProperty(required = true, value = JSON_PROPERTY_METRICS) Map metrics, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_PARENT_ID) Long parentId, + @JsonProperty(required = true, value = JSON_PROPERTY_RESOURCE) String resource, + @JsonProperty(required = true, value = JSON_PROPERTY_SERVICE) String service, + @JsonProperty(required = true, value = JSON_PROPERTY_SPAN_ID) Long spanId, + @JsonProperty(required = true, value = JSON_PROPERTY_START_TIME) Long startTime, + @JsonProperty(required = true, value = JSON_PROPERTY_TRACE_ID) Long traceId, + @JsonProperty(required = true, value = JSON_PROPERTY_TRACE_ID_FULL) String traceIdFull, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) String type) { + this.duration = duration; + this.endTime = endTime; + this.error = error; + this.unparsed |= !error.isValid(); + this.meta = meta; + this.metrics = metrics; + this.name = name; + this.parentId = parentId; + this.resource = resource; + this.service = service; + this.spanId = spanId; + this.startTime = startTime; + this.traceId = traceId; + this.traceIdFull = traceIdFull; + this.type = type; + } + + public APMTraceSpan duration(Long duration) { + this.duration = duration; + return this; + } + + /** + * The duration of the span, in nanoseconds. + * + * @return duration + */ + @JsonProperty(JSON_PROPERTY_DURATION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getDuration() { + return duration; + } + + public void setDuration(Long duration) { + this.duration = duration; + } + + public APMTraceSpan endTime(Long endTime) { + this.endTime = endTime; + return this; + } + + /** + * The end time of the span, in Unix nanoseconds. + * + * @return endTime + */ + @JsonProperty(JSON_PROPERTY_END_TIME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getEndTime() { + return endTime; + } + + public void setEndTime(Long endTime) { + this.endTime = endTime; + } + + public APMTraceSpan error(APMSpanErrorFlag error) { + this.error = error; + this.unparsed |= !error.isValid(); + return this; + } + + /** + * Error flag for a span. 1 when the span is in error, 0 otherwise. + * + * @return error + */ + @JsonProperty(JSON_PROPERTY_ERROR) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public APMSpanErrorFlag getError() { + return error; + } + + public void setError(APMSpanErrorFlag error) { + if (!error.isValid()) { + this.unparsed = true; + } + this.error = error; + } + + public APMTraceSpan meta(Map meta) { + this.meta = meta; + return this; + } + + public APMTraceSpan putMetaItem(String key, String metaItem) { + this.meta.put(key, metaItem); + return this; + } + + /** + * String-valued tags attached to the span. Tag keys starting with _ are filtered out + * of the response. + * + * @return meta + */ + @JsonProperty(JSON_PROPERTY_META) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Map getMeta() { + return meta; + } + + public void setMeta(Map meta) { + this.meta = meta; + } + + public APMTraceSpan metrics(Map metrics) { + this.metrics = metrics; + return this; + } + + public APMTraceSpan putMetricsItem(String key, Double metricsItem) { + this.metrics.put(key, metricsItem); + return this; + } + + /** + * Numeric metrics attached to the span. Metric keys starting with _ are filtered out + * of the response. + * + * @return metrics + */ + @JsonProperty(JSON_PROPERTY_METRICS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Map getMetrics() { + return metrics; + } + + public void setMetrics(Map metrics) { + this.metrics = metrics; + } + + public APMTraceSpan name(String name) { + this.name = name; + return this; + } + + /** + * The operation name of the span. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public APMTraceSpan parentId(Long parentId) { + this.parentId = parentId; + return this; + } + + /** + * The ID of the parent span, or 0 when the span is a trace root. + * + * @return parentId + */ + @JsonProperty(JSON_PROPERTY_PARENT_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getParentId() { + return parentId; + } + + public void setParentId(Long parentId) { + this.parentId = parentId; + } + + public APMTraceSpan resource(String resource) { + this.resource = resource; + return this; + } + + /** + * The resource that the span describes. + * + * @return resource + */ + @JsonProperty(JSON_PROPERTY_RESOURCE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getResource() { + return resource; + } + + public void setResource(String resource) { + this.resource = resource; + } + + public APMTraceSpan resourceHash(String resourceHash) { + this.resourceHash = resourceHash; + return this; + } + + /** + * A hash of the resource field. + * + * @return resourceHash + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RESOURCE_HASH) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getResourceHash() { + return resourceHash; + } + + public void setResourceHash(String resourceHash) { + this.resourceHash = resourceHash; + } + + public APMTraceSpan restricted(Boolean restricted) { + this.restricted = restricted; + return this; + } + + /** + * Whether access to the span is restricted by the organization's data access policies. + * + * @return restricted + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RESTRICTED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getRestricted() { + return restricted; + } + + public void setRestricted(Boolean restricted) { + this.restricted = restricted; + } + + public APMTraceSpan selfTime(Double selfTime) { + this.selfTime = selfTime; + return this; + } + + /** + * The time spent in the span itself, excluding time spent in child spans, in nanoseconds. + * + * @return selfTime + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SELF_TIME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Double getSelfTime() { + return selfTime; + } + + public void setSelfTime(Double selfTime) { + this.selfTime = selfTime; + } + + public APMTraceSpan service(String service) { + this.service = service; + return this; + } + + /** + * The name of the service that emitted the span. + * + * @return service + */ + @JsonProperty(JSON_PROPERTY_SERVICE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getService() { + return service; + } + + public void setService(String service) { + this.service = service; + } + + public APMTraceSpan spanId(Long spanId) { + this.spanId = spanId; + return this; + } + + /** + * The span ID, as an unsigned 64-bit integer. + * + * @return spanId + */ + @JsonProperty(JSON_PROPERTY_SPAN_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getSpanId() { + return spanId; + } + + public void setSpanId(Long spanId) { + this.spanId = spanId; + } + + public APMTraceSpan startTime(Long startTime) { + this.startTime = startTime; + return this; + } + + /** + * The start time of the span, in Unix nanoseconds. + * + * @return startTime + */ + @JsonProperty(JSON_PROPERTY_START_TIME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getStartTime() { + return startTime; + } + + public void setStartTime(Long startTime) { + this.startTime = startTime; + } + + public APMTraceSpan traceId(Long traceId) { + this.traceId = traceId; + return this; + } + + /** + * The lower 64 bits of the trace ID, as an unsigned 64-bit integer. + * + * @return traceId + */ + @JsonProperty(JSON_PROPERTY_TRACE_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getTraceId() { + return traceId; + } + + public void setTraceId(Long traceId) { + this.traceId = traceId; + } + + public APMTraceSpan traceIdFull(String traceIdFull) { + this.traceIdFull = traceIdFull; + return this; + } + + /** + * The full 128-bit trace ID, encoded as a 32-character hexadecimal string. + * + * @return traceIdFull + */ + @JsonProperty(JSON_PROPERTY_TRACE_ID_FULL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTraceIdFull() { + return traceIdFull; + } + + public void setTraceIdFull(String traceIdFull) { + this.traceIdFull = traceIdFull; + } + + public APMTraceSpan type(String type) { + this.type = type; + return this; + } + + /** + * The type of the span (for example, web, db, or rpc). + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return APMTraceSpan + */ + @JsonAnySetter + public APMTraceSpan putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this APMTraceSpan object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + APMTraceSpan apmTraceSpan = (APMTraceSpan) o; + return Objects.equals(this.duration, apmTraceSpan.duration) + && Objects.equals(this.endTime, apmTraceSpan.endTime) + && Objects.equals(this.error, apmTraceSpan.error) + && Objects.equals(this.meta, apmTraceSpan.meta) + && Objects.equals(this.metrics, apmTraceSpan.metrics) + && Objects.equals(this.name, apmTraceSpan.name) + && Objects.equals(this.parentId, apmTraceSpan.parentId) + && Objects.equals(this.resource, apmTraceSpan.resource) + && Objects.equals(this.resourceHash, apmTraceSpan.resourceHash) + && Objects.equals(this.restricted, apmTraceSpan.restricted) + && Objects.equals(this.selfTime, apmTraceSpan.selfTime) + && Objects.equals(this.service, apmTraceSpan.service) + && Objects.equals(this.spanId, apmTraceSpan.spanId) + && Objects.equals(this.startTime, apmTraceSpan.startTime) + && Objects.equals(this.traceId, apmTraceSpan.traceId) + && Objects.equals(this.traceIdFull, apmTraceSpan.traceIdFull) + && Objects.equals(this.type, apmTraceSpan.type) + && Objects.equals(this.additionalProperties, apmTraceSpan.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + duration, + endTime, + error, + meta, + metrics, + name, + parentId, + resource, + resourceHash, + restricted, + selfTime, + service, + spanId, + startTime, + traceId, + traceIdFull, + type, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class APMTraceSpan {\n"); + sb.append(" duration: ").append(toIndentedString(duration)).append("\n"); + sb.append(" endTime: ").append(toIndentedString(endTime)).append("\n"); + sb.append(" error: ").append(toIndentedString(error)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append(" metrics: ").append(toIndentedString(metrics)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" parentId: ").append(toIndentedString(parentId)).append("\n"); + sb.append(" resource: ").append(toIndentedString(resource)).append("\n"); + sb.append(" resourceHash: ").append(toIndentedString(resourceHash)).append("\n"); + sb.append(" restricted: ").append(toIndentedString(restricted)).append("\n"); + sb.append(" selfTime: ").append(toIndentedString(selfTime)).append("\n"); + sb.append(" service: ").append(toIndentedString(service)).append("\n"); + sb.append(" spanId: ").append(toIndentedString(spanId)).append("\n"); + sb.append(" startTime: ").append(toIndentedString(startTime)).append("\n"); + sb.append(" traceId: ").append(toIndentedString(traceId)).append("\n"); + sb.append(" traceIdFull: ").append(toIndentedString(traceIdFull)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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/PrunedTraceAttributes.java b/src/main/java/com/datadog/api/client/v2/model/PrunedTraceAttributes.java new file mode 100644 index 00000000000..3fb0f48fd1f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/PrunedTraceAttributes.java @@ -0,0 +1,206 @@ +/* + * 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.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The attributes of a pruned trace returned by the Get pruned trace by ID endpoint. */ +@JsonPropertyOrder({ + PrunedTraceAttributes.JSON_PROPERTY_IS_TRUNCATED, + PrunedTraceAttributes.JSON_PROPERTY_SIZE_BYTES, + PrunedTraceAttributes.JSON_PROPERTY_SUMMARIZED_TRACE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class PrunedTraceAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_IS_TRUNCATED = "is_truncated"; + private Boolean isTruncated; + + public static final String JSON_PROPERTY_SIZE_BYTES = "size_bytes"; + private Integer sizeBytes; + + public static final String JSON_PROPERTY_SUMMARIZED_TRACE = "summarized_trace"; + private SummarizedTrace summarizedTrace; + + public PrunedTraceAttributes() {} + + @JsonCreator + public PrunedTraceAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_IS_TRUNCATED) Boolean isTruncated, + @JsonProperty(required = true, value = JSON_PROPERTY_SIZE_BYTES) Integer sizeBytes, + @JsonProperty(required = true, value = JSON_PROPERTY_SUMMARIZED_TRACE) + SummarizedTrace summarizedTrace) { + this.isTruncated = isTruncated; + this.sizeBytes = sizeBytes; + this.summarizedTrace = summarizedTrace; + this.unparsed |= summarizedTrace.unparsed; + } + + public PrunedTraceAttributes isTruncated(Boolean isTruncated) { + this.isTruncated = isTruncated; + return this; + } + + /** + * Indicates whether the underlying trace was truncated because its size exceeded the maximum that + * can be retrieved from storage. + * + * @return isTruncated + */ + @JsonProperty(JSON_PROPERTY_IS_TRUNCATED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getIsTruncated() { + return isTruncated; + } + + public void setIsTruncated(Boolean isTruncated) { + this.isTruncated = isTruncated; + } + + public PrunedTraceAttributes sizeBytes(Integer sizeBytes) { + this.sizeBytes = sizeBytes; + return this; + } + + /** + * The size, in bytes, of the original (non-pruned) trace before summarization. maximum: + * 2147483647 + * + * @return sizeBytes + */ + @JsonProperty(JSON_PROPERTY_SIZE_BYTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Integer getSizeBytes() { + return sizeBytes; + } + + public void setSizeBytes(Integer sizeBytes) { + this.sizeBytes = sizeBytes; + } + + public PrunedTraceAttributes summarizedTrace(SummarizedTrace summarizedTrace) { + this.summarizedTrace = summarizedTrace; + this.unparsed |= summarizedTrace.unparsed; + return this; + } + + /** + * A summarized, hierarchical view of a trace. + * + * @return summarizedTrace + */ + @JsonProperty(JSON_PROPERTY_SUMMARIZED_TRACE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SummarizedTrace getSummarizedTrace() { + return summarizedTrace; + } + + public void setSummarizedTrace(SummarizedTrace summarizedTrace) { + this.summarizedTrace = summarizedTrace; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return PrunedTraceAttributes + */ + @JsonAnySetter + public PrunedTraceAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this PrunedTraceAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PrunedTraceAttributes prunedTraceAttributes = (PrunedTraceAttributes) o; + return Objects.equals(this.isTruncated, prunedTraceAttributes.isTruncated) + && Objects.equals(this.sizeBytes, prunedTraceAttributes.sizeBytes) + && Objects.equals(this.summarizedTrace, prunedTraceAttributes.summarizedTrace) + && Objects.equals(this.additionalProperties, prunedTraceAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(isTruncated, sizeBytes, summarizedTrace, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PrunedTraceAttributes {\n"); + sb.append(" isTruncated: ").append(toIndentedString(isTruncated)).append("\n"); + sb.append(" sizeBytes: ").append(toIndentedString(sizeBytes)).append("\n"); + sb.append(" summarizedTrace: ").append(toIndentedString(summarizedTrace)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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/PrunedTraceData.java b/src/main/java/com/datadog/api/client/v2/model/PrunedTraceData.java new file mode 100644 index 00000000000..f05367d01ae --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/PrunedTraceData.java @@ -0,0 +1,209 @@ +/* + * 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.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A pruned trace resource document. */ +@JsonPropertyOrder({ + PrunedTraceData.JSON_PROPERTY_ATTRIBUTES, + PrunedTraceData.JSON_PROPERTY_ID, + PrunedTraceData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class PrunedTraceData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private PrunedTraceAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private PrunedTraceType type; + + public PrunedTraceData() {} + + @JsonCreator + public PrunedTraceData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + PrunedTraceAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) PrunedTraceType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public PrunedTraceData attributes(PrunedTraceAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes of a pruned trace returned by the Get pruned trace by ID endpoint. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public PrunedTraceAttributes getAttributes() { + return attributes; + } + + public void setAttributes(PrunedTraceAttributes attributes) { + this.attributes = attributes; + } + + public PrunedTraceData id(String id) { + this.id = id; + return this; + } + + /** + * The full 128-bit trace ID, encoded as a 32-character hexadecimal string. + * + * @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 PrunedTraceData type(PrunedTraceType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of the pruned trace resource. The value is always pruned_trace. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public PrunedTraceType getType() { + return type; + } + + public void setType(PrunedTraceType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return PrunedTraceData + */ + @JsonAnySetter + public PrunedTraceData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this PrunedTraceData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PrunedTraceData prunedTraceData = (PrunedTraceData) o; + return Objects.equals(this.attributes, prunedTraceData.attributes) + && Objects.equals(this.id, prunedTraceData.id) + && Objects.equals(this.type, prunedTraceData.type) + && Objects.equals(this.additionalProperties, prunedTraceData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PrunedTraceData {\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(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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/PrunedTraceResponse.java b/src/main/java/com/datadog/api/client/v2/model/PrunedTraceResponse.java new file mode 100644 index 00000000000..73b2d4548bd --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/PrunedTraceResponse.java @@ -0,0 +1,145 @@ +/* + * 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.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Response containing a single pruned trace. */ +@JsonPropertyOrder({PrunedTraceResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class PrunedTraceResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private PrunedTraceData data; + + public PrunedTraceResponse() {} + + @JsonCreator + public PrunedTraceResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) PrunedTraceData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public PrunedTraceResponse data(PrunedTraceData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * A pruned trace resource document. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public PrunedTraceData getData() { + return data; + } + + public void setData(PrunedTraceData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return PrunedTraceResponse + */ + @JsonAnySetter + public PrunedTraceResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this PrunedTraceResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PrunedTraceResponse prunedTraceResponse = (PrunedTraceResponse) o; + return Objects.equals(this.data, prunedTraceResponse.data) + && Objects.equals(this.additionalProperties, prunedTraceResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PrunedTraceResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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/PrunedTraceType.java b/src/main/java/com/datadog/api/client/v2/model/PrunedTraceType.java new file mode 100644 index 00000000000..a5ecbe484b5 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/PrunedTraceType.java @@ -0,0 +1,54 @@ +/* + * 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.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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.Set; + +/** The type of the pruned trace resource. The value is always pruned_trace. */ +@JsonSerialize(using = PrunedTraceType.PrunedTraceTypeSerializer.class) +public class PrunedTraceType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("pruned_trace")); + + public static final PrunedTraceType PRUNED_TRACE = new PrunedTraceType("pruned_trace"); + + PrunedTraceType(String value) { + super(value, allowedValues); + } + + public static class PrunedTraceTypeSerializer extends StdSerializer { + public PrunedTraceTypeSerializer(Class t) { + super(t); + } + + public PrunedTraceTypeSerializer() { + this(null); + } + + @Override + public void serialize(PrunedTraceType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static PrunedTraceType fromValue(String value) { + return new PrunedTraceType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/SummarizedSpan.java b/src/main/java/com/datadog/api/client/v2/model/SummarizedSpan.java new file mode 100644 index 00000000000..140bb6b6cb7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SummarizedSpan.java @@ -0,0 +1,556 @@ +/* + * 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.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +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.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** A node in the pruned trace tree. */ +@JsonPropertyOrder({ + SummarizedSpan.JSON_PROPERTY_CHILDREN, + SummarizedSpan.JSON_PROPERTY_DURATION_SECONDS, + SummarizedSpan.JSON_PROPERTY_END_TIME, + SummarizedSpan.JSON_PROPERTY_ERROR, + SummarizedSpan.JSON_PROPERTY_HIDDEN_CHILD_SPANS_COUNT, + SummarizedSpan.JSON_PROPERTY_META, + SummarizedSpan.JSON_PROPERTY_METRICS, + SummarizedSpan.JSON_PROPERTY_NAME, + SummarizedSpan.JSON_PROPERTY_PARENT_ID, + SummarizedSpan.JSON_PROPERTY_RESOURCE, + SummarizedSpan.JSON_PROPERTY_SERVICE, + SummarizedSpan.JSON_PROPERTY_SPAN_ID, + SummarizedSpan.JSON_PROPERTY_SPAN_KIND, + SummarizedSpan.JSON_PROPERTY_START_TIME +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SummarizedSpan { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CHILDREN = "children"; + private List children = new ArrayList<>(); + + public static final String JSON_PROPERTY_DURATION_SECONDS = "durationSeconds"; + private Double durationSeconds; + + public static final String JSON_PROPERTY_END_TIME = "endTime"; + private OffsetDateTime endTime; + + public static final String JSON_PROPERTY_ERROR = "error"; + private APMSpanErrorFlag error; + + public static final String JSON_PROPERTY_HIDDEN_CHILD_SPANS_COUNT = "hidden_child_spans_count"; + private Integer hiddenChildSpansCount; + + public static final String JSON_PROPERTY_META = "meta"; + private Map meta = new HashMap(); + + public static final String JSON_PROPERTY_METRICS = "metrics"; + private Map metrics = new HashMap(); + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_PARENT_ID = "parentID"; + private Long parentId; + + public static final String JSON_PROPERTY_RESOURCE = "resource"; + private String resource; + + public static final String JSON_PROPERTY_SERVICE = "service"; + private String service; + + public static final String JSON_PROPERTY_SPAN_ID = "spanID"; + private Long spanId; + + public static final String JSON_PROPERTY_SPAN_KIND = "span_kind"; + private String spanKind; + + public static final String JSON_PROPERTY_START_TIME = "startTime"; + private OffsetDateTime startTime; + + public SummarizedSpan() {} + + @JsonCreator + public SummarizedSpan( + @JsonProperty(required = true, value = JSON_PROPERTY_CHILDREN) List children, + @JsonProperty(required = true, value = JSON_PROPERTY_DURATION_SECONDS) Double durationSeconds, + @JsonProperty(required = true, value = JSON_PROPERTY_END_TIME) OffsetDateTime endTime, + @JsonProperty(required = true, value = JSON_PROPERTY_ERROR) APMSpanErrorFlag error, + @JsonProperty(required = true, value = JSON_PROPERTY_HIDDEN_CHILD_SPANS_COUNT) + Integer hiddenChildSpansCount, + @JsonProperty(required = true, value = JSON_PROPERTY_META) Map meta, + @JsonProperty(required = true, value = JSON_PROPERTY_METRICS) Map metrics, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_PARENT_ID) Long parentId, + @JsonProperty(required = true, value = JSON_PROPERTY_RESOURCE) String resource, + @JsonProperty(required = true, value = JSON_PROPERTY_SERVICE) String service, + @JsonProperty(required = true, value = JSON_PROPERTY_SPAN_ID) Long spanId, + @JsonProperty(required = true, value = JSON_PROPERTY_SPAN_KIND) String spanKind, + @JsonProperty(required = true, value = JSON_PROPERTY_START_TIME) OffsetDateTime startTime) { + this.children = children; + this.durationSeconds = durationSeconds; + this.endTime = endTime; + this.error = error; + this.unparsed |= !error.isValid(); + this.hiddenChildSpansCount = hiddenChildSpansCount; + this.meta = meta; + this.metrics = metrics; + this.name = name; + this.parentId = parentId; + this.resource = resource; + this.service = service; + this.spanId = spanId; + this.spanKind = spanKind; + this.startTime = startTime; + } + + public SummarizedSpan children(List children) { + this.children = children; + for (SummarizedSpan item : children) { + this.unparsed |= item.unparsed; + } + return this; + } + + public SummarizedSpan addChildrenItem(SummarizedSpan childrenItem) { + this.children.add(childrenItem); + this.unparsed |= childrenItem.unparsed; + return this; + } + + /** + * The child spans of this node in the pruned tree. + * + * @return children + */ + @JsonProperty(JSON_PROPERTY_CHILDREN) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getChildren() { + return children; + } + + public void setChildren(List children) { + this.children = children; + } + + public SummarizedSpan durationSeconds(Double durationSeconds) { + this.durationSeconds = durationSeconds; + return this; + } + + /** + * The duration of the span, in seconds. + * + * @return durationSeconds + */ + @JsonProperty(JSON_PROPERTY_DURATION_SECONDS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Double getDurationSeconds() { + return durationSeconds; + } + + public void setDurationSeconds(Double durationSeconds) { + this.durationSeconds = durationSeconds; + } + + public SummarizedSpan endTime(OffsetDateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * The end time of the span, in RFC3339 format. + * + * @return endTime + */ + @JsonProperty(JSON_PROPERTY_END_TIME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getEndTime() { + return endTime; + } + + public void setEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + } + + public SummarizedSpan error(APMSpanErrorFlag error) { + this.error = error; + this.unparsed |= !error.isValid(); + return this; + } + + /** + * Error flag for a span. 1 when the span is in error, 0 otherwise. + * + * @return error + */ + @JsonProperty(JSON_PROPERTY_ERROR) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public APMSpanErrorFlag getError() { + return error; + } + + public void setError(APMSpanErrorFlag error) { + if (!error.isValid()) { + this.unparsed = true; + } + this.error = error; + } + + public SummarizedSpan hiddenChildSpansCount(Integer hiddenChildSpansCount) { + this.hiddenChildSpansCount = hiddenChildSpansCount; + return this; + } + + /** + * The number of child spans that were pruned from this node when summarizing the trace. maximum: + * 2147483647 + * + * @return hiddenChildSpansCount + */ + @JsonProperty(JSON_PROPERTY_HIDDEN_CHILD_SPANS_COUNT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Integer getHiddenChildSpansCount() { + return hiddenChildSpansCount; + } + + public void setHiddenChildSpansCount(Integer hiddenChildSpansCount) { + this.hiddenChildSpansCount = hiddenChildSpansCount; + } + + public SummarizedSpan meta(Map meta) { + this.meta = meta; + return this; + } + + public SummarizedSpan putMetaItem(String key, String metaItem) { + this.meta.put(key, metaItem); + return this; + } + + /** + * String-valued tags attached to the span. + * + * @return meta + */ + @JsonProperty(JSON_PROPERTY_META) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Map getMeta() { + return meta; + } + + public void setMeta(Map meta) { + this.meta = meta; + } + + public SummarizedSpan metrics(Map metrics) { + this.metrics = metrics; + return this; + } + + public SummarizedSpan putMetricsItem(String key, Double metricsItem) { + this.metrics.put(key, metricsItem); + return this; + } + + /** + * Numeric metrics attached to the span. + * + * @return metrics + */ + @JsonProperty(JSON_PROPERTY_METRICS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Map getMetrics() { + return metrics; + } + + public void setMetrics(Map metrics) { + this.metrics = metrics; + } + + public SummarizedSpan name(String name) { + this.name = name; + return this; + } + + /** + * The operation name of the span. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public SummarizedSpan parentId(Long parentId) { + this.parentId = parentId; + return this; + } + + /** + * The ID of the parent span, or 0 when the span is the trace root. + * + * @return parentId + */ + @JsonProperty(JSON_PROPERTY_PARENT_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getParentId() { + return parentId; + } + + public void setParentId(Long parentId) { + this.parentId = parentId; + } + + public SummarizedSpan resource(String resource) { + this.resource = resource; + return this; + } + + /** + * The resource that the span describes. + * + * @return resource + */ + @JsonProperty(JSON_PROPERTY_RESOURCE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getResource() { + return resource; + } + + public void setResource(String resource) { + this.resource = resource; + } + + public SummarizedSpan service(String service) { + this.service = service; + return this; + } + + /** + * The name of the service that emitted the span. + * + * @return service + */ + @JsonProperty(JSON_PROPERTY_SERVICE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getService() { + return service; + } + + public void setService(String service) { + this.service = service; + } + + public SummarizedSpan spanId(Long spanId) { + this.spanId = spanId; + return this; + } + + /** + * The span ID, as an unsigned 64-bit integer. + * + * @return spanId + */ + @JsonProperty(JSON_PROPERTY_SPAN_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getSpanId() { + return spanId; + } + + public void setSpanId(Long spanId) { + this.spanId = spanId; + } + + public SummarizedSpan spanKind(String spanKind) { + this.spanKind = spanKind; + return this; + } + + /** + * The OpenTelemetry span kind, for example INTERNAL, SERVER, + * CLIENT, PRODUCER, or CONSUMER. + * + * @return spanKind + */ + @JsonProperty(JSON_PROPERTY_SPAN_KIND) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getSpanKind() { + return spanKind; + } + + public void setSpanKind(String spanKind) { + this.spanKind = spanKind; + } + + public SummarizedSpan startTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * The start time of the span, in RFC3339 format. + * + * @return startTime + */ + @JsonProperty(JSON_PROPERTY_START_TIME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getStartTime() { + return startTime; + } + + public void setStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return SummarizedSpan + */ + @JsonAnySetter + public SummarizedSpan putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this SummarizedSpan object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SummarizedSpan summarizedSpan = (SummarizedSpan) o; + return Objects.equals(this.children, summarizedSpan.children) + && Objects.equals(this.durationSeconds, summarizedSpan.durationSeconds) + && Objects.equals(this.endTime, summarizedSpan.endTime) + && Objects.equals(this.error, summarizedSpan.error) + && Objects.equals(this.hiddenChildSpansCount, summarizedSpan.hiddenChildSpansCount) + && Objects.equals(this.meta, summarizedSpan.meta) + && Objects.equals(this.metrics, summarizedSpan.metrics) + && Objects.equals(this.name, summarizedSpan.name) + && Objects.equals(this.parentId, summarizedSpan.parentId) + && Objects.equals(this.resource, summarizedSpan.resource) + && Objects.equals(this.service, summarizedSpan.service) + && Objects.equals(this.spanId, summarizedSpan.spanId) + && Objects.equals(this.spanKind, summarizedSpan.spanKind) + && Objects.equals(this.startTime, summarizedSpan.startTime) + && Objects.equals(this.additionalProperties, summarizedSpan.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + children, + durationSeconds, + endTime, + error, + hiddenChildSpansCount, + meta, + metrics, + name, + parentId, + resource, + service, + spanId, + spanKind, + startTime, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SummarizedSpan {\n"); + sb.append(" children: ").append(toIndentedString(children)).append("\n"); + sb.append(" durationSeconds: ").append(toIndentedString(durationSeconds)).append("\n"); + sb.append(" endTime: ").append(toIndentedString(endTime)).append("\n"); + sb.append(" error: ").append(toIndentedString(error)).append("\n"); + sb.append(" hiddenChildSpansCount: ") + .append(toIndentedString(hiddenChildSpansCount)) + .append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append(" metrics: ").append(toIndentedString(metrics)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" parentId: ").append(toIndentedString(parentId)).append("\n"); + sb.append(" resource: ").append(toIndentedString(resource)).append("\n"); + sb.append(" service: ").append(toIndentedString(service)).append("\n"); + sb.append(" spanId: ").append(toIndentedString(spanId)).append("\n"); + sb.append(" spanKind: ").append(toIndentedString(spanKind)).append("\n"); + sb.append(" startTime: ").append(toIndentedString(startTime)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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/SummarizedTrace.java b/src/main/java/com/datadog/api/client/v2/model/SummarizedTrace.java new file mode 100644 index 00000000000..951fccca2ef --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SummarizedTrace.java @@ -0,0 +1,172 @@ +/* + * 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.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A summarized, hierarchical view of a trace. */ +@JsonPropertyOrder({SummarizedTrace.JSON_PROPERTY_ROOT, SummarizedTrace.JSON_PROPERTY_TRACE_ID}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SummarizedTrace { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ROOT = "root"; + private SummarizedSpan root; + + public static final String JSON_PROPERTY_TRACE_ID = "traceId"; + private String traceId; + + public SummarizedTrace() {} + + @JsonCreator + public SummarizedTrace( + @JsonProperty(required = true, value = JSON_PROPERTY_ROOT) SummarizedSpan root, + @JsonProperty(required = true, value = JSON_PROPERTY_TRACE_ID) String traceId) { + this.root = root; + this.unparsed |= root.unparsed; + this.traceId = traceId; + } + + public SummarizedTrace root(SummarizedSpan root) { + this.root = root; + this.unparsed |= root.unparsed; + return this; + } + + /** + * A node in the pruned trace tree. + * + * @return root + */ + @JsonProperty(JSON_PROPERTY_ROOT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SummarizedSpan getRoot() { + return root; + } + + public void setRoot(SummarizedSpan root) { + this.root = root; + } + + public SummarizedTrace traceId(String traceId) { + this.traceId = traceId; + return this; + } + + /** + * The full 128-bit trace ID, encoded as a 32-character hexadecimal string. + * + * @return traceId + */ + @JsonProperty(JSON_PROPERTY_TRACE_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTraceId() { + return traceId; + } + + public void setTraceId(String traceId) { + this.traceId = traceId; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return SummarizedTrace + */ + @JsonAnySetter + public SummarizedTrace putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this SummarizedTrace object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SummarizedTrace summarizedTrace = (SummarizedTrace) o; + return Objects.equals(this.root, summarizedTrace.root) + && Objects.equals(this.traceId, summarizedTrace.traceId) + && Objects.equals(this.additionalProperties, summarizedTrace.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(root, traceId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SummarizedTrace {\n"); + sb.append(" root: ").append(toIndentedString(root)).append("\n"); + sb.append(" traceId: ").append(toIndentedString(traceId)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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/TraceAttributes.java b/src/main/java/com/datadog/api/client/v2/model/TraceAttributes.java new file mode 100644 index 00000000000..c8d458df125 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TraceAttributes.java @@ -0,0 +1,185 @@ +/* + * 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.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +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.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** The attributes of a trace returned by the Get trace by ID endpoint. */ +@JsonPropertyOrder({ + TraceAttributes.JSON_PROPERTY_IS_TRUNCATED, + TraceAttributes.JSON_PROPERTY_SPANS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TraceAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_IS_TRUNCATED = "is_truncated"; + private Boolean isTruncated; + + public static final String JSON_PROPERTY_SPANS = "spans"; + private List spans = new ArrayList<>(); + + public TraceAttributes() {} + + @JsonCreator + public TraceAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_IS_TRUNCATED) Boolean isTruncated, + @JsonProperty(required = true, value = JSON_PROPERTY_SPANS) List spans) { + this.isTruncated = isTruncated; + this.spans = spans; + } + + public TraceAttributes isTruncated(Boolean isTruncated) { + this.isTruncated = isTruncated; + return this; + } + + /** + * Indicates whether the trace was truncated because its size exceeded the maximum response + * payload. + * + * @return isTruncated + */ + @JsonProperty(JSON_PROPERTY_IS_TRUNCATED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getIsTruncated() { + return isTruncated; + } + + public void setIsTruncated(Boolean isTruncated) { + this.isTruncated = isTruncated; + } + + public TraceAttributes spans(List spans) { + this.spans = spans; + for (APMTraceSpan item : spans) { + this.unparsed |= item.unparsed; + } + return this; + } + + public TraceAttributes addSpansItem(APMTraceSpan spansItem) { + this.spans.add(spansItem); + this.unparsed |= spansItem.unparsed; + return this; + } + + /** + * The list of spans that compose the trace. + * + * @return spans + */ + @JsonProperty(JSON_PROPERTY_SPANS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getSpans() { + return spans; + } + + public void setSpans(List spans) { + this.spans = spans; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return TraceAttributes + */ + @JsonAnySetter + public TraceAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this TraceAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TraceAttributes traceAttributes = (TraceAttributes) o; + return Objects.equals(this.isTruncated, traceAttributes.isTruncated) + && Objects.equals(this.spans, traceAttributes.spans) + && Objects.equals(this.additionalProperties, traceAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(isTruncated, spans, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TraceAttributes {\n"); + sb.append(" isTruncated: ").append(toIndentedString(isTruncated)).append("\n"); + sb.append(" spans: ").append(toIndentedString(spans)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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/TraceData.java b/src/main/java/com/datadog/api/client/v2/model/TraceData.java new file mode 100644 index 00000000000..db57b9f1e34 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TraceData.java @@ -0,0 +1,208 @@ +/* + * 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.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A trace resource document. */ +@JsonPropertyOrder({ + TraceData.JSON_PROPERTY_ATTRIBUTES, + TraceData.JSON_PROPERTY_ID, + TraceData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TraceData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private TraceAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private TraceType type; + + public TraceData() {} + + @JsonCreator + public TraceData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) TraceAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) TraceType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public TraceData attributes(TraceAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes of a trace returned by the Get trace by ID endpoint. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TraceAttributes getAttributes() { + return attributes; + } + + public void setAttributes(TraceAttributes attributes) { + this.attributes = attributes; + } + + public TraceData id(String id) { + this.id = id; + return this; + } + + /** + * The full 128-bit trace ID, encoded as a 32-character hexadecimal string. + * + * @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 TraceData type(TraceType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of the trace resource. The value is always trace. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TraceType getType() { + return type; + } + + public void setType(TraceType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return TraceData + */ + @JsonAnySetter + public TraceData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this TraceData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TraceData traceData = (TraceData) o; + return Objects.equals(this.attributes, traceData.attributes) + && Objects.equals(this.id, traceData.id) + && Objects.equals(this.type, traceData.type) + && Objects.equals(this.additionalProperties, traceData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TraceData {\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(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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/TraceResponse.java b/src/main/java/com/datadog/api/client/v2/model/TraceResponse.java new file mode 100644 index 00000000000..9a82490e181 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TraceResponse.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.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Response containing a single trace. */ +@JsonPropertyOrder({TraceResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TraceResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private TraceData data; + + public TraceResponse() {} + + @JsonCreator + public TraceResponse(@JsonProperty(required = true, value = JSON_PROPERTY_DATA) TraceData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public TraceResponse data(TraceData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * A trace resource document. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TraceData getData() { + return data; + } + + public void setData(TraceData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return TraceResponse + */ + @JsonAnySetter + public TraceResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this TraceResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TraceResponse traceResponse = (TraceResponse) o; + return Objects.equals(this.data, traceResponse.data) + && Objects.equals(this.additionalProperties, traceResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TraceResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .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/TraceType.java b/src/main/java/com/datadog/api/client/v2/model/TraceType.java new file mode 100644 index 00000000000..ede87be242e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TraceType.java @@ -0,0 +1,53 @@ +/* + * 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.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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.Set; + +/** The type of the trace resource. The value is always trace. */ +@JsonSerialize(using = TraceType.TraceTypeSerializer.class) +public class TraceType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("trace")); + + public static final TraceType TRACE = new TraceType("trace"); + + TraceType(String value) { + super(value, allowedValues); + } + + public static class TraceTypeSerializer extends StdSerializer { + public TraceTypeSerializer(Class t) { + super(t); + } + + public TraceTypeSerializer() { + this(null); + } + + @Override + public void serialize(TraceType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static TraceType fromValue(String value) { + return new TraceType(value); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/apm_trace.feature b/src/test/resources/com/datadog/api/client/v2/api/apm_trace.feature new file mode 100644 index 00000000000..e5b706b1910 --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/apm_trace.feature @@ -0,0 +1,48 @@ +@endpoint(apm-trace) @endpoint(apm-trace-v2) +Feature: APM Trace + Retrieve full or pruned APM traces by trace ID. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "APMTrace" API + + @generated @skip @team:DataDog/apm-reliability + Scenario: Get a pruned trace by ID returns "Not Found" response + Given operation "GetPrunedTraceByID" enabled + And new "GetPrunedTraceByID" request + And request contains "trace_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/apm-reliability + Scenario: Get a pruned trace by ID returns "OK" response + Given operation "GetPrunedTraceByID" enabled + And new "GetPrunedTraceByID" request + And request contains "trace_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/apm-reliability + Scenario: Get a trace by ID returns "Not Found" response + Given operation "GetTraceByID" enabled + And new "GetTraceByID" request + And request contains "trace_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/apm-reliability + Scenario: Get a trace by ID returns "OK" response + Given operation "GetTraceByID" enabled + And new "GetTraceByID" request + And request contains "trace_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/apm-reliability + Scenario: Get a trace by ID returns "Payload Too Large" response + Given operation "GetTraceByID" enabled + And new "GetTraceByID" request + And request contains "trace_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 413 Payload Too Large 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 30001c2fccd..6b6146033b0 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 @@ -5344,6 +5344,12 @@ "type": "safe" } }, + "GetPrunedTraceByID": { + "tag": "APM Trace", + "undo": { + "type": "safe" + } + }, "QueryScalarData": { "tag": "Metrics", "undo": { @@ -8139,6 +8145,12 @@ "type": "safe" } }, + "GetTraceByID": { + "tag": "APM Trace", + "undo": { + "type": "safe" + } + }, "GetUsageApplicationSecurityMonitoring": { "tag": "Usage Metering", "undo": {