canonical: https://jentic.com/apis/amazonaws.com/xray

# AWS X-Ray

Jentic publishes the only available OpenAPI specification for AWS X-Ray, keeping it validated and agent-ready. AWS X-Ray collects distributed traces from applications running on EC2, ECS, EKS, Lambda, and API Gateway, then surfaces the request path through every downstream service as a service map and per-trace timeline. The API ingests trace segments and telemetry, queries traces by ID or filter expression, returns service graphs and time-series statistics, and manages sampling rules, groups, and resource policies. The 30 operations span PutTraceSegments / PutTelemetryRecords for ingestion, BatchGetTraces and GetTraceSummaries for query, GetServiceGraph and GetInsight for analysis, and full CRUD on groups and sampling rules.

## For AI agents

Ingest application trace data and query service maps, traces, and insights so an agent can investigate latency and errors across distributed AWS services.

## Scope

Does not handle metric collection, log aggregation, or alerting - use for ingesting trace segments, querying traces and service maps, and managing sampling rules and groups only.

## Capabilities

- Ingest application trace segments via PutTraceSegments and telemetry via PutTelemetryRecords
- Search traces by filter expression and time range with GetTraceSummaries
- Retrieve full traces (with sub-segments) via BatchGetTraces
- Render the service map and trace graph for visualisation with GetServiceGraph and GetTraceGraph
- Manage sampling rules to control trace volume and cost
- Define groups with filter expressions for scoped views and per-team dashboards
- Read X-Ray Insights for automatic anomaly detection on faults and latency

## Use cases

### Latency Investigation Across Microservices

When p99 latency spikes, use GetTraceSummaries with a filter expression like 'service("checkout") AND responsetime > 2' over the relevant time window to find the offending traces, then BatchGetTraces with the returned TraceIds to inspect sub-segments and pinpoint the slow downstream call. GetServiceGraph in parallel surfaces which service-to-service edge is degraded.

Example prompt: Call GetTraceSummaries with FilterExpression 'service("checkout") AND responsetime > 2', StartTime 30 minutes ago, EndTime now, and TimeRangeType 'TraceId', then BatchGetTraces with the first 5 returned TraceIds.

### Cost-Aware Trace Sampling

Reduce X-Ray spend by raising sampling rates only for important paths. CreateSamplingRule defines rules that match by ServiceName, ServiceType, Host, HTTPMethod, URLPath, and ResourceARN, with a Reservoir (fixed traces per second) and a FixedRate (proportion of remaining traffic). UpdateSamplingRule adjusts the rule live without code changes; GetSamplingRules lists all active rules.

Example prompt: Call CreateSamplingRule with RuleName 'checkout-high', Priority 100, ReservoirSize 5, FixedRate 0.2, ServiceName 'checkout', URLPath '/checkout', and HTTPMethod 'POST'.

### Service Health Insights

X-Ray Insights automatically detects anomalies in service-level error rates and latency. ListInsightSummaries enumerates open insights; GetInsight returns the root-cause analysis; GetInsightImpactGraph shows the user-impact graph; GetInsightEvents returns the time series of impact. Together they produce a richer signal than raw metrics for SRE on-call review.

Example prompt: Call ListInsightSummaries with States ['ACTIVE'], then for each InsightId call GetInsight and GetInsightImpactGraph and return the affected services.

### Agent-Driven Trace Triage via Jentic

An on-call agent investigating a paged alert can query X-Ray through Jentic without holding AWS keys. The agent submits an intent like 'find slow traces in the last 30 minutes for the checkout service'; Jentic loads GetTraceSummaries, executes it with a filter expression, and returns the offending TraceIds; the agent then calls BatchGetTraces for the timeline detail. The agent context never sees a SecretAccessKey.

Example prompt: Through Jentic, search for 'find slow traces in aws xray', load GetTraceSummaries, and execute with FilterExpression and TimeRange.

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| POST | /Traces | Batch get traces by trace ID |
| POST | /TraceSummaries | Search traces by filter expression |
| POST | /ServiceGraph | Get the service map graph |
| POST | /TraceSegments | Submit trace segment documents |
| POST | /CreateSamplingRule | Create a sampling rule |
| POST | /InsightSummaries | List insight summaries |

## Key resources

- **Trace ingestion** — PutTraceSegments and PutTelemetryRecords for sending data to X-Ray
- **Trace query** — GetTraceSummaries, BatchGetTraces, GetTraceGraph, GetTimeSeriesServiceStatistics
- **Service map** — GetServiceGraph for the cross-service view
- **Insights** — GetInsight, GetInsightEvents, GetInsightImpactGraph, GetInsightSummaries
- **Sampling and groups** — CreateSamplingRule, GetSamplingRules, GetSamplingTargets, GetSamplingStatisticSummaries; CreateGroup, GetGroups, UpdateGroup
- **Encryption and policies** — PutEncryptionConfig, GetEncryptionConfig, PutResourcePolicy, ListResourcePolicies

## Why Jentic

- **Setup:** Wiring AWS X-Ray by hand means computing SigV4 signatures against the us-east-1 xray endpoint and batching trace segments correctly yourself. Through Jentic you install once, import X-Ray from the API Directory, store the access keys once, and your agent calls it.
- **Permission scoping:** X-Ray identifies traces and rules through the request body rather than resource ids in the path, so scope the agent to the operations it needs, such as TraceSummaries and ServiceGraph. You choose the operations it may call, so CreateSamplingRule or segment ingestion are not included unless you add them.
- **Credential handling:** Your AWS access keys are stored once, encrypted, by your own Jentic One instance and used to sign each X-Ray request with SigV4 at execution time. They never enter the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'find slow traces' or 'get the service map', and Jentic returns the matching X-Ray operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **Amazon CloudWatch** — CloudWatch supplies metrics and alarms; X-Ray supplies the per-request distributed traces behind those metrics.
- **Amazon CloudWatch Logs** — CloudWatch Logs holds the log lines that X-Ray traces correlate to via trace IDs.
- **AWS CloudTrail** — CloudTrail audits AWS API calls; X-Ray traces the application requests that triggered them.

## FAQ

### Why is there no official OpenAPI spec for AWS X-Ray?

AWS does not publish an OpenAPI specification for AWS X-Ray; it ships Smithy models and language-specific SDKs instead. Jentic generates and maintains this OpenAPI spec so that AI agents and developers can call AWS X-Ray via structured tooling. It is validated against the live API and kept up to date. Get started with Jentic One, the self-hosted execution layer.

### What authentication does AWS X-Ray use?

X-Ray uses AWS SigV4 in the Authorization header. The IAM principal needs xray:PutTraceSegments and xray:PutTelemetryRecords for ingestion and xray:Get* / xray:BatchGet* for query. Through Jentic, your AWS keys are vaulted and Jentic signs each request.

### Can I search traces by HTTP status code or service name?

Yes. GetTraceSummaries accepts a FilterExpression in X-Ray's filter syntax: clauses like 'service("checkout")', 'http.status >= 500', and 'responsetime > 2' can be combined with AND/OR. The TimeRangeType selector controls whether you query by trace start time or by event time.

### What are the rate limits for AWS X-Ray?

PutTraceSegments has a default ingestion rate of around 250,000 segments per second per account but is metered per trace; query APIs (GetTraceSummaries, BatchGetTraces) have lower per-second quotas. Sampling rules are the primary cost lever - fewer sampled traces means fewer ingestion charges.

### How do I find slow traces through Jentic?

Search Jentic with 'find slow traces in aws xray', load GetTraceSummaries, and execute with FilterExpression 'responsetime > 2', StartTime, and EndTime. Jentic returns TraceSummaries; pass the TraceIds into BatchGetTraces for full timelines.

### Can I control how many traces X-Ray records?

Yes. Sampling rules combine a Reservoir (fixed traces per second) with a FixedRate (fraction of remaining matching requests). CreateSamplingRule, UpdateSamplingRule, and DeleteSamplingRule manage them; GetSamplingTargets returns the live targets for instrumented clients.

### Does X-Ray work with Lambda and API Gateway out of the box?

Yes. Lambda and API Gateway can emit X-Ray segments when active tracing is enabled in their configuration; this API is then used to query the resulting traces and service map. Custom applications use the X-Ray daemon or OpenTelemetry to emit segments via PutTraceSegments.

### Can I limit what my agent is allowed to do with the AWS X-Ray API?

Yes. Because you run Jentic One yourself, your own rules decide which X-Ray operations and which stored AWS credentials the agent may use. Since X-Ray identifies traces and rules through the request body rather than resource IDs in the path, you scope by operation: grant read-only calls like GetTraceSummaries, BatchGetTraces, and GetServiceGraph for investigation while leaving out write paths such as CreateSamplingRule and PutTraceSegments unless you explicitly add them. Nothing the agent can call is available until you include it in that operation list.
