# Trace0 > This file is very large and may be truncated. For an index of this content, please refer to https://docs.trace0hq.com/llms.txt instead. > Trace0 is an modern, easy-to-use observability platform that gives you traces, metrics, logs, and alerting in one place — without the complexity or cost of traditional monitoring tools. # MCP Server Source: https://docs.trace0hq.com/ai/mcp Connect AI agents and other MCP clients to Trace0. Trace0 provides a Model Context Protocol (MCP) server that allows AI agents and other MCP clients to explore your Trace0 observability data. ## Server ```text theme={null} https://app.trace0hq.com/api/mcp ``` ## Authentication The Trace0 MCP server uses OAuth for authentication. Simply add the server URL (shown above) to your MCP client, and you'll be redirected to your browser to sign in to your Trace0 account and authorize access. Detailed setup instructions for popular MCP clients are provided below. > [tab] Claude Code > > **1. Add the server** > > Run the `add` command with Trace0's MCP server URL: > > ```bash theme={null} > claude mcp add --transport http trace0 https://app.trace0hq.com/api/mcp > ``` > > After adding, `claude mcp list` shows the server with `! Needs authentication`. That's expected: the next step completes the sign-in. > > **2. Authenticate in your browser** > > Start a Claude Code session and open the MCP panel: > > ```text theme={null} > /mcp > ``` > > Select `trace0` from the list, press Enter, and choose `Authenticate`. Your browser opens to Trace0's sign-in page. Approve the connection there. > > Back in Claude Code, the server's status changes to connected. If sign-in fails or the browser doesn't open, see this [Troubleshooting](https://code.claude.com/docs/en/mcp-quickstart#troubleshooting) guide. > > **3. Use the server** > > Ask Claude something that needs Trace0, like `Show me all failed requests in the last 30 minutes and summarise the most common errors`. > [tab] Claude Desktop > > Claude Desktop offers two ways to connect to MCP servers: > > * Using the **Search and Tools** menu in the main UI. > > * Using the **Developer Settings**. > > > [tab] Using the Search and Tools menu > > > > 1. In the main chat UI, navigate to the **Search and Tools** menu (icon with two horizontal lines and dots), then select **Manage Connectors**. > > 2. Scroll to the bottom and select **Add Custom Connector**. > > 3. Add the Trace0 MCP server name (e.g. `trace0`) and URL (`https://app.trace0hq.com/api/mcp`), then select **Add**. > > 4. Once added, your server will appear in the connectors list. Select the **Connect** option. You’ll be then redirected to the Trace0 OAuth consent screen to authorize Claude to access your Trace0 data. > > 5. Once connected, you can open a new chat and ask Claude something that needs Trace0 (e.g., `Show me all failed requests in the last 30 minutes and summarise the most common errors`). > > > [tab] Using the Developer Settings > > > > 1. Navigate to **Settings**. To find this, use the app menu to select **Settings** or press `Cmd/Ctrl + ,`. > > 2. In the settings sidebar, select **Developer**, then **Edit config**. Open the revealed file in your editor of choice. > > 3. Add the following configuration to the JSON file: > > ```json theme={null} > > { > > "mcpServers": { > > "trace0-mcp-server": { > > "command": "npx", > > "args": ["mcp-remote", "https://app.trace0hq.com/api/mcp", "--allow-http"] > > } > > } > > } > > ``` > > > [!IMPORTANT] > > > > > > * [mcp-remote](https://github.com/geelen/mcp-remote) is required since this connection mode does not support remote MCP servers with authentication natively. > > 4. Restart Claude Desktop. It should now prompt you to authenticate with your Trace0 account. > > 5. Once authenticated, you can open a new chat and ask Claude something that needs Trace0 (e.g., `Show me all failed requests in the last 30 minutes and summarise the most common errors`). > [tab] Cursor > > 1. Navigate to **Cursor Settings**. To find this, open the **Command Palette** (`Cmd/Ctrl + Shift + P`) and search for **Cursor Settings**, or select the gear icon in the top right corner of the app. > 2. In the sidenav, select **Tools & MCP**. If you don't see this, you may need to update Cursor to the latest version. > 3. Select **New MCP Server**. This will open a new tab containing the MCP configuration JSON file. > 4. Add the following configuration to the JSON file: > ```json theme={null} > { > "mcpServers": { > "trace0-mcp-server": { > "url": "https://app.trace0hq.com/api/mcp" > } > } > } > ``` > 5. Select **Needs login** when it appears. You'll be redirected to the Trace0 OAuth consent screen to authorize Cursor to access your Trace0 data. > 6. Start a new chat in [**Agent Mode**](https://docs.cursor.com/chat/agent) and ask it something that needs Trace0 (e.g., `Show me all failed requests in the last 30 minutes and summarise the most common errors`). > 7. Select **Run tool** once it becomes available. > [tab] VSCode > > 1. Run the `MCP: Open User Configuration command` to open the `mcp.json` file in your user profile folder, or create/open the `.vscode/mcp.json` in your project. > 2. Add the following configuration to the `.mcp.json` file: > > ```json theme={null} > { > "mcp": { > "inputs": [], > "servers": { > "trace-mcp-server": { > "url": "https://app.trace0hq.com/api/mcp" > } > } > } > } > ``` > > 3. Select **Start** above the server URL to start the MCP server. This will open up a modal asking you to open a browser to authenticate. > 4. Select **Allow**. Once authorized, your tool(s) should be listed as enabled and you should see **✔️ Running** above the server URL. > 5. Start a new Copilot chat (`Cmd/Ctrl + Shift + I`) and ask it something that needs Trace0 (e.g., `Show me all failed requests in the last 30 minutes and summarise the most common errors`). > 6. Select the **Run tool** option once it becomes available. > [tab] Windsurf > > 1. Navigate to **Settings**. To find this, use the app menu to select **Settings** or press `Cmd/Ctrl + ,`. > 2. In the settings searchbar, search for "MCP" and select the **Manage plugins** button under the **Plugins (MCP Servers)** section. Click the **View raw config** button to open the config file. > 3. Add the following configuration to the JSON file: > > ```json theme={null} > { > "mcpServers": { > "clerk-mcp-server": { > "command": "npx", > "args": ["mcp-remote", "https://app.trace0hq.com/api/mcp", "--allow-http"] > } > } > } > ``` > > > [!IMPORTANT] > > > > * [mcp-remote](https://github.com/geelen/mcp-remote) is required since Windsurf does not support remote MCP servers with authentication natively. > > 4. Save the file. It should now prompt you to authenticate with your Trace0 account. > 5. Once authenticated, you can open a new chat and ask it something that needs Trace0 (e.g., `Show me all failed requests in the last 30 minutes and summarise the most common errors`). ## Tools The Trace0 MCP server provides the following tools for querying your environments, services, transactions, logs, metrics, and alerts: | Tool | Description | | - | - | | `get_environments` | Returns the names of all environments in the authenticated user's Trace0 account. | | `get_services` | Returns the name and programming language of all services in the specified environment. | | `get_transactions` | Returns the summaries of transactions matching the specified filters. | | `get_transaction_detail` | Returns the transaction details for the specified transaction ID. | | `get_logs` | Returns the log entries matching the specified filters. | | `get_log_count` | Returns the number of logs matching the specified filters, aggregated by service name, severity level and time bucket. | | `get_application_metric_summaries` | Returns application metric summaries for all services in the specified environment and time period. | | `get_application_metrics` | Returns detailed application metrics for the specified service, environment and time period, aggregated by time bucket. | | `get_database_metrics` | Returns detailed database metrics for the specified database system, environment and time period, aggregated by time bucket. | | `get_cloud_service_metrics` | Returns detailed metrics for the specified managed cloud service, environment and time period, aggregated by time bucket. | | `get_triggered_alerts_summaries` | Returns the summaries of all alerts triggered in the specified environment and time period. | | `get_triggered_alert_detail` | Returns detailed information about alerts triggered for the specified alert within the specified time period. | ## Fair Use Limits The Trace0 MCP server comes with the following fair-use limits: * 50,000 monthly tool calls Once a limit is exceeded, the MCP server will return an error describing the applicable restriction. If you require higher limits, please contact us at [hello@trace0hq.com](mailto:hello@trace0hq.com) to discuss. # What is OpenTelemetry? Source: https://docs.trace0hq.com/faq/what-is-opentelemetry Learn what OpenTelemetry is and why Trace0 is built on it. [OpenTelemetry](https://opentelemetry.io) (OTel) is an open-source observability framework maintained by the Cloud Native Computing Foundation (CNCF). It provides a single, standardised set of APIs, SDKs, and instrumentation libraries for collecting traces, metrics, and logs from your services. ## Why OpenTelemetry? Before OpenTelemetry, every observability vendor had its own proprietary agent or SDK. Switching tools meant re-instrumenting your entire codebase. OpenTelemetry solves this by providing a vendor-neutral standard that any platform — including Trace0 — can receive data from. > [card] Open standard > > OpenTelemetry is governed by the CNCF and supported by every major cloud provider and observability vendor. Your instrumentation is never locked to a single tool. > [card] Rich ecosystem > > Libraries exist for every major language and framework. Most popular frameworks (Spring Boot, Express, Django, FastAPI, and more) are auto-instrumented with zero code changes. > [card] Traces, metrics & logs > > A single SDK captures all three telemetry signals — no need for separate agents or integrations for each signal type. > [card] Future-proof > > Because your code uses open-source instrumentation rather than proprietary agents, you can switch observability backends at any time without touching your application code. ## Using OpenTelemetry with Trace0 See the [Getting Started](/getting-started/overview) page to get started. # Getting Started Source: https://docs.trace0hq.com/getting-started/overview Instrument your service with OpenTelemetry and start seeing traces, metrics, and logs in Trace0 within seconds. **1. Create an environment and copy your API key** Log in to the [Trace0 dashboard](https://app.trace0hq.com), create a new environment, and copy your API key. You'll need this key to authenticate your service with the Trace0 ingest endpoint. **2. Install the OpenTelemetry agent** Install the OpenTelemetry agent for your service's language and runtime environment, then point it at the Trace0 ingest endpoint. Choose your language to get started: > [card] [Java](/setup/java/containers-and-vms) > > Java/Kotlin/Scala on ECS, K8s, Lambda, and more. > [card] [Node.js](/setup/javascript/containers-and-vms) > > JavaScript/TypeScript on ECS, K8s, Lambda, and more. > [card] [Python](/setup/python/containers-and-vms) > > Python on ECS, K8s, Lambda, and more. **3. Deploy and watch traces appear** Deploy your service and watch traces, metrics, and logs appear in the [Trace0 dashboard](https://app.trace0hq.com) within seconds. # What is Trace0? Source: https://docs.trace0hq.com/introduction/what-is-trace0 Trace0 is a modern, easy-to-use observability platform for teams and agents. Trace0 combines traces, logs, metrics, and alerts into a simple platform, making it easy to understand your applications and diagnose issues without the complexity or cost of traditional observability tools. Trace0 provides the following features: > [card] [Tracing](/platform/transactions) > > Distributed tracing out of the box. Get full visibility into requests across multiple services and components. > [card] [Logging](/platform/logs) > > Search logs by free text or time range, and view the complete request trace for any log entry. > [card] [Metrics](/platform/metrics/application-metrics) > > Monitor application metrics, database metrics, and more. > [card] [Alerting](/platform/alerts) > > Trigger alerts when a service fails or exceeds metric thresholds. > [card] [Agent-native](/ai/mcp) > > Easily connect Claude Code and other MCP-compatible AI agents to explore your Trace0 observability data. > [card] [OpenTelemetry-native](/faq/what-is-opentelemetry) > > Trace0 is built on OpenTelemetry, so you can instrument your services with no vendor lock-in. > [card] [Broad Coverage](/faq/what-is-opentelemetry) > > Trace0 works with all OpenTelemetry-supported languages and compute platforms across AWS, GCP, and Azure. > [card] [Simple Pricing](/pricing/pricing) > > Simple, usage-based pricing. You pay **\$0.60 per GB** of ingested data — nothing else. # Alerts Source: https://docs.trace0hq.com/platform/alerts Create and manage alerts for errors and metrics thresholds. ## Setup In Trace0, you can set alerts for both errors and metrics thresholds. To create a new alert, head to the [Alerts](https://app.trace0hq.com/alerts) section and click the `Add New Alert` button: ![Alerts Light](https://mintcdn.com/trace0/m31dn1vphNRcCRnY/images/alerts-light.png?fit=max\&auto=format\&n=m31dn1vphNRcCRnY\&q=85\&s=1cc4dfe50d9a57d4858f7394315ca714) You can then select the service the alert applies to, then choose an alert type — [Error Alert](#error-alerts) or [Metric Alert](#metric-alerts). ### Error Alerts For error alerts, the frequency is automatically set to `Every Event`, meaning you will receive an alert each time a request to your service fails. You can then set a `Destination` — Slack, Email, or both. * If you select `Email`, enter the email address you want to receive alert notifications. * If you select `Slack`, enter the [Webhook URL](https://docs.slack.dev/messaging/sending-messages-using-incoming-webhooks/) for the channel you want to receive alert notifications. ![Alerts Light](https://mintcdn.com/trace0/TZE_GvcBFqdrOj-c/images/error-alert-light.png?fit=max\&auto=format\&n=TZE_GvcBFqdrOj-c\&q=85\&s=41564d9b56580926e900961c4d9705c6) ### Metric Alerts For metric alerts, you first select the `Metric Type` — Request Latency or Error Rate. Each type is explained in further detail below: > [tab] Request Latency > > For Request Latency alerts, you can set the following parameters: > > * `Latency Percentile` — P99, P95, P90, P75, P50 > * `Condition` — Greater than, Greater than or equals, Less than, Less than or equals, Equals > * `Threshold` — A number in either milliseconds or seconds > * `Over The Last (minutes)` — A number in minutes > > ![Alerts Light](https://mintcdn.com/trace0/TZE_GvcBFqdrOj-c/images/request-latency-alert-light.png?fit=max\&auto=format\&n=TZE_GvcBFqdrOj-c\&q=85\&s=3b8a4b2783cc0e6effaf9f5cca55118b) > [tab] Error Rate > > For Error Rate alerts, you can set the following parameters: > > * `Condition` — Greater than, Greater than or equals, Less than, Less than or equals, Equals > * `Threshold` — A number as a percentage, i.e. the error rate > * `Over The Last (minutes)` — A number in minutes > > ![Error Rate Alert Light](https://mintcdn.com/trace0/tlYUbVE37LOUFZyW/images/error-rate-alert-light.png?fit=max\&auto=format\&n=tlYUbVE37LOUFZyW\&q=85\&s=5691a37311ce2d2ae4955c03c997b63e) > [!NOTE] > > Error Rate is calculated based on the proportion of failing transactions during the specified period. Error logs that are not associated with a trace (i.e. logs without a trace ID) do not contribute to the Error Rate metric. Finally, you can set a `Destination` — Slack, Email, or both. * If you select `Email`, enter the email address you want to receive alert notifications. * If you select `Slack`, enter the [Webhook URL](https://docs.slack.dev/messaging/sending-messages-using-incoming-webhooks/) for the channel you want to receive alert notifications. ## Triggered Alerts Once an alert is triggered, you will be notified in the Destinations that you configured for the alert, and it will also appear in the `Triggered` section: ![Triggered Alerts Summaries Light](https://mintcdn.com/trace0/glgK5Xr78zwkf19l/images/triggered-alerts-summaries-light.png?fit=max\&auto=format\&n=glgK5Xr78zwkf19l\&q=85\&s=dbcad6c20f241f8fbdfbfa11f66e5b28) You can then click into a triggered alert to view more details about the alert. ### Error Alert Detail For triggered error alerts, you can view the alert **Volume Over Time**, the [**Tags**](/platform/transactions#tags) **Involved** to understand which users, customers, orders, or other business entities were affected, and the **Failing Transactions** that triggered the alert. ![Triggered Error Alert Detail One Light](https://mintcdn.com/trace0/glgK5Xr78zwkf19l/images/triggered-error-alert-detail-one-light.png?fit=max\&auto=format\&n=glgK5Xr78zwkf19l\&q=85\&s=83207724445accfe8f48a529e0ec67b3) ![Triggered Error Alert Detail Two Light](https://mintcdn.com/trace0/glgK5Xr78zwkf19l/images/triggered-error-alert-detail-two-light.png?fit=max\&auto=format\&n=glgK5Xr78zwkf19l\&q=85\&s=cff44546b9454d97eb1537c78447303e) For an error alert that is triggered by an error log that is outside a transaction (i.e. a log with no trace ID), you will see an **Error Logs** section instead of **Failing Transactions**: ![Triggered Error Alert Detail Error Log Light](https://mintcdn.com/trace0/-IxZG6RuTkIJKQ4k/images/triggered-error-alert-detail-error-log-light.png?fit=max\&auto=format\&n=-IxZG6RuTkIJKQ4k\&q=85\&s=3451047257a5f4a7506660a48c13e44c) ### Metric Alert Detail For triggered metric alerts, you can view the alert **Volume Over Time**, the [**Tags**](/platform/transactions#tags) **Involved** to understand which users, customers, orders, or other business entities were affected, and the **Contributing Transactions** that led to the metric threshold being exceeded. ![Triggered Metric Alert Detail One Light](https://mintcdn.com/trace0/glgK5Xr78zwkf19l/images/triggered-metric-alert-detail-one-light.png?fit=max\&auto=format\&n=glgK5Xr78zwkf19l\&q=85\&s=236fcac6d13a96a924e17931b30b9497) ![Triggered Metric Alert Detail Two Light](https://mintcdn.com/trace0/glgK5Xr78zwkf19l/images/triggered-metric-alert-detail-two-light.png?fit=max\&auto=format\&n=glgK5Xr78zwkf19l\&q=85\&s=ba08589451d2f54a13e3b93665f960f9) # Logs Source: https://docs.trace0hq.com/platform/logs Search and explore logs across your services. You can view and analyze logs for each of your services in the [Logs](https://app.trace0hq.com/logs) section: ![Logs Light](https://mintcdn.com/trace0/WtH05Yh7SfBcCvcr/images/logs-light.png?fit=max\&auto=format\&n=WtH05Yh7SfBcCvcr\&q=85\&s=b0b72263975e55bde0be55eaf5519e1d) ### Filtering and Searching You can then filter logs by service, level and time period. You can also search logs by free text, returning any log entry where the search term appears in the log entry: ![Logs Light](https://mintcdn.com/trace0/WtH05Yh7SfBcCvcr/images/logs-search-light.png?fit=max\&auto=format\&n=WtH05Yh7SfBcCvcr\&q=85\&s=04c7604cda24c90c1b99487f080a620d) ### Surrounding Context Each matching log entry is displayed in the `Log entries` table and includes a link to the corresponding [Transaction](/platform/transactions). Click `View transaction` to open the transaction and see the full context of where the log entry occurred within the transaction. You can also click any row to open an expanded view showing the full log message, along with any structured log fields in a JSON object. ![Logs Expanded Light](https://mintcdn.com/trace0/5W5vzPE6NwXc9D2V/images/logs-expanded-light.png?fit=max\&auto=format\&n=5W5vzPE6NwXc9D2V\&q=85\&s=0104deaf315acb00b813e4afbb645cd1) # Application Metrics Source: https://docs.trace0hq.com/platform/metrics/application-metrics Monitor application metrics including latency, error rates, resource usage, and more. In Trace0, application metrics measure the performance and health of your application and its runtime, such as request latency, memory usage, thread counts, etc. They are distinct from metrics for external services your application uses, such as [database metrics](platform/metrics/database-metrics). To view application metrics for one of your services, go to the [Metrics](https://app.trace0hq.com/metrics) section then click the `View more` link for the service: ![Metrics Light](https://mintcdn.com/trace0/sp-Xup0R16kuMvrg/images/metrics-detail-light.png?fit=max\&auto=format\&n=sp-Xup0R16kuMvrg\&q=85\&s=8a76f74250af55d8ba67ad3a32e51bfa) The application metrics will be displayed in the `Application` section, with seperate sub-sections (based on the runtime your service uses). Trace0 provides detailed application metrics for each of the following runtimes: * [JVM](/platform/metrics/application-metrics/jvm-metrics) * [Python](/platform/metrics/application-metrics/python-metrics) * [Node.js](/platform/metrics/application-metrics/node-metrics) # JVM Metrics Source: https://docs.trace0hq.com/platform/metrics/application-metrics/jvm-metrics Monitor JVM metrics including request latency, memory usage, GC times, etc. ## How are Metrics Calculated? In Trace0, JVM metrics come from the following two OpenTelemetry sources: * **Requests metrics** are calculated from the service's `SPAN_KIND_SERVER` spans, one per request the service handles. Request count, requests per second, latency percentiles and errors are all derived from these spans and their durations and statuses. * **JVM runtime metrics** (Memory, Garbage Collection, Threads, Buffers, Classes, CPU and File Descriptors) are calculated from the OpenTelemetry metrics the JVM reports, as defined by the [OpenTelemetry semantic conventions for JVM metrics](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/). ## Service Instances **JVM runtime metrics** are reported separately by each instance of your service, so we show them for one instance at a time. **Requests metrics** are calculated from spans and cover all instances. We identify an instance using one of the following OpenTelemetry resource attributes, in order of preference: | Preference | Instance Type | Resource Attribute | | - | - | - | | 1 | ECS Task | [`aws.ecs.task.arn`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/aws/) | | 2 | Service Instance | [`service.instance.id`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/service/) | | 3 | Container (e.g. Docker) | [`container.id`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/container/) | | 4 | Host | [`host.id`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/host/) | Select an instance from the instance filter to view its JVM runtime metrics. If your service doesn't report any of these attributes, JVM runtime metrics are not shown. ![JVM Runtime Metrics Light](https://mintcdn.com/trace0/tQo2LqFWWJL_54fw/images/jvm-runtime-metrics-light.png?fit=max\&auto=format\&n=tQo2LqFWWJL_54fw\&q=85\&s=1cd4c50c688d73155e5e0f821e9d6bf9) > [!NOTE] > > JVM runtime metrics aren't shown for serverless runtimes (e.g. `AWS Lambda`), as each execution environment is short-lived and its runtime metrics aren't meaningful on their own. Serverless-specific metrics (e.g. cold starts) are coming soon. ## Aggregation Temporality OpenTelemetry Sum metrics (Counters and UpDownCounters) and Histogram metrics are reported with an [aggregation temporality](https://opentelemetry.io/docs/specs/otel/metrics/data-model/#temporality), which decides what each reported data point means. We use the most recent aggregation temporality the service reported for the metric in the selected period. An aggregation temporality can either be `Cumulative` or `Delta`. | Metric Type | Cumulative | Delta | | - | - | - | | `Sum (Counter, UpDownCounter)` | Each data point is a running total since the process started. We show the most recent value reported in each interval. | Each data point is the change since the previous export. We add up the values reported in each interval. | | `Histogram` | Each data point holds each bucket's running total since the process started. We show each bucket's most recent count in the selected period. | Each data point holds each bucket's count since the previous export. We add up each bucket's counts across the selected period. | `Gauge` and `Summary` metrics don't have an aggregation temporality, so this doesn't apply to them. ## Metrics We currently display the following application metrics for services running on the JVM: ### Requests **Single Value** | Metric | Unit | | - | - | | Request Count | Number | | Requests per Second | Number | | Request Latency P99 | Time (ms, s) | | Error Rate | Percentage | **Chart** | Metric | Description | Chart Type | | - | - | - | | Request Latency P99, P95, P90, P75, P50 | Latency percentile distribution | Line chart | | Requests & Errors | Request volume vs error volume | Histogram | | Errors | Error volume over time | Histogram | | Requests By Endpoint | Request details (count, latency, errors) per endpoint. | Table, one row per endpoint | ### JVM Memory | Metric | Description | Chart Type | How is it Calculated? | | - | - | - | - | | Total Heap Memory Used | Total memory used (in bytes) across all heap memory pools. | Line chart | From the [`jvm.memory.used`](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/#metric-jvmmemoryused) metric. We take the series where the `jvm.memory.type` attribute is `heap`, and add up their values across every memory pool at each interval. | | Heap Memory Used | Heap memory used (in bytes), per memory pool. | Line chart, one line per memory pool | From the [`jvm.memory.used`](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/#metric-jvmmemoryused) metric. Split by the `jvm.memory.pool.name` attribute. Only includes pools where the `jvm.memory.type` attribute is `heap`. | | Non-Heap Memory Used | Non-heap memory used (in bytes), per memory pool. | Line chart, one line per memory pool | From the [`jvm.memory.used`](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/#metric-jvmmemoryused) metric. Split by the `jvm.memory.pool.name` attribute. Only includes pools where the `jvm.memory.type` attribute is `non_heap`. | | Heap Memory Committed | Heap memory committed (in bytes), per memory pool. | Line chart, one line per memory pool | From the [`jvm.memory.committed`](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/#metric-jvmmemorycommitted) metric. Split by the `jvm.memory.pool.name` attribute. Only includes pools where the `jvm.memory.type` attribute is `heap`. | | Non-Heap Memory Committed | Non-heap memory committed (in bytes), per memory pool. | Line chart, one line per memory pool | From the [`jvm.memory.committed`](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/#metric-jvmmemorycommitted) metric. Split by the `jvm.memory.pool.name` attribute. Only includes pools where the `jvm.memory.type` attribute is `non_heap`. | | Heap Memory Limit | Maximum memory (in bytes) that can be obtained, per memory pool. | Line chart, one line per memory pool | From the [`jvm.memory.limit`](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/#metric-jvmmemorylimit) metric. Split by the `jvm.memory.pool.name`. Only includes pools where the `jvm.memory.type` attribute is `heap`. | | Non-Heap Memory Limit | Maximum memory (in bytes) that can be obtained, per memory pool. | Line chart, one line per memory pool | From the [`jvm.memory.limit`](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/#metric-jvmmemorylimit) metric. Split by the `jvm.memory.pool.name`. Only includes pools where the `jvm.memory.type` attribute is `non_heap`. | | Heap Memory Used After Last GC | Heap memory used (in bytes) after the most recent garbage collection on each memory pool. | Line chart, one line per memory pool | From the [`jvm.memory.used_after_last_gc`](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/#metric-jvmmemoryused_after_last_gc) metric. Split by the `jvm.memory.pool.name` attribute. Only includes pools where the `jvm.memory.type` attribute is `heap`. | | Non-Heap Memory Used After Last GC | Non-heap memory used (in bytes) after the most recent garbage collection on each memory pool. | Line chart, one line per memory pool | From the [`jvm.memory.used_after_last_gc`](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/#metric-jvmmemoryused_after_last_gc) metric. Split by the `jvm.memory.pool.name` attribute. Only includes pools where the `jvm.memory.type` attribute is `non_heap`. | | Heap Memory Init | Initial memory requested (in bytes), per memory pool. | Line chart, one line per memory pool | From the [`jvm.memory.init`](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/#metric-jvmmemoryinit) metric. Split by the [`jvm.memory.pool.name`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/jvm/) attribute. Only includes pools where the `jvm.memory.type` attribute is `heap`. | | Non-Heap Memory Init | Initial memory requested (in bytes), per memory pool. | Line chart, one line per memory pool | From the [`jvm.memory.init`](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/#metric-jvmmemoryinit) metric. Split by the [`jvm.memory.pool.name`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/jvm/) attribute. Only includes pools where the `jvm.memory.type` attribute is `non_heap`. | ### JVM Garbage Collection | Metric | Description | Chart Type | How is it Calculated? | | - | - | - | - | | GC Duration | Distribution of how long (in seconds) garbage collection actions take, per garbage collector. | OpenTelemetry histogram, one per garbage collector | From the [`jvm.gc.duration`](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/#metric-jvmgcduration) Histogram metric. Split by the `jvm.gc.name` attribute (e.g. `G1 Young Generation`). | ### JVM Threads | Metric | Description | Chart Type | How is it Calculated? | | - | - | - | - | | Platform Thread Count | Number of executing platform threads, per thread state. | Line chart, one line per thread state | From the [`jvm.thread.count`](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/#metric-jvmthreadcount) metric. Split by the `jvm.thread.state` attribute (e.g. `runnable`, `blocked`, `waiting`, `timed_waiting`). | ### JVM Buffers | Metric | Description | Chart Type | How is it Calculated? | | - | - | - | - | | Buffer Memory Used | Memory used by buffers (in bytes), per buffer pool. | Line chart, one line per buffer pool | From the [`jvm.buffer.memory.used`](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/#metric-jvmbuffermemoryused) metric. Split by the `jvm.buffer.pool.name` attribute (e.g. `mapped`, `direct`). | | Buffer Memory Limit | Total memory capacity of buffers (in bytes), per buffer pool. | Line chart, one line per buffer pool | From the [`jvm.buffer.memory.limit`](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/#metric-jvmbuffermemorylimit) metric. Split by the `jvm.buffer.pool.name` attribute. | | Buffer Count | Number of buffers, per buffer pool. | Line chart, one line per buffer pool | From the [`jvm.buffer.count`](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/#metric-jvmbuffercount) metric. Split by the `jvm.buffer.pool.name` attribute. | ### JVM Classes | Metric | Description | Chart Type | How is it Calculated? | | - | - | - | - | | Classes Loaded | Number of classes loaded since the JVM started. | Line chart | From the [`jvm.class.loaded`](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/#metric-jvmclassloaded) metric. | | Classes Unloaded | Number of classes unloaded since the JVM started. | Line chart | From the [`jvm.class.unloaded`](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/#metric-jvmclassunloaded) metric. | | Class Count | Number of classes currently loaded. | Line chart | From the [`jvm.class.count`](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/#metric-jvmclasscount) metric. | ### JVM CPU | Metric | Description | Chart Type | How is it Calculated? | | - | - | - | - | | CPU Time | CPU time used by the process (in seconds). | Line chart | From the [`jvm.cpu.time`](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/#metric-jvmcputime) metric. | | CPU Count | Number of processors available to the JVM. | Line chart | From the [`jvm.cpu.count`](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/#metric-jvmcpucount) metric. | | System CPU Utilization | Recent CPU utilization for the whole system, were the value range is \[0.0,1.0]. | Line chart | From the [`jvm.system.cpu.utilization`](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/#metric-jvmsystemcpuutilization) metric. This metric is [Opt-In](https://opentelemetry.io/docs/specs/semconv/general/metric-requirement-level/#opt-in). | | System CPU Load (1m) | Average CPU load for the whole system over the last minute, where the value range is \[0.0,n], where n is the number of CPU cores. | Line chart | From the [`jvm.system.cpu.load_1m`](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/#metric-jvmsystemcpuload_1m) metric. This metric is [Opt-In](https://opentelemetry.io/docs/specs/semconv/general/metric-requirement-level/#opt-in). | ### JVM File Descriptors | Metric | Description | Chart Type | How is it Calculated? | | - | - | - | - | | File Descriptor Count | Number of open file descriptors. | Line chart | From the [`jvm.file_descriptor.count`](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/#metric-jvmfile_descriptorcount) metric. This metric is [Opt-In](https://opentelemetry.io/docs/specs/semconv/general/metric-requirement-level/#opt-in). | | File Descriptor Limit | Maximum number of open file descriptors. | Line chart | From the [`jvm.file_descriptor.limit`](https://opentelemetry.io/docs/specs/semconv/runtime/jvm-metrics/#metric-jvmfile_descriptorlimit) metric. This metric is [Opt-In](https://opentelemetry.io/docs/specs/semconv/general/metric-requirement-level/#opt-in) | ## Example Service To see these metrics in action, checkout our example apps for working Java services with Trace0 installed: | Example | Environment | | - | - | | [Java DynamoDB Docker example app](https://github.com/Trace0-HQ/trace0-examples/tree/main/java-javalin-docker) | Docker | | [Java PostgreSQL Docker example app](https://github.com/Trace0-HQ/trace0-examples/tree/main/java-postgres-docker) | Docker | | [Java EC2 example app](https://github.com/Trace0-HQ/trace0-examples/tree/main/java-javalin-ec2) | AWS EC2 | | [Java ECS example app](https://github.com/Trace0-HQ/trace0-examples/tree/main/java-javalin-ecs) | AWS ECS | | [OpenTelemetry demo app](https://github.com/Trace0-HQ/opentelemetry-demo) | Docker/Kubernetes | # Node.js Metrics Source: https://docs.trace0hq.com/platform/metrics/application-metrics/node-metrics Monitor Node.js & V8 runtime metrics including request latency, memory usage, event loop delays, etc. ## How are Metrics Calculated? In Trace0, JavaScript metrics come from the following two OpenTelemetry sources: * **Requests metrics** are calculated from the service's `SPAN_KIND_SERVER` spans, one per request the service handles. Request count, requests per second, latency percentiles and errors are all derived from these spans and their durations and statuses. * **JavaScript runtime metrics** (Memory, Garbage Collection, Resources and Event Loop) are calculated from the OpenTelemetry metrics the JavaScript runtime reports, as defined by the [OpenTelemetry semantic conventions for V8 JS metrics](https://opentelemetry.io/docs/specs/semconv/runtime/v8js-metrics/) and the [OpenTelemetry semantic conventions for Node.js metrics](https://opentelemetry.io/docs/specs/semconv/runtime/nodejs-metrics/). ## Service Instances **JavaScript runtime metrics** are reported separately by each instance of your service, so we show them for one instance at a time. **Requests metrics** are calculated from spans and cover all instances. We identify an instance using one of the following OpenTelemetry resource attributes, in order of preference: | Preference | Instance Type | Resource Attribute | | - | - | - | | 1 | ECS Task | [`aws.ecs.task.arn`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/aws/) | | 2 | Service Instance | [`service.instance.id`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/service/) | | 3 | Container (e.g. Docker) | [`container.id`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/container/) | | 4 | Host | [`host.id`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/host/) | Select an instance from the instance filter to view its JavaScript runtime metrics. If your service doesn't report any of these attributes, JavaScript runtime metrics are not shown. ![JavaScript Metrics Light](https://mintcdn.com/trace0/-cXiA7TpqhYGed3B/images/javascript-runtime-metrics-light.png?fit=max\&auto=format\&n=-cXiA7TpqhYGed3B\&q=85\&s=961b705391d4c0789f94c2c613e5951c) > [!NOTE] > > JavaScript runtime metrics aren't shown for serverless runtimes (e.g. `AWS Lambda`), as each execution environment is short-lived and its runtime metrics aren't meaningful on their own. Serverless-specific metrics (e.g. cold starts) are coming soon. ## Aggregation Temporality OpenTelemetry Sum metrics (Counters and UpDownCounters) and Histogram metrics are reported with an [aggregation temporality](https://opentelemetry.io/docs/specs/otel/metrics/data-model/#temporality), which decides what each reported data point means. We use the most recent aggregation temporality the service reported for the metric in the selected period. An aggregation temporality can either be `Cumulative` or `Delta`. | Metric Type | Cumulative | Delta | | - | - | - | | `Sum (Counter, UpDownCounter)` | Each data point is a running total since the process started. We show the most recent value reported in each interval. | Each data point is the change since the previous export. We add up the values reported in each interval. | | `Histogram` | Each data point holds each bucket's running total since the process started. We show each bucket's most recent count in the selected period. | Each data point holds each bucket's count since the previous export. We add up each bucket's counts across the selected period. | `Gauge` and `Summary` metrics don't have an aggregation temporality, so this doesn't apply to them. ## Metrics We currently display the following application metrics for services running on JavaScript runtimes that use the V8 engine (e.g. Node.js): ### Requests **Single Value** | Metric | Unit | | - | - | | Request Count | Number | | Requests per Second | Number | | Request Latency P99 | Time (ms, s) | | Error Rate | Percentage | **Chart** | Metric | Description | Chart Type | | - | - | - | | Request Latency P99, P95, P90, P75, P50 | Latency percentile distribution | Line chart | | Requests & Errors | Request volume vs error volume | Histogram | | Errors | Error volume over time | Histogram | | Requests By Endpoint | Request details (count, latency, errors) per endpoint. | Table, one row per endpoint | ### V8 JS Memory | Metric | Description | Chart Type | How is it Calculated? | | - | - | - | - | | Heap Space Used | Heap memory used (in bytes), per heap space. | Line chart, one line per heap space | From the [`v8js.memory.heap.used`](https://opentelemetry.io/docs/specs/semconv/runtime/v8js-metrics/#metric-v8jsmemoryheapused) metric. Split by the `v8js.heap.space.name` attribute (e.g. `new_space`, `old_space`). | | Heap Space Size | Total heap memory size (in bytes) allocated, per heap space. | Line chart, one line per heap space | From the [`v8js.memory.heap.space.size`](https://opentelemetry.io/docs/specs/semconv/runtime/v8js-metrics/#metric-v8jsmemoryheapspacesize) metric. Split by the `v8js.heap.space.name` attribute. | | Heap Space Available Size | Heap memory (in bytes) still available, per heap space. | Line chart, one line per heap space | From the [`v8js.memory.heap.space.available_size`](https://opentelemetry.io/docs/specs/semconv/runtime/v8js-metrics/#metric-v8jsmemoryheapspaceavailable_size) metric. Split by the `v8js.heap.space.name` attribute. | | Heap Space Physical Size | Physical memory (in bytes) committed, per heap space. | Line chart, one line per heap space | From the [`v8js.memory.heap.space.physical_size`](https://opentelemetry.io/docs/specs/semconv/runtime/v8js-metrics/#metric-v8jsmemoryheapspacephysical_size) metric. Split by the `v8js.heap.space.name` attribute. | ### V8 JS Garbage Collection | Metric | Description | Chart Type | How is it Calculated? | | - | - | - | - | | GC Duration | Distribution of how long (in seconds) garbage collection actions take, per GC type. | OpenTelemetry histogram, one per GC type | From the [`v8js.gc.duration`](https://opentelemetry.io/docs/specs/semconv/runtime/v8js-metrics/#metric-v8jsgcduration) Histogram metric. Split by the `v8js.gc.type` attribute (e.g. `major`, `minor`, `incremental`). | ### V8 JS Resources | Metric | Description | Chart Type | How is it Calculated? | | - | - | - | - | | Active Resources | Number of active resources keeping the event loop alive (e.g. timers, sockets), per resource type. | Line chart, one line per resource type | From the [`v8js.resource.active`](https://opentelemetry.io/docs/specs/semconv/runtime/v8js-metrics/#metric-v8jsresourceactive) metric. Split by the `v8js.resource.type` attribute (e.g. `Timeout`, `TCPSocketWrap`). | ### Node.js Event Loop | Metric | Description | Chart Type | How is it Calculated? | | - | - | - | - | | Event Loop Delay | Event loop delay (in seconds) at the 50th, 90th and 99th percentiles. | Line chart, one line per percentile | From the [`nodejs.eventloop.delay.p50`](https://opentelemetry.io/docs/specs/semconv/runtime/nodejs-metrics/#metric-nodejseventloopdelayp50), [`nodejs.eventloop.delay.p90`](https://opentelemetry.io/docs/specs/semconv/runtime/nodejs-metrics/#metric-nodejseventloopdelayp90) and [`nodejs.eventloop.delay.p99`](https://opentelemetry.io/docs/specs/semconv/runtime/nodejs-metrics/#metric-nodejseventloopdelayp99) metrics, shown together on one chart. | | Event Loop Delay Stats | Mean, minimum and maximum event loop delay (in seconds). | Line chart, one line each for mean, min and max | From the [`nodejs.eventloop.delay.mean`](https://opentelemetry.io/docs/specs/semconv/runtime/nodejs-metrics/#metric-nodejseventloopdelaymean), [`nodejs.eventloop.delay.min`](https://opentelemetry.io/docs/specs/semconv/runtime/nodejs-metrics/#metric-nodejseventloopdelaymin) and [`nodejs.eventloop.delay.max`](https://opentelemetry.io/docs/specs/semconv/runtime/nodejs-metrics/#metric-nodejseventloopdelaymax) metrics, shown together on one chart. | | Event Loop Delay Standard Deviation | Standard deviation of the event loop delay (in seconds). | Line chart | From the [`nodejs.eventloop.delay.stddev`](https://opentelemetry.io/docs/specs/semconv/runtime/nodejs-metrics/#metric-nodejseventloopdelaystddev) metric. | | Event Loop Utilization | Fraction of time the event loop was busy, as a ratio from 0 to 1. | Line chart | From the [`nodejs.eventloop.utilization`](https://opentelemetry.io/docs/specs/semconv/runtime/nodejs-metrics/#metric-nodejseventlooputilization) metric. | | Event Loop Time | Time (in seconds) the event loop spent in each state. | Line chart, one line per state | From the [`nodejs.eventloop.time`](https://opentelemetry.io/docs/specs/semconv/runtime/nodejs-metrics/#metric-nodejseventlooptime) metric. Split by the `nodejs.eventloop.state` attribute (`active`, `idle`). | ## Example Service To see these metrics in action, check out our example apps for working Node.js services with Trace0 installed: | Example | Environment | | - | - | | [Node.js Express Docker example app](https://github.com/Trace0-HQ/trace0-examples/tree/main/node-js-express-docker) | Docker | | [Node.js MongoDB Docker example app](https://github.com/Trace0-HQ/trace0-examples/tree/main/node-js-mongodb-docker) | Docker | | [Node.js Express EC2 example app](https://github.com/Trace0-HQ/trace0-examples/tree/main/node-js-express-ec2) | AWS EC2 | | [OpenTelemetry demo app](https://github.com/Trace0-HQ/opentelemetry-demo) | Docker/Kubernetes | # Python Metrics Source: https://docs.trace0hq.com/platform/metrics/application-metrics/python-metrics Monitor Python metrics including request latency, memory usage, thread counts, etc. ## How are Metrics Calculated? In Trace0, Python metrics come from the following two OpenTelemetry sources: * **Requests metrics** are calculated from the service's `SPAN_KIND_SERVER` spans, one per request the service handles. Request count, requests per second, latency percentiles and errors are all derived from these spans and their durations and statuses. * **Python runtime metrics** (Threads and Garbage Collection) are calculated from the OpenTelemetry metrics the Python runtime reports, as defined by the [OpenTelemetry semantic conventions for CPython metrics](https://opentelemetry.io/docs/specs/semconv/runtime/cpython-metrics/). ## Service Instances **Python runtime metrics** are reported separately by each instance of your service, so we show them for one instance at a time. **Requests metrics** are calculated from spans and cover all instances. We identify an instance using one of the following OpenTelemetry resource attributes, in order of preference: | Preference | Instance Type | Resource Attribute | | - | - | - | | 1 | ECS Task | [`aws.ecs.task.arn`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/aws/) | | 2 | Service Instance | [`service.instance.id`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/service/) | | 3 | Container (e.g. Docker) | [`container.id`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/container/) | | 4 | Host | [`host.id`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/host/) | Select an instance from the instance filter to view its Python runtime metrics. If your service doesn't report any of these attributes, Python runtime metrics are not shown. ![Python Metrics Light](https://mintcdn.com/trace0/o9z_CbHSumuajDnM/images/python-runtime-metrics-light.png?fit=max\&auto=format\&n=o9z_CbHSumuajDnM\&q=85\&s=d24f2a9d35082c1ee72286cf17cb9f10) > [!NOTE] > > Python runtime metrics aren't shown for serverless runtimes (e.g. `AWS Lambda`), as each execution environment is short-lived and its runtime metrics aren't meaningful on their own. Serverless-specific metrics (e.g. cold starts) are coming soon. ## Aggregation Temporality OpenTelemetry Sum metrics (Counters and UpDownCounters) and Histogram metrics are reported with an [aggregation temporality](https://opentelemetry.io/docs/specs/otel/metrics/data-model/#temporality), which decides what each reported data point means. We use the most recent aggregation temporality the service reported for the metric in the selected period. An aggregation temporality can either be `Cumulative` or `Delta`. | Metric Type | Cumulative | Delta | | - | - | - | | `Sum (Counter, UpDownCounter)` | Each data point is a running total since the process started. We show the most recent value reported in each interval. | Each data point is the change since the previous export. We add up the values reported in each interval. | | `Histogram` | Each data point holds each bucket's running total since the process started. We show each bucket's most recent count in the selected period. | Each data point holds each bucket's count since the previous export. We add up each bucket's counts across the selected period. | `Gauge` and `Summary` metrics don't have an aggregation temporality, so this doesn't apply to them. ## Metrics We currently display the following application metrics for services running on Python: ### Requests **Single Value** | Metric | Unit | | - | - | | Request Count | Number | | Requests per Second | Number | | Request Latency P99 | Time (ms, s) | | Error Rate | Percentage | **Chart** | Metric | Description | Chart Type | | - | - | - | | Request Latency P99, P95, P90, P75, P50 | Latency percentile distribution | Line chart | | Requests & Errors | Request volume vs error volume | Histogram | | Errors | Error volume over time | Histogram | | Requests By Endpoint | Request details (count, latency, errors) per endpoint. | Table, one row per endpoint | ### Python Threads | Metric | Description | Chart Type | How is it Calculated? | | - | - | - | - | | OS Thread Count | Number of operating system threads used by the process. | Line chart | From the [`process.thread.count`](https://opentelemetry.io/docs/specs/semconv/system/process-metrics/#metric-processthreadcount) metric. This is a general process metric rather than a CPython one, but we show it with the Python metrics because what it measures depends on the runtime. | ### Python Garbage Collection | Metric | Description | Chart Type | How is it Calculated? | | - | - | - | - | | GC Collections | Number of times each garbage collector generation has been collected. | Line chart, one line per generation | From the [`cpython.gc.collections`](https://opentelemetry.io/docs/specs/semconv/runtime/cpython-metrics/#metric-cpythongccollections) metric. Split by the `cpython.gc.generation` attribute (e.g. `Generation 0`, `Generation 1`). | | GC Collected Objects | Number of objects collected by the garbage collector, per generation. | Line chart, one line per generation | From the [`cpython.gc.collected_objects`](https://opentelemetry.io/docs/specs/semconv/runtime/cpython-metrics/#metric-cpythongccollected_objects) metric. Split by the `cpython.gc.generation` attribute. | | GC Uncollectable Objects | Number of objects the garbage collector found but could not collect, per generation. | Line chart, one line per generation | From the [`cpython.gc.uncollectable_objects`](https://opentelemetry.io/docs/specs/semconv/runtime/cpython-metrics/#metric-cpythongcuncollectable_objects) metric. Split by the `cpython.gc.generation` attribute. | ## Example Service To see these metrics in action, see our example apps for working Python services with Trace0 installed: | Example | Environment | | - | - | | [Python FastAPI Docker example app](https://github.com/Trace0-HQ/trace0-examples/tree/main/python-fast-api-docker) | Docker | | [Python Redis Docker example app](https://github.com/Trace0-HQ/trace0-examples/tree/main/python-redis-docker) | Docker | | [Python FastAPI EC2 example app](https://github.com/Trace0-HQ/trace0-examples/tree/main/python-fast-api-ec2) | AWS EC2 | | [OpenTelemetry demo app](https://github.com/Trace0-HQ/opentelemetry-demo) | Docker/Kubernetes | # Cloud Service Metrics Source: https://docs.trace0hq.com/platform/metrics/cloud-service-metrics Monitor cloud service metrics including latency, error rates, and more across the cloud services used by your systems. ### Introduction Trace0 collects metrics for calls your application makes to managed cloud services, such as [Amazon S3](https://aws.amazon.com/s3/), [KMS](https://aws.amazon.com/kms/), and [SES](https://aws.amazon.com/ses/). Calls made through the AWS SDK are captured automatically, and for each service you can see request rate, latency, and error rate, broken down by operation. To view metrics for a cloud service used by one of your services, click into the [Metrics](https://app.trace0hq.com/metrics) section, click the `View more` link for your service, then click the toggle for the cloud service you are interested in. The following example uses `S3`: ![S3 Request Metrics Light](https://mintcdn.com/trace0/0QaZt-kUINeweLGO/images/s3-requests-metrics-light.png?fit=max\&auto=format\&n=0QaZt-kUINeweLGO\&q=85\&s=1b0aa0631f374ce2a326d3fc2879dfcf) And this example uses `KMS`: ![KMS Request Metrics Light](https://mintcdn.com/trace0/SUvD37fyOoYNA1fl/images/kms-requests-metrics-light.png?fit=max\&auto=format\&n=SUvD37fyOoYNA1fl\&q=85\&s=abe36513ee333c1629989a37cc35c8d9) ### Displayed Metrics The metrics are displayed either as a single value or as a chart. **Single Value** | Metric | Unit | | - | - | | Request Count | Number | | Requests per Second | Number | | Request Latency P99 | Time (ms, s) | | Error Rate | Percentage | **Chart** | Metric | Description | Chart Type | | - | - | - | | Request Count by Operation | Number of database requests grouped by operation | Horizontal Bar chart | | P99 Latency by Operation | P99 request latency grouped by operation | Horizontal Bar chart | | Request Count Over Time | Number of requests over time | Vertical Bar chart | | Latency Over Time | P50, P75, P90, P95, and P99 request latency over time | Line chart | # Database Metrics Source: https://docs.trace0hq.com/platform/metrics/database-metrics Monitor database metrics including latency, error rates, and more across the most popular database systems. Trace0 provides detailed metrics for each of the following database systems: * [DynamoDB](/platform/metrics/database-metrics/dynamodb-metrics) * [Redis](/platform/metrics/database-metrics/redis-metrics) * [PostgreSQL](/platform/metrics/database-metrics/postgresql-metrics) * [MongoDB](/platform/metrics/database-metrics/mongodb-metrics) Trace0 also provides metrics for any database system that exports its telemetry data using [OpenTelemetry database semantic conventions](https://opentelemetry.io/docs/specs/semconv/registry/attributes/db/). # DynamoDB Metrics Source: https://docs.trace0hq.com/platform/metrics/database-metrics/dynamodb-metrics Monitor DynamoDB metrics including latency, error rates, and usage per table & operation. ### Introduction Trace0 provides detailed metrics for [DynamoDB](https://aws.amazon.com/dynamodb/), based on the [OpenTelemetry semantic conventions for client operations](https://opentelemetry.io/docs/specs/semconv/db/dynamodb/). To view metrics for DynamoDB for a service, click into the [Metrics](https://app.trace0hq.com/metrics) section, click the `View more` link for your service, then click the `DynamoDB` toggle. ![Database Metrics Light](https://mintcdn.com/trace0/SKZVm8f8A07OApcW/images/dynamodb-metrics-light.png?fit=max\&auto=format\&n=SKZVm8f8A07OApcW\&q=85\&s=ddf9245f772c77cc2dd3b071f0ae5dce) ![Database Operation Metrics Light](https://mintcdn.com/trace0/QDOQ8yTurtv_PZrF/images/dynamodb-operation-metrics-light.png?fit=max\&auto=format\&n=QDOQ8yTurtv_PZrF\&q=85\&s=0f007d1392394b1fb7b1f1bd401f56bd) ### Metrics We currently display the following DynamoDB metrics: **Single Value** | Metric | Unit | | - | - | | Request Count | Number | | Requests per Second | Number | | Request Latency P99 | Time (ms, s) | | Error Rate | Percentage | **Chart** | Metric | Description | Chart Type | | - | - | - | | Request Count by Table | Number of database requests grouped by table | Horizontal Bar chart | | P99 Latency by Table | P99 request latency grouped by table | Horizontal Bar chart | | Request Count by Operation | Number of database requests grouped by operation | Horizontal Bar chart | | P99 Latency by Operation | P99 request latency grouped by operation | Horizontal Bar chart | | Request Count Over Time | Number of database requests over time | Vertical Bar chart | | Latency Over Time | P50, P75, P90, P95, and P99 request latency over time | Line chart | ## Examples See our example apps for working services that uses DynamoDB with Trace0 installed: | Example | Environment | | - | - | | [Node.js Express Docker DynamoDB example app](https://github.com/Trace0-HQ/trace0-examples/tree/main/node-js-express-docker) | Docker (local) | | [Node.js Express EC2 DynamoDB example app](https://github.com/Trace0-HQ/trace0-examples/tree/main/node-js-express-ec2) | AWS EC2 | | [Node.js Lambda DynamoDB example app](https://github.com/Trace0-HQ/trace0-examples/tree/main/node-js-lambda) | AWS Lambda | | [Python FastAPI Docker DynamoDB example app](https://github.com/Trace0-HQ/trace0-examples/tree/main/python-fast-api-docker) | Docker (local) | | [Python FastAPI EC2 DynamoDB example app](https://github.com/Trace0-HQ/trace0-examples/tree/main/python-fast-api-ec2) | AWS EC2 | | [Python Lambda DynamoDB example app](https://github.com/Trace0-HQ/trace0-examples/tree/main/python-lambda) | AWS Lambda | | [Java Docker DynamoDB example app](https://github.com/Trace0-HQ/trace0-examples/tree/main/java-javalin-docker) | Docker (local) | | [Java Lambda DynamoDB example app](https://github.com/Trace0-HQ/trace0-examples/tree/main/java-lambda) | AWS Lambda | # MongoDB Metrics Source: https://docs.trace0hq.com/platform/metrics/database-metrics/mongodb-metrics Monitor MongoDB metrics including latency, error rates and usage per collection and operation, as well as connection pool metrics. ## Introduction Trace0 provides detailed metrics for [MongoDB](https://www.mongodb.com/), based on the [OpenTelemetry semantic conventions for client operations](https://opentelemetry.io/docs/specs/semconv/db/mongodb). To view metrics for MongoDB for a service, click into the [Metrics](https://app.trace0hq.com/metrics) section, click the `View more` link for your service, then click the `MongoDB` toggle. ![MongoDB Request Metrics Light](https://mintcdn.com/trace0/D4PeHpz2C0xzRHMV/images/mongodb-requests-metrics-light.png?fit=max\&auto=format\&n=D4PeHpz2C0xzRHMV\&q=85\&s=47e3d72c334d7f770a10a4bc2d9aeb8c) ![MongoDB Connection Pool Metrics Light](https://mintcdn.com/trace0/D4PeHpz2C0xzRHMV/images/mongodb-connection-pool-metrics-light.png?fit=max\&auto=format\&n=D4PeHpz2C0xzRHMV\&q=85\&s=acd31a809cdf57c234db7cebf2f8f931) ## Metrics We currently display the following MongoDB metrics: ### Requests **Single Value** | Metric | Unit | | - | - | | Request Count | Number | | Requests per Second | Number | | Request Latency P99 | Time (ms, s) | | Error Rate | Percentage | **Chart** | Metric | Description | Chart Type | | - | - | - | | Request Count by Collection | Number of database requests grouped by collection | Horizontal Bar chart | | P99 Latency by Collection | P99 request latency grouped by collection | Horizontal Bar chart | | Request Count by Operation | Number of database requests grouped by operation | Horizontal Bar chart | | P99 Latency by Operation | P99 request latency grouped by operation | Horizontal Bar chart | | Request Count Over Time | Number of database requests over time | Vertical Bar chart | | Latency Over Time | P50, P75, P90, P95, and P99 request latency over time | Line chart | ### Connection Pools | Metric | Description | Chart Type | | - | - | - | | Connection Count | Number of used and idle connections over time for each connection pool | Line chart | | Connection Create Time | Time taken to create a database connection for each connection pool, grouped into duration ranges (in seconds) with the count of occurrences in each range | Histogram, one per connection pool | ## Examples See our example apps for working services that uses MongoDB with Trace0 installed: | Example | Environment | | - | - | | [Node.js Docker MongoDB example app](https://github.com/Trace0-HQ/trace0-examples/tree/main/node-js-mongodb-docker) | Docker (local) | # PostgreSQL Metrics Source: https://docs.trace0hq.com/platform/metrics/database-metrics/postgresql-metrics Monitor PostgreSQL metrics including latency, error rates and usage per table and operation, as well as connection pool metrics. ## Introduction Trace0 provides detailed metrics for [PostgreSQL](https://www.postgresql.org/), based on the [OpenTelemetry semantic conventions for client operations](https://opentelemetry.io/docs/specs/semconv/db/postgresql). To view metrics for PostgreSQL for a service, click into the [Metrics](https://app.trace0hq.com/metrics) section, click the `View more` link for your service, then click the `PostgreSQL` toggle. ![PostgreSQL Request Metrics Light](https://mintcdn.com/trace0/tccR7EIMt6xo1TOV/images/postgres-requests-metrics-light.png?fit=max\&auto=format\&n=tccR7EIMt6xo1TOV\&q=85\&s=350ac41ac1764cdcb903707c0808ec53) ![PostgreSQL Connection Pool Metrics Light](https://mintcdn.com/trace0/qgOLYXLDkBHaw0YG/images/postgres-connection-pool-metrics-light.png?fit=max\&auto=format\&n=qgOLYXLDkBHaw0YG\&q=85\&s=0713dbf6f5b6482c1cf416ae6c57185f) ## Metrics We currently display the following PostgreSQL metrics: ### Requests **Single Value** | Metric | Unit | | - | - | | Request Count | Number | | Requests per Second | Number | | Request Latency P99 | Time (ms, s) | | Error Rate | Percentage | **Chart** | Metric | Description | Chart Type | | - | - | - | | Request Count by Table | Number of database requests grouped by table | Horizontal Bar chart | | P99 Latency by Table | P99 request latency grouped by table | Horizontal Bar chart | | Request Count by Operation | Number of database requests grouped by operation | Horizontal Bar chart | | P99 Latency by Operation | P99 request latency grouped by operation | Horizontal Bar chart | | Request Count Over Time | Number of database requests over time | Vertical Bar chart | | Latency Over Time | P50, P75, P90, P95, and P99 request latency over time | Line chart | > [!NOTE] > > SQL commands containing multiple statements are not attributed to a specific table or operation, and are therefore excluded from request count and latency metrics for individual tables and operations. ### Connection Pools | Metric | Description | Chart Type | | - | - | - | | Connection Count | Number of used and idle connections over time for each connection pool | Line chart | | Connection Create Time | Time taken to create a database connection for each connection pool, grouped into duration ranges (in seconds) with the count of occurrences in each range | Histogram, one per connection pool | ## Examples See our example apps for working services that uses PostgreSQL with Trace0 installed: | Example | Environment | | - | - | | [Java Docker PostgreSQL example app](https://github.com/Trace0-HQ/trace0-examples/blob/main/java-postgres-docker) | Docker (local) | # Redis Metrics Source: https://docs.trace0hq.com/platform/metrics/database-metrics/redis-metrics Monitor Redis metrics including latency, error rates and usage per operation, as well as connection pool metrics. ## Introduction Trace0 provides detailed metrics for [Redis](https://redis.io/), based on the [OpenTelemetry semantic conventions for client operations](https://opentelemetry.io/docs/specs/semconv/db/redis/). To view metrics for Redis for a service, click into the [Metrics](https://app.trace0hq.com/metrics) section, click the `View more` link for your service, then click the `Redis` toggle. ![Redis Request Metrics Light](https://mintcdn.com/trace0/zVa0ECWy-JAzt0KH/images/redis-requests-metrics-light.png?fit=max\&auto=format\&n=zVa0ECWy-JAzt0KH\&q=85\&s=49f146243d535d145593276abf0b5aa7) ![Redis Connection Pool Metrics Light](https://mintcdn.com/trace0/zVa0ECWy-JAzt0KH/images/redis-connection-pool-metrics-light.png?fit=max\&auto=format\&n=zVa0ECWy-JAzt0KH\&q=85\&s=70bcfc804b28116935653dad488601ef) ## Metrics We currently display the following Redis metrics: ### Requests **Single Value** | Metric | Unit | | - | - | | Request Count | Number | | Requests per Second | Number | | Request Latency P99 | Time (ms, s) | | Error Rate | Percentage | **Chart** | Metric | Description | Chart Type | | - | - | - | | Request Count by Operation | Number of database requests grouped by operation | Horizontal Bar chart | | P99 Latency by Operation | P99 request latency grouped by operation | Horizontal Bar chart | | Request Count Over Time | Number of requests over time | Vertical Bar chart | | Latency Over Time | P50, P75, P90, P95, and P99 request latency over time | Line chart | ### Connection Pools | Metric | Description | Chart Type | | - | - | - | | Connection Count | Number of used and idle connections over time for each connection pool | Line chart | | Connection Create Time | Time taken to create a database connection for each connection pool, grouped into duration ranges (in seconds) with the count of occurrences in each range | Histogram, one per connection pool | > [!NOTE] > > For Connection Pool metrics to be available, your Redis client library must first be configured to export them. See [Redis's guide to native OpenTelemetry metrics for client libraries](https://redis.io/blog/native-opentelemetry-metrics-for-redis-client-libraries/) for full details. ## Examples See our example apps for working services that uses Redis with Trace0 installed: | Example | Environment | | - | - | | [Python Docker Redis example app](https://github.com/Trace0-HQ/trace0-examples/blob/main/python-redis-docker) | Docker (local) | # Transactions Source: https://docs.trace0hq.com/platform/transactions View and explore distributed traces across your services. In Trace0, a `Transaction` represents a single end-to-end trace across all services involved in handling a request — such as an inbound HTTP request, a message consumed from a queue, etc. A transaction contains all spans and logs with the same OpenTelemetry `traceId`. You can view the list of transactions for each of your services in the [Transactions](https://app.trace0hq.com/transactions) section: ![Transactions Light](https://mintcdn.com/trace0/hPor2uLPZutifyKW/images/transactions-light.png?fit=max\&auto=format\&n=hPor2uLPZutifyKW\&q=85\&s=432b7b6db5542d8f59acfb870556c844) * [Search](/platform/transactions/search/natural-language-search) * [Details](/platform/transactions/details) * [Errors](/platform/transactions/errors) * [Tags](/platform/transactions/tags) * [Asynchronous Transactions](/platform/transactions/transactions/asynchronous-transactions) # Asynchronous Transactions Source: https://docs.trace0hq.com/platform/transactions/asynchronous-transactions Asynchronous transactions are transactions triggered independently of the transaction that originally initiated them — for example, a Lambda function reading messages from an SQS queue, or an ECS task consuming messages from a Kafka topic. Unlike a typical synchronous call (e.g. an HTTP request), these transactions aren't a direct extension of the transaction that triggered them. This creates two challenges for standard trace visualization: 1. **Duration doesn't roll up naturally.** It wouldn't make sense to include the duration of a downstream transaction (e.g. an SQS consumer) as part of the duration of the transaction that produced the message (e.g. the producer Lambda) — the two run independently, often at completely different times. 2. **A single transaction can have multiple sources.** A consumer might process a batch of several messages in one invocation, and those messages could have been sent by different upstream transactions. For these reasons, asynchronous transactions aren't shown in the Flow section of the triggering transaction the way a normal synchronous call would be. Instead, they're linked via two dedicated sections on the Transaction screen: * `Consumed By` — the downstream transaction(s) that consumed the message(s) this transaction sent. * `Produced By` — the upstream transaction(s) that sent the message(s) this transaction consumed. ![Consumed By Transactions Section Light](https://mintcdn.com/trace0/KYgTFxblgaqcr-j-/images/consumed-by-transactions-section-light.png?fit=max\&auto=format\&n=KYgTFxblgaqcr-j-\&q=85\&s=0fa47ee43a3f5918a2ec641e73569a22) ![Produced By Transactions Section Light](https://mintcdn.com/trace0/Oj0ghb4ZaWHj8jhO/images/produced-by-transactions-section-light.png?fit=max\&auto=format\&n=Oj0ghb4ZaWHj8jhO\&q=85\&s=a5ab82c3cdd76a1b0b28e94a2793adfc) Each entry includes the transaction summary and a link to the detailed view for that transaction, so you can navigate between them directly. This makes it easy to answer questions such as: * Did any of my downstream async services fail? * Which transaction sent the message that triggered this one? # Transaction Details Source: https://docs.trace0hq.com/platform/transactions/details Explore individual transaction details. To view more details for a single transaction, click on it to see a full breakdown — its spans and logs arranged into a call tree, as well as the time taken across each component and service: ![Transaction Detail Flow Light](https://mintcdn.com/trace0/THImZi60MCcuCa16/images/transaction-detail-flow-light.png?fit=max\&auto=format\&n=THImZi60MCcuCa16\&q=85\&s=9d0911940b7ef6dea349e9c72486f98d) ![Transaction Detail Component Breakdown Light](https://mintcdn.com/trace0/THImZi60MCcuCa16/images/transaction-detail-breakdown-light.png?fit=max\&auto=format\&n=THImZi60MCcuCa16\&q=85\&s=17eb360b4fa4fa04d115b00377391ec3) ![Transaction Detail Service Breakdown Light](https://mintcdn.com/trace0/Za9NFCb-io7ibt36/images/transaction-detail-service-breakdown-light.png?fit=max\&auto=format\&n=Za9NFCb-io7ibt36\&q=85\&s=f9b28f220064ad634ace634b3acc929c) ![Transaction Detail Runtime Info Light](https://mintcdn.com/trace0/Qw5KYU6Mafs3lJXK/images/transaction-detail-runtime-info-light.png?fit=max\&auto=format\&n=Qw5KYU6Mafs3lJXK\&q=85\&s=5118f40197d1892808ee25ebc28e1c42) # Transaction Errors Source: https://docs.trace0hq.com/platform/transactions/errors Identify, investigate, and understand errors occurring within your application transactions. For transactions that fail, the transaction will appear as an error in Trace0, with the full error details and stack trace included: ![Transactions Light](https://mintcdn.com/trace0/MVzI_fCfhkM8e-vZ/images/transaction-error-light.png?fit=max\&auto=format\&n=MVzI_fCfhkM8e-vZ\&q=85\&s=b233af098f0aee55b99aa65f10fc7ec6) # Natural Language Search Source: https://docs.trace0hq.com/platform/transactions/search/natural-language-search Search your transactions by describing what you're looking for in plain English. ## Overview Natural Language Search lets you search your transactions by describing what you're looking for, rather than writing a query. For example: `failed requests that took longer than 50ms and involved at least one call to DynamoDB` Trace0 converts your search into a [Trace0QL](/platform/transactions/search/trace0ql) query, runs it, returns the matching transactions and shows the generated query in the `Trace0QL` query box to the right: ![Natural Language Search Light](https://mintcdn.com/trace0/L9un5Y7f7K7XbqHw/images/natural-language-search-light.png?fit=max\&auto=format\&n=L9un5Y7f7K7XbqHw\&q=85\&s=e785843d34fcbe6c913082d7948b6f36) ![Trace0QL Light](https://mintcdn.com/trace0/L9un5Y7f7K7XbqHw/images/trace0ql-light.png?fit=max\&auto=format\&n=L9un5Y7f7K7XbqHw\&q=85\&s=8785cc96c4860b543513d6ba5c8ea504) Because the `Trace0QL` query is shown, you can check that it matches what you meant, and edit it and run it again if it doesn't. A re-run query is run as written, without being converted again. The environment, service name and time range selected apply to your search, so you don't need to include them in it. ## What you can search for You can describe anything that [Trace0QL](/platform/transactions/search/trace0ql) can express: | You can describe | e.g. | | - | - | | The request | "failed requests that took longer than 50ms", "5xx errors on POST /orders" | | The calls it made | "called the users DynamoDB table", "made more than 10 postgres queries" | | How many calls, and which were slow | "two or more calls to KMS where one took longer than 29ms" | | Third-party APIs | "a call to the GitHub API that took longer than 300ms" | | Infrastructure | "cold starts in eu-west-1", "errors from pods in the payments namespace" | | Tags | "the tag user_id is 123", "tagged with user_name Dave Jones" | | Logs | "logged payment declined" | Durations can be given in any unit (e.g. `250µs`, `29ms`, `1.5 seconds`), and are converted to nanoseconds for you. ## Examples | Search | Trace0QL | | - | - | | duration was greater than 50ms and it failed | `duration > 50000000 AND error = true` | | the endpoint is /identities/verify | `endpoint contains /identities/verify` | | the endpoint is POST /identities/verify | `endpoint = "POST /identities/verify"` | | 5xx errors or timeouts from pods in the payments namespace | `(status_code >= 500 OR exception.type contains timeout) AND k8s.namespace.name = payments` | | involved a call to KMS that took longer than 29ms | `spans((rpc.service = AWSKMS OR rpc.service = Kms OR rpc.service = KMS) AND span.duration > 29000000) >= 1` | | made more than 10 postgres queries | `spans(db.system.name = postgresql) > 10` | | failed without calling S3 | `error = true AND spans(rpc.service = "Amazon S3" OR rpc.service = S3) = 0` | | failed requests where the orderId tag is ord_8812 | `error = true AND tag.orderId = ord_8812` | | requests that logged payment declined | `log contains "payment declined"` | ## Tips * Be specific about what you're looking for. "slow requests" has to guess what slow means, while "requests that took longer than 2 seconds" doesn't. * Describe one call with all its properties together, e.g. "a call to KMS that took longer than 29ms". This is converted to a single `spans(...)` condition, so the same call must match all of them. * Name tags by their key, e.g. "the tag user_id is 123". Trace0 only searches tags when your search mentions a tag or gives its key, so "requests from Dave" isn't treated as a tag search. * Name endpoints with their HTTP method (e.g. "POST /orders") to match only that method, or without it (e.g. "/orders") to match any method. * If a search can't be converted, or the query isn't what you meant, edit the query in the `Trace0QL` query box. Natural language search is a starting point, and `Trace0QL` gives you full control. ## Privacy Trace0 uses AI to convert your natural language query into a `Trace0QL` query. Only your search text is sent to an LLM to be converted to `Trace0QL`. Your transactions, spans, logs and tag values are not sent to the LLM. # Trace0QL Source: https://docs.trace0hq.com/platform/transactions/search/trace0ql Search your transactions by their requests, calls, infrastructure, tags and logs with Trace0QL. ## Intro Trace0 provides a query language called `Trace0QL` (Trace0 Query Language) that lets you search transactions in Trace0. It is similar to Grafana's TraceQL, but simpler to read and write, with native support for querying transaction logs and [tags](/platform/transactions/tags). A `Trace0QL` query is a list of [conditions](#conditions), combined with `AND` and `OR`. ![Trace0QL Light](https://mintcdn.com/trace0/L9un5Y7f7K7XbqHw/images/trace0ql-light.png?fit=max\&auto=format\&n=L9un5Y7f7K7XbqHw\&q=85\&s=8785cc96c4860b543513d6ba5c8ea504) You can write `Trace0QL` directly in the Trace0QL query box, or describe what you're looking for in plain English with [Natural Language Search](/platform/transactions/search/natural-language-search), which is converted to `Trace0QL` for you. Either way, the query that was run is shown in the Trace0QL query box, where you can edit it and run it again. With one query you can search across everything Trace0 knows about a transaction, such as: * the request(s) each service handled, e.g. its endpoint, duration and status code * the calls made, e.g. database queries, cloud service calls and requests to third-party APIs * the infrastructure it ran on, e.g. the ECS task, Kubernetes pod or region * the [tags](/platform/transactions/tags) your services added, e.g. a user ID * the logs it wrote The time range and service selected on the page apply to every query, so they aren't part of the query itself. ## Basics ### Conditions A query is made of conditions, each in the form `attribute operator value`: ```trace0ql theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} status_code >= 500 ``` Join conditions with `AND` and `OR`. `AND` takes precedence over `OR`, as in most programming languages, and brackets can be used to change the order: ```trace0ql theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} error = true AND (endpoint contains /checkout OR duration > 1000000000) ``` `AND` and `OR` can be written in upper or lower case. Attribute names are case-sensitive. ### Values Values that contain spaces, brackets, quotes or any of the operator characters `= ! < >` must be double-quoted. Inside a quoted value, escape a double quote or backslash with a backslash: ```trace0ql theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} endpoint = "POST /orders" result contains "Connection refused" db.query.text contains "WHERE id = 5" ``` Values like `api.github.com`, `aws.dynamodb` and ARNs don't need quotes. Durations (`duration` and `span.duration`) are always in **nanoseconds**: | Duration | In nanoseconds | | - | - | | 250µs | `250000` | | 29ms | `29000000` | | 1.5s | `1500000000` | Boolean attributes take `true` or `false`, e.g. `error = true`. Numbers must not contain commas. ### Attributes There are four attribute scopes, which differ in what they match. #### Trace Record Trace Record attributes describe the request(s) each service in the transaction handled: | Attribute | Type | Description | | - | - | - | | `endpoint` | Text | The endpoint that handled the request, as the HTTP method and route, e.g. `POST /orders`. | | `duration` | Duration (ns) | How long the request took. | | `status_code` | Number | The HTTP status code of the response. | | `error` | Boolean | `true` if the request failed. | | `result` | Text | The exception type, if an exception was thrown. | | `summary` | Text | The transaction's summary. | | `service.name` | Text | The name of the service. | #### Span Span attributes describe the calls made while handling the request, and match if any span in the transaction matches. They use the [OpenTelemetry semantic convention](https://opentelemetry.io/docs/specs/semconv/registry/attributes/) names, e.g. `db.system.name`, `rpc.method`, `server.address`, etc. `span.duration` is a derived attribute calculated by Trace0 at ingestion time. It is calculated as follows: `span.endTimeUnixNano - span.startTimeUnixNano`. The value is always in nanoseconds. #### Resource Resource attributes describe the infrastructure the services ran on, and match if any service in the transaction ran on a matching resource. They use the [OpenTelemetry semantic convention](https://opentelemetry.io/docs/specs/semconv/registry/attributes/) names, e.g. `cloud.region`, `cloud.platform`, `aws.ecs.task.arn`, `k8s.pod.name`, etc. #### Tag [Tags](/platform/transactions/tags) are the custom key value pairs your services add, queried as `tag.`, e.g. `tag.user_id = 123`. A tag condition matches if any service in the transaction has the tag. Tag values are always text. The query box autocompletes every attribute you can use, including your environment's tag keys. When a service is selected, span conditions only match that service's own spans. Transaction attributes are for that service's requests, while resource attributes and tags still match any service in the transaction. *** You can hover over any attribute in a Trace0QL query to see its type (e.g. Text), scope (e.g. Span) and a More Details link. For example, the link for the `db.system.name` opens its [OpenTelemetry semantic convention](https://opentelemetry.io/docs/specs/semconv/registry/attributes/db/#db-system-name) page. ![Trace0QL Attribute Explainer Light](https://mintcdn.com/trace0/qrR-dq0OGMZ-T4of/images/trace0ql-attribute-explainer-light.png?fit=max\&auto=format\&n=qrR-dq0OGMZ-T4of\&q=85\&s=976af2f340c01e0950b1400696ecf53a) ### Logs Search the logs a transaction wrote with `log contains ""`: ```trace0ql theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} log contains "payment declined" AND status_code >= 400 ``` Log conditions match transactions with at least one log message containing every term, and must be joined to the rest of the query with `AND`, not used inside brackets, an `OR` or `spans(...)`. ### Matching the same call with spans(...) A span condition on its own matches if any span in the transaction matches it, so two span conditions joined with `AND` can be matched by two different spans. This query matches a transaction that made a fast KMS call and a separate slow database call: ```trace0ql theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} rpc.service = KMS AND span.duration > 29000000 ``` To require that the same span matches every condition, put them inside `spans(...)` and compare the number of matching spans with a count: ```trace0ql theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} spans(rpc.service = KMS AND span.duration > 29000000) >= 1 ``` `spans(...)` also lets you count calls. Each `spans(...)` is counted separately, so this finds transactions with two or more KMS calls, at least one of which took longer than 29ms: ```trace0ql theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} spans(rpc.service = KMS) >= 2 AND spans(rpc.service = KMS AND span.duration > 29000000) >= 1 ``` Only span attributes can be used inside `spans(...)`, and it can't be nested inside another `spans(...)`. The count can be compared with `=`, `!=`, `>`, `>=`, `<` or `<=`, and `= 0` finds transactions with no matching calls. ## Operators | Operator | Meaning | Use with | | - | - | - | | `=` | equals | all attributes | | `!=` | doesn't equal | all attributes | | `>` | greater than | number and duration attributes | | `>=` | greater than or equal to | number and duration attributes | | `<` | less than | number and duration attributes | | `<=` | less than or equal to | number and duration attributes | | `contains` | contains the value, ignoring case | text attributes and `log` | | `!contains` | doesn't contain the value, ignoring case | text attributes | | Keyword | Meaning | | - | - | | `AND` | both conditions must match | | `OR` | either condition must match | | `( )` | groups conditions, e.g. `a AND (b OR c)` | | `spans( ) ` | the number of spans that match every condition inside the brackets | `contains` is the best choice when you only know part of a value, e.g. an endpoint without its HTTP method: `endpoint contains /assessment.cancel`. ## Examples Failed requests that took longer than 50ms: ```trace0ql theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} error = true AND duration > 50000000 ``` Client errors only: ```trace0ql theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} status_code >= 400 AND status_code < 500 ``` Requests to one endpoint, with or without its HTTP method: ```trace0ql theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} endpoint = "POST /orders" endpoint contains /orders ``` Timeouts or server errors: ```trace0ql theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} status_code >= 500 OR exception.type contains timeout ``` Slow requests that read from a DynamoDB table: ```trace0ql theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} duration > 1000000000 AND spans(db.system.name = aws.dynamodb AND db.collection.name = users) >= 1 ``` Requests that made more than 10 Postgres queries (a possible N+1): ```trace0ql theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} spans(db.system.name = postgresql) > 10 ``` A slow call to a third-party API: ```trace0ql theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} spans(server.address contains api.github.com AND span.duration > 300000000) >= 1 ``` Failed requests that didn't call S3: ```trace0ql theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} error = true AND spans(rpc.service = "Amazon S3" OR rpc.service = S3) = 0 ``` Lambda cold starts in one region: ```trace0ql theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} faas.coldstart = true AND cloud.region = eu-west-1 ``` Server errors from one Kubernetes namespace: ```trace0ql theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} status_code >= 500 AND k8s.namespace.name = payments ``` Requests for one user, by tag: ```trace0ql theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} tag.user_id = 123 tag.user_name contains Dave ``` Requests that logged a message and returned an error: ```trace0ql theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} log contains "payment declined" AND status_code >= 400 ``` # Transaction Tags Source: https://docs.trace0hq.com/platform/transactions/tags Use tags to attach important business context to a transaction, such as a customer ID or order ID, Tags let you attach important business context to a transaction, such as a customer ID, order ID, tenant ID, etc. Tags use the `trace0.tag.*` namespace and can be added through logs or span attributes. **1. Logs** Tags can be included in standard log messages: ```java theme={null} log.info("Processing order trace0.tag.customer.id=12345"); ``` Or as fields when using structured logging: ```json theme={null} { "message":"Processing order", "trace0.tag.customer.id":"12345" } ``` ​**2. Span attributes** Tags can also be added directly as OpenTelemetry span attributes: ```java theme={null} span.setAttribute("trace0.tag.customer.id", "12345"); ``` Trace0 extracts these values and displays them as Tags on the corresponding transaction. ![Transaction Tags Light](https://mintcdn.com/trace0/k4iKF3hacuwsSLr5/images/transaction-tags-light.png?fit=max\&auto=format\&n=k4iKF3hacuwsSLr5\&q=85\&s=ca45b1868e554fc3bb5529abcb93a9af) You can include tags in natual language search and in Trace0QL queries. # Pricing Source: https://docs.trace0hq.com/pricing/pricing Simple, usage-based pricing with no surprises. Trace0 uses simple, usage-based pricing. You pay **\$0.60 per GB** of ingested data per month — nothing else. This includes 90-day retention and full access to all features. No seat fees, no per-service charges, no surprises. ## How Usage Is Calculated Your bill is based on the volume of telemetry data (spans, logs, and metrics) sent to Trace0, at **\$0.60 per GB per month**. > [card] Measured at ingestion > > Usage is recorded at the point data arrives at the Trace0 ingest endpoint. > [card] Before compression > > The uncompressed payload size is used — not the size of any transport-layer compression. > [card] After decoding protobuf > > Measurement is taken after the protobuf payload is decoded, reflecting the true data volume. # Security Source: https://docs.trace0hq.com/security/security How Trace0 protects your data. Security and data protection are fundamental to how Trace0 is designed and operated. We understand that observability data may contain sensitive operational and application information, and we treat it accordingly. ## Infrastructure & Hosting Trace0 is hosted on **Amazon Web Services (AWS)**, leveraging secure, managed cloud infrastructure designed for high availability, durability, and resilience. Trace0 currently operates exclusively within the AWS **eu-west-1 (Dublin, Ireland)** region. All customer data is stored and processed within this region. If you require your data to be stored in a different AWS region, please contact us at [hello@trace0hq.com](mailto:hello@trace0hq.com) to discuss your requirements. All production systems are deployed in isolated cloud environments with strict network controls and minimal exposure to the public internet. ## Encryption ### Encryption in Transit All data transmitted to and from Trace0 is encrypted using industry-standard **TLS 1.2+**. This includes: * Data ingestion endpoints * Web application traffic * Internal service-to-service communication Unencrypted connections are not permitted. ### Encryption at Rest Customer data is encrypted at rest using strong encryption standards (AES-256) provided by AWS. Encryption covers: * Logs * Traces * Metrics * Metadata * Backups Encryption keys are securely managed using AWS. ## Data Retention & Minimization Trace0 retains observability data for **30 days by default**. After the configured retention period: * Data is permanently deleted from active systems * No long-term archival copies are retained We believe in minimizing long-term data exposure and limiting the blast radius of any potential incident. ## Access Control Access to production systems is restricted to authorized personnel only and granted on a least-privilege basis. We enforce: * Strong authentication controls * Role-based access within the application * Restricted administrative access to infrastructure * Logged and auditable production access ## Data Isolation Customer data is logically isolated by account and environment. Access to one account does not grant access to another. All API access is authenticated and scoped to the requesting environment. ## Application Security Trace0 follows modern secure development practices, including: * Code review before deployment * Infrastructure-as-code for reproducible environments * Segregation of production and non-production environments * Controlled deployment pipelines Security updates and patches are applied promptly to underlying infrastructure and dependencies. ## Incident Response Trace0 maintains internal processes for identifying, responding to, and resolving security incidents. If a security event were to impact customer data, affected customers would be notified in accordance with applicable laws and contractual obligations. ## Responsible Disclosure We welcome responsible disclosure of security vulnerabilities. Please contact [hello@trace0hq.com](mailto:hello@trace0hq.com) — we will acknowledge receipt and investigate promptly. ## Compliance Roadmap Trace0 is committed to evolving its security posture as the company grows and customer requirements expand. Formal compliance certifications are part of our long-term roadmap. # Java - Containers & VMs Source: https://docs.trace0hq.com/setup/java/containers-and-vms Instrument a Java application with OpenTelemetry and send traces, metrics, and logs to Trace0. > [!NOTE] > > This guide covers Java applications running on **ECS**, **EC2**, **Kubernetes**, or any container/VM environment. For Java on AWS Lambda, see the [Java Lambda guide](/setup/java/lambda). ## 1. Install the OpenTelemetry Java Agent Download the latest `opentelemetry-javaagent.jar` from the [OpenTelemetry Java instrumentation releases](https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases) and attach it to your JVM startup: ```bash theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} java -javaagent:path/to/opentelemetry-javaagent.jar -jar myapp.jar ``` Alternatively, if you are using `Gradle`, you can use the [Gradle Javaagent Plugin](https://github.com/ryandens/javaagent-gradle-plugin#opentelemetry-integration) to attach the agent to your application. For full configuration options, see the official [OpenTelemetry Java Agent docs](https://opentelemetry.io/docs/zero-code/java/agent/). ## 2. Set Environment Variables Add the following environment variables to your application. Replace `YOUR_TRACE0_ENV_API_KEY` with the API key from your Trace0 environment. | Variable | Value | | - | - | | `OTEL_EXPORTER_OTLP_ENDPOINT` | `https://app.trace0hq.com/api` | | `OTEL_EXPORTER_OTLP_HEADERS` | `X-API-KEY=YOUR_TRACE0_ENV_API_KEY` | Also set the following additional environment variable for your cloud provider. > [tab] AWS > > | Variable | Value | > | - | - | > | `OTEL_RESOURCE_PROVIDERS_AWS_ENABLED` | `true` | > [tab] GCP > > | Variable | Value | > | - | - | > | `OTEL_RESOURCE_PROVIDERS_GCP_ENABLED` | `true` | > [tab] Azure > > | Variable | Value | > | - | - | > | `OTEL_RESOURCE_PROVIDERS_AZURE_ENABLED` | `true` | Alternatively, you can set all these environment variables in a YAML file using [declarative configuration](https://opentelemetry.io/docs/zero-code/java/agent/declarative-configuration/). ## 3. Kubernetes Setup If your application runs on Kubernetes, including `Amazon EKS`, `Google Kubernetes Engine` or `Azure Kubernetes Service`, add the following environment variables to your container specification. ```yaml theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} env: - name: K8S_POD_UID valueFrom: fieldRef: fieldPath: metadata.uid - name: K8S_POD_NAME valueFrom: fieldRef: fieldPath: metadata.name - name: K8S_NAMESPACE_NAME valueFrom: fieldRef: fieldPath: metadata.namespace - name: K8S_CONTAINER_NAME value: my-container-name - name: OTEL_RESOURCE_ATTRIBUTES value: k8s.pod.uid=$(K8S_POD_UID),k8s.pod.name=$(K8S_POD_NAME),k8s.namespace.name=$(K8S_NAMESPACE_NAME),k8s.container.name=$(K8S_CONTAINER_NAME) ``` ## 4. Deploy Service Deploy your service and watch traces, metrics, and logs appear in the [Trace0 dashboard](https://app.trace0hq.com) within seconds. ## Example Service See our example apps for working Java services with Trace0 installed: | Example | Environment | | - | - | | [Java DynamoDB Docker example app](https://github.com/Trace0-HQ/trace0-examples/tree/main/java-javalin-docker) | Docker | | [Java PostgreSQL Docker example app](https://github.com/Trace0-HQ/trace0-examples/tree/main/java-postgres-docker) | Docker | | [Java EC2 example app](https://github.com/Trace0-HQ/trace0-examples/tree/main/java-javalin-ec2) | AWS EC2 | | [Java ECS example app](https://github.com/Trace0-HQ/trace0-examples/tree/main/java-javalin-ecs) | AWS ECS | | [OpenTelemetry demo app](https://github.com/Trace0-HQ/opentelemetry-demo) | Docker/Kubernetes | # Java - AWS Lambda Source: https://docs.trace0hq.com/setup/java/lambda Instrument a Java Lambda function with OpenTelemetry and send traces, metrics, and logs to Trace0. ## Introduction For Java applications running on AWS Lambda, OpenTelemetry provides two instrumentation options: 1. **Java Agent layer** 2. **Wrapper layer** See the [OpenTelemetry Lambda Java documentation](https://github.com/open-telemetry/opentelemetry-lambda/blob/main/java/README.md) for details on each layer and guidance on choosing between them. The rest of this guide covers instrumentation using the `Java Agent` layer. ## 1. Add the OpenTelemetry Lambda Layer Find the latest `layer-javaagent` ARN for your AWS region from the [opentelemetry-lambda releases page](https://github.com/open-telemetry/opentelemetry-lambda/releases). Add the **JavaAgent** layer ARN to your function. ## 2. Add the Collector Lambda Extension Find the latest `layer-collector` ARN for your AWS region from the [opentelemetry-lambda releases page](https://github.com/open-telemetry/opentelemetry-lambda/releases). Add the layer ARN to your function and then add the following `collector.yaml` file to the root of your Lambda deployment folder. Replace `YOUR_TRACE0_ENV_API_KEY` with the API key from your Trace0 environment. ```yaml theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} receivers: telemetryapi: otlp: protocols: grpc: http: exporters: otlp_http/trace0: endpoint: https://app.trace0hq.com/api headers: X-API-KEY: 'YOUR_TRACE0_ENV_API_KEY' processors: batch: decouple: resource: attributes: - key: service.name value: "${env:OTEL_SERVICE_NAME}" action: upsert service: pipelines: traces: receivers: [otlp] processors: [resource, batch, decouple] exporters: [otlp_http/trace0] metrics: receivers: [otlp] processors: [resource, batch, decouple] exporters: [otlp_http/trace0] logs: receivers: [otlp, telemetryapi] processors: [resource, batch, decouple] exporters: [otlp_http/trace0] ``` ## 3. Set Environment Variables Add the following environment variables to your Lambda function. | Variable | Value | | - | - | | `OPENTELEMETRY_COLLECTOR_CONFIG_URI` | `/var/task/collector.yaml` | | `OTEL_EXPORTER_OTLP_ENDPOINT` | `http://localhost:4318` | | `OTEL_EXPORTER_OTLP_PROTOCOL` | `http/protobuf` | | `OTEL_SERVICE_NAME` | `YOUR_SERVICE_NAME` | | `OTEL_RESOURCE_PROVIDERS_AWS_ENABLED` | `true` | | `AWS_LAMBDA_EXEC_WRAPPER` | `/opt/otel-handler` | ## 4. Set HTTP request spans For lambdas triggered via API Gateway, the HTTP request and response attributes are not set automatically on the lambda invocation span by the OTel Lambda auto-instrumentation. Therefore, they need to be set manually in your lambda code handler. First, add the `opentelemetry-api` dependency to your project: > [tab] Gradle > > ```kotlin theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} > dependencies { > implementation("io.opentelemetry:opentelemetry-api:1.61.0") > } > ``` > [tab] Maven > > ```xml theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} > > io.opentelemetry > opentelemetry-api > 1.61.0 > runtime > > ``` Then add the HTTP request and response attributes to the Lambda invocation span in your handler: ```java theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} import com.amazonaws.services.lambda.runtime.Context; import com.amazonaws.services.lambda.runtime.RequestHandler; import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent; import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent; import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.StatusCode; public class Handler implements RequestHandler { @Override public APIGatewayProxyResponseEvent handleRequest(APIGatewayProxyRequestEvent event, Context context) { String httpMethod = event.getHttpMethod(); String path = event.getPath(); // Set the http request method and route on the parent span. Span span = Span.current(); span.setAttribute("http.request.method", httpMethod); span.setAttribute("http.route", path); APIGatewayProxyResponseEvent result = processRequest(event) // Set the HTTP response code and mark the span as failed for 4xx/5xx responses. span.setAttribute("http.response.status_code", result.getStatusCode()); span.setStatus(result.getStatusCode() < 400 ? StatusCode.OK : StatusCode.ERROR); return result; } } ``` ## 4. Deploy service Deploy your service and watch traces, metrics, and logs appear in the [Trace0 dashboard](https://app.trace0hq.com) within seconds. ## Example service See our [Java Lambda example app](https://github.com/Trace0-HQ/trace0-examples/tree/main/java-lambda) for a working service you can deploy to your AWS account. # Java - Spring Boot Source: https://docs.trace0hq.com/setup/java/spring-boot Instrument a Spring Boot application with OpenTelemetry and send traces, metrics, and logs to Trace0. > [!NOTE] > > This guide covers Spring Boot applications running on **ECS**, **EC2**, **Kubernetes**, or any container/VM environment. For Java on AWS Lambda, see the [Java Lambda guide](/setup/java/lambda). ## Introduction You can instrument Spring Boot applications with OpenTelemetry using one of two approaches: 1. [**OpenTelemetry Java Agent**](https://opentelemetry.io/docs/zero-code/java/agent) — uses bytecode instrumentation and provides the broadest out-of-the-box coverage, but has limitations around configuration and integration with other agents. 2. [**OpenTelemetry Spring Boot Starter**](https://spring.io/blog/2025/11/18/opentelemetry-with-spring-boot) — A lightweight, flexible alternative to the Java Agent. Choose this if any of the following apply: * You are using Spring Boot Native Image, which the Java agent does not support * The Java agent's startup overhead exceeds your requirements * You are already using another Java monitoring agent, which may conflict with the Otel Java agent. The `Spring Boot Starter` has less out-of-the-box instrumentation than the `Java Agent`. However, you can easily close this gap by adding standalone instrumentation libraries for the specific libraries/frameworks you want to instrument — see the [supported libraries list](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/supported-libraries.md). The rest of this guide covers instrumentation using the `Spring Boot Starter`. If you want to use the `Java Agent`, please follow our [Java — Containers & VMs](/setup/java/containers-and-vms) guide instead. ## 1. Add the OpenTelemetry Spring Boot Starter Add the following dependencies to your project: ```groovy Gradle theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} dependencies { implementation(platform("org.springframework.boot:spring-boot-dependencies:${springBootVersion}")) implementation 'org.springframework.boot:spring-boot-starter-opentelemetry' implementation 'org.springframework.boot:spring-boot-starter-micrometer-metrics' implementation('io.opentelemetry:opentelemetry-api') implementation "io.opentelemetry.instrumentation:opentelemetry-logback-appender-1.0:${opentelemetryVersion}" } ``` ```xml Maven theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} org.springframework.boot spring-boot-starter-parent org.springframework.boot spring-boot-starter-opentelemetry org.springframework.boot spring-boot-starter-micrometer-metrics io.opentelemetry opentelemetry-api io.opentelemetry.instrumentation opentelemetry-logback-appender-1.0 ${opentelemetry.version} ``` ## 2. Set Application Properties Add these properties to your `application.properties` file. Replace `YOUR_TRACE0_ENV_API_KEY` with the API key from your Trace0 environment. ```properties theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} management.opentelemetry.tracing.export.otlp.endpoint=https://app.trace0hq.com/api/v1/traces management.otlp.metrics.export.url=https://app.trace0hq.com/api/v1/metrics management.opentelemetry.logging.export.otlp.endpoint=https://app.trace0hq.com/api/v1/logs management.opentelemetry.tracing.export.otlp.headers.X-API-KEY=YOUR_TRACE0_ENV_API_KEY management.otlp.metrics.export.headers.X-API-KEY=YOUR_TRACE0_ENV_API_KEY management.opentelemetry.logging.export.otlp.headers.X-API-KEY=YOUR_TRACE0_ENV_API_KEY ``` ## 3. Add Standalone Instrumentation Libraries As discussed above, the Spring Boot Starter does not instrument most libraries out of the box. To instrument additional libraries and frameworks, you need to add the corresponding OpenTelemetry instrumentation libraries to your application. This ensures you receive spans from those libraries and gain full visibility into what is happening inside your application. The example below shows how to add instrumentation for the AWS SDK. ```groovy Gradle theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} dependencies { implementation "io.opentelemetry.instrumentation:opentelemetry-aws-sdk-2.2:${opentelemetryVersion}" } ``` ```xml Maven theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} io.opentelemetry.instrumentation opentelemetry-aws-sdk-2.2 ${opentelemetry.version} ``` See [here](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/supported-libraries.md) for the full list of OpenTelemetry instrumentation libraries. The example service below includes the [AWS SDK instrumentation library](https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/aws-sdk/aws-sdk-2.2/library) and registers the `DynamoDB` client for instrumentation. ## 4. Add a Global Exception Handler By default, unhandled exceptions in Spring Boot are caught by Spring's error handling mechanism after the OpenTelemetry trace context has closed. This means the error is never attached to the trace, making it invisible in the Trace0 trace. Adding a `@RestControllerAdvice` global exception handler ensures the exception is caught and logged within the active request trace, so the error and stack trace are correctly correlated to the right trace. ```java theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; @RestControllerAdvice public class GlobalExceptionHandler { private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class); @ExceptionHandler(Exception.class) public ResponseEntity handle(Exception ex) { log.error("Unhandled exception", ex); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Internal error"); } } ``` ## 5. Kubernetes Setup If your application runs on Kubernetes, including `Amazon EKS`, `Google Kubernetes Engine` or `Azure Kubernetes Service`, add the following environment variables to your container specification. ```yaml theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} env: - name: K8S_POD_UID valueFrom: fieldRef: fieldPath: metadata.uid - name: K8S_POD_NAME valueFrom: fieldRef: fieldPath: metadata.name - name: K8S_NAMESPACE_NAME valueFrom: fieldRef: fieldPath: metadata.namespace - name: K8S_CONTAINER_NAME value: my-container-name - name: OTEL_RESOURCE_ATTRIBUTES value: k8s.pod.uid=$(K8S_POD_UID),k8s.pod.name=$(K8S_POD_NAME),k8s.namespace.name=$(K8S_NAMESPACE_NAME),k8s.container.name=$(K8S_CONTAINER_NAME) ``` ## 6. Deploy Service Deploy your service and watch traces, metrics, and logs appear in the [Trace0 dashboard](https://app.trace0hq.com) within seconds. ## Example Service See our example apps for working Spring Boot services with Trace0 installed: | Example | Environment | | - | - | | [Spring Boot Docker example app](https://github.com/Trace0-HQ/trace0-examples/tree/main/java-spring-boot-docker) | Docker (local) | | [Spring Boot EC2 example app](https://github.com/Trace0-HQ/trace0-examples/tree/main/java-spring-boot-ec2) | AWS EC2 | # Node.js - Containers & VMs Source: https://docs.trace0hq.com/setup/javascript/containers-and-vms Instrument a Node.js application with OpenTelemetry and send traces, metrics, and logs to Trace0. > [!NOTE] > > This guide covers Node.js applications running on **ECS**, **EC2**, **Kubernetes**, or any container/VM environment. For AWS Lambda, see the [Node.js Lambda guide](/setup/javascript/lambda). ## 1. Install the OpenTelemetry SDK ```bash theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} npm install --save @opentelemetry/auto-instrumentations-node ``` ## 2. Enable Auto Instrumentation Enable auto instrumentation by requiring the `auto-instrumentations-node` module using the `--require` flag: ```bash theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} node --require '@opentelemetry/auto-instrumentations-node/register' app.js ``` ## 3. Set Environment Variables Add these environment variables to your service. Replace `YOUR_TRACE0_ENV_API_KEY` with the API key from your Trace0 environment. | Variable | Value | | - | - | | `OTEL_EXPORTER_OTLP_ENDPOINT` | `https://app.trace0hq.com/api` | | `OTEL_EXPORTER_OTLP_HEADERS` | `X-API-KEY=YOUR_TRACE0_ENV_API_KEY` | | `OTEL_EXPORTER_OTLP_PROTOCOL` | `http/protobuf` | ## 4. Add Logger To correlate logs with traces in Trace0, your application must use an OpenTelemetry-supported logger. We recommend using [Pino](https://github.com/pinojs/pino), a low overhead JavaScript logger for Node.js. The instructions below use `Pino`, but the same approach applies to other supported loggers such as [Winston](https://github.com/winstonjs/winston). First, install the library: ```bash theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} npm install pino ``` Then create a `logger.js` file: ```javascript theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} import pino from 'pino'; const logger = pino({ mixin() { return { 'service.name': process.env['OTEL_SERVICE_NAME'], }; }, formatters: { level: (label) => { return { level: label }; }, }, }); export default logger; ``` Finally, use the logger in your app: ```typescript theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} import logger from './logger.js'; logger.info(`Hello world!`); ``` All logs will now be exported to the Trace0 ingest endpoint. ## 5. Kubernetes Setup If your application runs on Kubernetes, including `Amazon EKS`, `Google Kubernetes Engine` or `Azure Kubernetes Service`, add the following environment variables to your container specification. ```yaml theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} env: - name: K8S_POD_UID valueFrom: fieldRef: fieldPath: metadata.uid - name: K8S_POD_NAME valueFrom: fieldRef: fieldPath: metadata.name - name: K8S_NAMESPACE_NAME valueFrom: fieldRef: fieldPath: metadata.namespace - name: K8S_CONTAINER_NAME value: my-container-name - name: OTEL_RESOURCE_ATTRIBUTES value: k8s.pod.uid=$(K8S_POD_UID),k8s.pod.name=$(K8S_POD_NAME),k8s.namespace.name=$(K8S_NAMESPACE_NAME),k8s.container.name=$(K8S_CONTAINER_NAME) ``` ## 6. Deploy Service Deploy your service and watch traces, metrics, and logs appear in the [Trace0 dashboard](https://app.trace0hq.com) within seconds. ## Example Service See our example apps for working Node.js services with Trace0 installed: | Example | Environment | | - | - | | [Node.js Express Docker example app](https://github.com/Trace0-HQ/trace0-examples/tree/main/node-js-express-docker) | Docker | | [Node.js MongoDB Docker example app](https://github.com/Trace0-HQ/trace0-examples/tree/main/node-js-mongodb-docker) | Docker | | [Node.js Express EC2 example app](https://github.com/Trace0-HQ/trace0-examples/tree/main/node-js-express-ec2) | AWS EC2 | | [OpenTelemetry demo app](https://github.com/Trace0-HQ/opentelemetry-demo) | Docker/Kubernetes | # Node.js - AWS Lambda Source: https://docs.trace0hq.com/setup/javascript/lambda Instrument a Node.js Lambda function with OpenTelemetry and send traces, logs and metrics to Trace0. ## 1. Add the OpenTelemetry Lambda Layer Find the latest `layer-nodejs` ARN for your AWS region from the [opentelemetry-lambda releases page](https://github.com/open-telemetry/opentelemetry-lambda/releases). Add the layer ARN to your function. ## 2. Add the Collector Lambda Extension Find the latest `layer-collector` ARN for your AWS region from the [opentelemetry-lambda releases page](https://github.com/open-telemetry/opentelemetry-lambda/releases). Add the layer ARN to your function and then add the following `collector.yaml` file to the root of your Lambda deployment folder. Replace `YOUR_TRACE0_ENV_API_KEY` with the API key from your Trace0 environment. ```yaml theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} receivers: telemetryapi: otlp: protocols: grpc: http: exporters: otlp_http/trace0: endpoint: https://app.trace0hq.com/api headers: X-API-KEY: 'YOUR_TRACE0_ENV_API_KEY' processors: batch: decouple: resource: attributes: - key: service.name value: "${env:OTEL_SERVICE_NAME}" action: upsert service: pipelines: traces: receivers: [otlp] processors: [resource, batch, decouple] exporters: [otlp_http/trace0] metrics: receivers: [otlp] processors: [resource, batch, decouple] exporters: [otlp_http/trace0] logs: receivers: [telemetryapi] processors: [resource, batch, decouple] exporters: [otlp_http/trace0] ``` ## 3. Set Environment Variables Add the following environment variables to your Lambda function. | Variable | Value | | - | - | | `AWS_LAMBDA_EXEC_WRAPPER` | `/opt/otel-handler` | | `OTEL_SERVICE_NAME` | `YOUR_SERVICE_NAME` | | `OTEL_EXPORTER_OTLP_ENDPOINT` | `http://localhost:4318` | | `OTEL_EXPORTER_OTLP_PROTOCOL` | `http/protobuf` | | `OPENTELEMETRY_COLLECTOR_CONFIG_URI` | `/var/task/collector.yaml` | ## 4. Add Logger To correlate logs with traces in Trace0, your application must use an OpenTelemetry-supported logger. We recommend using [Pino](https://github.com/pinojs/pino), a low overhead JavaScript logger for Node.js. The instructions below use `Pino`, but the same approach applies to other supported loggers such as [Winston](https://github.com/winstonjs/winston). First, install the library: ```bash theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} npm install pino ``` Then create a `logger.js` file: ```javascript theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} import pino from 'pino'; const logger = pino({ mixin() { return { 'service.name': process.env['OTEL_SERVICE_NAME'], }; }, formatters: { level: (label) => { return { level: label }; }, }, }); export default logger; ``` You can now use the logger in your app: ```typescript theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} import logger from './logger.js'; logger.info(`Hello world!`); ``` All logs will now be exported to the local collector, which will in turn export them to the Trace0 ingest endpoint. **Enable Trace Context Injection in Pino Logs** To inject trace context (trace ID, span ID) into Pino log records, the Pino instrumentation must be loaded, as it is not loaded by default. Enable it by setting this environment variable on your Lambda: | Variable | Value | | - | - | | `OTEL_NODE_ENABLED_INSTRUMENTATIONS` | `pino` | > [!NOTE] > > Setting `OTEL_NODE_ENABLED_INSTRUMENTATIONS` disables all the default instrumentation libraries and only enables the ones you specify, except the [AWS SDK v3 instrumentation](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-aws-sdk), which is always loaded regardless. See [here](https://github.com/open-telemetry/opentelemetry-lambda/blob/main/nodejs/README.md) for full details on configuring the auto instrumentation for Node.js Lambda. ## 5. Set HTTP request spans For lambdas triggered via API Gateway, the HTTP request and response attributes are not set automatically on the lambda invocation span by the OTel Lambda auto-instrumentation. Therefore, they need to be set manually in your lambda code handler. ```typescript theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} import { trace, SpanStatusCode } from '@opentelemetry/api'; export const handler = async ( event: APIGatewayProxyEvent, context: Context ): Promise => { const { httpMethod, path, requestContext } = event; //Set the http request method and route on the parent span. const span = trace.getActiveSpan(); span?.setAttributes({ 'http.request.method': event.httpMethod, 'http.route': event.path }); const result = await processEvent(event) // Set the HTTP response code and mark the span as failed for 4xx/5xx responses. span?.setAttributes({ 'http.response.status_code': result.statusCode }); span?.setStatus({ code: result.statusCode < 400 ? SpanStatusCode.OK : SpanStatusCode.ERROR }); return result; } ``` ## 6. Deploy service Deploy your service and watch traces, metrics, and logs appear in the [Trace0 dashboard](https://app.trace0hq.com) within seconds. ## Example service See our [Node.js Lambda example app](https://github.com/Trace0-HQ/trace0-examples/tree/main/node-js-lambda) for a working service you can deploy to your AWS account. # Python - Containers & VMs Source: https://docs.trace0hq.com/setup/python/containers-and-vms Instrument a Python application with OpenTelemetry and send traces, metrics, and logs to Trace0. > [!NOTE] > > This guide covers Python applications running on **ECS**, **EC2**, **Kubernetes**, or any container/VM environment. For AWS Lambda, see the [Python Lambda guide](/setup/python/lambda). ## 1. Install the OpenTelemetry SDK ```bash theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} pip install opentelemetry-distro pip install opentelemetry-exporter-otlp pip install opentelemetry-instrumentation-system-metrics ``` ## 2. Install Instrumentation Libraries ```bash theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} opentelemetry-bootstrap -a install ``` `opentelemetry-bootstrap` automatically detects your installed packages (Django, FastAPI, Boto3, etc.) and installs the matching instrumentation libraries. ## 3. Install the Resource Detector Package Install the resource detector package for the platform your application is running on. > [tab] AWS > > ```bash theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} > pip install opentelemetry-sdk-extension-aws > ``` > [tab] Kubernetes > > ```bash theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} > pip install opentelemetry-resourcedetector-kubernetes > ``` > [tab] Containers > > ```bash theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} > pip install opentelemetry-resourcedetector-container > ``` ## 4. Set Environment Variables Add these environment variables to your service. Replace `YOUR_TRACE0_ENV_API_KEY` with the API key from your Trace0 environment. | Variable | Value | | - | - | | `OTEL_EXPORTER_OTLP_ENDPOINT` | `https://app.trace0hq.com/api` | | `OTEL_EXPORTER_OTLP_HEADERS` | `X-API-KEY=YOUR_TRACE0_ENV_API_KEY` | | `OTEL_EXPORTER_OTLP_PROTOCOL` | `http/protobuf` | | `OTEL_PYTHON_LOG_CORRELATION` | `true` | | `OTEL_PYTHON_LOG_CODE_ATTRIBUTES` | `true` | If your application is running on AWS, set the following additional environment variable for your deployment platform. > [tab] ECS > > | Variable | Value | > | - | - | > | `OTEL_EXPERIMENTAL_RESOURCE_DETECTORS` | `env,host,os,process,aws_ecs` | > [tab] EKS > > | Variable | Value | > | - | - | > | `OTEL_EXPERIMENTAL_RESOURCE_DETECTORS` | `env,host,os,process,aws_eks` | > [tab] EC2 > > | Variable | Value | > | - | - | > | `OTEL_EXPERIMENTAL_RESOURCE_DETECTORS` | `env,host,os,process,aws_ec2` | > [tab] Elastic Beanstalk > > | Variable | Value | > | - | - | > | `OTEL_EXPERIMENTAL_RESOURCE_DETECTORS` | `env,host,os,process,aws_beanstalk` | ## 5. Kubernetes Setup If your application runs on Kubernetes, including `Amazon EKS`, `Google Kubernetes Engine` or `Azure Kubernetes Service`, add the following environment variables to your container specification. ```yaml theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} env: - name: K8S_POD_UID valueFrom: fieldRef: fieldPath: metadata.uid - name: K8S_POD_NAME valueFrom: fieldRef: fieldPath: metadata.name - name: K8S_NAMESPACE_NAME valueFrom: fieldRef: fieldPath: metadata.namespace - name: K8S_CONTAINER_NAME value: my-container-name - name: OTEL_RESOURCE_ATTRIBUTES value: k8s.pod.uid=$(K8S_POD_UID),k8s.pod.name=$(K8S_POD_NAME),k8s.namespace.name=$(K8S_NAMESPACE_NAME),k8s.container.name=$(K8S_CONTAINER_NAME) ``` ## 6. Deploy Service Deploy your service and watch traces, metrics, and logs appear in the [Trace0 dashboard](https://app.trace0hq.com) within seconds. ## Example Service See our example apps for working Python services with Trace0 installed: | Example | Environment | | - | - | | [Python FastAPI Docker example app](https://github.com/Trace0-HQ/trace0-examples/tree/main/python-fast-api-docker) | Docker | | [Python Redis Docker example app](https://github.com/Trace0-HQ/trace0-examples/tree/main/python-redis-docker) | Docker | | [Python FastAPI EC2 example app](https://github.com/Trace0-HQ/trace0-examples/tree/main/python-fast-api-ec2) | AWS EC2 | | [OpenTelemetry demo app](https://github.com/Trace0-HQ/opentelemetry-demo) | Docker/Kubernetes | # Python - AWS Lambda Source: https://docs.trace0hq.com/setup/python/lambda Instrument a Python Lambda function with OpenTelemetry and send traces, logs and metrics to Trace0. ## 1. Add the OpenTelemetry Lambda Layer Find the latest `layer-python` ARN for your AWS region from the [opentelemetry-lambda releases page](https://github.com/open-telemetry/opentelemetry-lambda/releases). Add the layer ARN to your function. ## 2. Add the Collector Lambda Extension Find the latest `layer-collector` ARN for your AWS region from the [opentelemetry-lambda releases page](https://github.com/open-telemetry/opentelemetry-lambda/releases). Add the layer ARN to your function and then add the following `collector.yaml` file to the root of your Lambda deployment folder. Replace `YOUR_TRACE0_ENV_API_KEY` with the API key from your Trace0 environment. ```yaml theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} receivers: telemetryapi: otlp: protocols: grpc: http: exporters: otlp_http/trace0: endpoint: https://app.trace0hq.com/api headers: X-API-KEY: 'YOUR_TRACE0_ENV_API_KEY' processors: batch: decouple: resource: attributes: - key: service.name value: "${env:OTEL_SERVICE_NAME}" action: upsert service: pipelines: traces: receivers: [otlp] processors: [resource, batch, decouple] exporters: [otlp_http/trace0] metrics: receivers: [otlp] processors: [resource, batch, decouple] exporters: [otlp_http/trace0] logs: receivers: [telemetryapi] processors: [resource, batch, decouple] exporters: [otlp_http/trace0] ``` ## 3. Set Environment Variables Add the following environment variables to your Lambda function. | Variable | Value | | - | - | | `OPENTELEMETRY_COLLECTOR_CONFIG_URI` | `/var/task/collector.yaml` | | `OTEL_EXPORTER_OTLP_ENDPOINT` | `http://localhost:4318` | | `OTEL_SERVICE_NAME` | `YOUR_SERVICE_NAME` | | `AWS_LAMBDA_EXEC_WRAPPER` | `/opt/otel-handler` | ## 4. Add Logger To enable full log-trace correlation, configure Python's logging module to write structured JSON to stdout, with a filter that injects the active trace ID and span ID into every log record. ```python theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} import logging from opentelemetry import trace class TraceContextFilter(logging.Filter): def filter(self, record): ctx = trace.get_current_span().get_span_context() if ctx.is_valid: record.trace_id = format(ctx.trace_id, '032x') record.span_id = format(ctx.span_id, '016x') return True ``` Lambda's Telemetry API automatically captures stdout/stderr and forwards it to the collector, which then exports it to Trace0. ## 5. Set HTTP request spans For lambdas triggered via API Gateway, the HTTP request and response attributes are not set automatically on the lambda invocation span by the OTel Lambda auto-instrumentation. Therefore, they need to be set manually in your lambda code handler. ```python theme={"languages":{"custom":["/languages/trace0ql.tmLanguage.json"]}} from opentelemetry import trace from opentelemetry.trace import StatusCode def handler(event, context): http_method = event.get('httpMethod', '') path = event.get('path', '') # Set the http request method and route on the parent span. span = trace.get_current_span() span.set_attributes({ 'http.request.method': http_method, 'http.route': path, }) try: result = process_event(event) # Set the HTTP response code and mark the parent span as failed for 4xx/5xx responses. status_code = result['statusCode'] span.set_attribute('http.response.status_code', status_code) span.set_status(StatusCode.OK if status_code < 400 else StatusCode.ERROR) return result except Exception as e: # Set the exception, HTTP error code and status on the parent span. span.record_exception(e) span.set_attribute('http.response.status_code', 500) span.set_status(StatusCode.ERROR) return { 'statusCode': 500, 'headers': {'Content-Type': 'application/json'}, 'body': json.dumps({'error': 'Internal server error'}), } ``` ## 6. Deploy service Deploy your service and watch traces, metrics, and logs appear in the [Trace0 dashboard](https://app.trace0hq.com) within seconds. ## Example service See our [Python Lambda example app](https://github.com/Trace0-HQ/trace0-examples/tree/main/python-lambda) for a working service you can deploy to your AWS account.