Query Examples | Honeycomb

We use cookies or similar technologies to personalize your online experience & tailor marketing to you. Many of our product features require cookies to function properly.

Read our privacy policy I accept cookies from this site

Query Examples

Use the query examples below to explore the performance and behavior of your application. The specific attributes below may or may not exist in your data and environment.

Enter each example query using the Query Builder. These example queries use two to three of the VISUALIZE, WHERE, and GROUP BY clauses, located at the top of the Query Builder.

  • VISUALIZE - Performs a calculation and displays a corresponding graph over time. Most VISUALIZE queries return a line graph while the HEATMAP visualization shows the distribution of data over time
  • WHERE - Filters based on attribute parameter(s)
  • GROUP BY - Groups fields by attribute parameter(s)

Screenshot of Visualize, Where, and Group by clauses in Query Builder

Performance Metrics 

What are the Slowest Traces in the Application 

This query identifies the slowest trace in your application, in terms of duration (duration_ms), and provides information about the specific events and spans that make up that trace.

VISUALIZE WHERE GROUP BY
MAX(duration_ms) trace.parent_id does-not-exist name

Use to:

  • to find potential performance issues
  • understand the root cause of slow response times

What is the P90 Duration of Database Calls 

This query calculates the P90 duration of your database calls, which is the duration at which 90% of your database calls complete.

VISUALIZE WHERE GROUP BY
P90(duration_ms) db.statement exists db.statement

Use to:

  • understand the performance of your database
  • identify potential issues or bottlenecks

What are the Total Bytes Sent on Requests 

This query calculates the total bytes sent on requests, which is the total amount of data that is transmitted by your service in response to requests.

HEATMAP creates a histogram data visualization. Use BubbleUp further investigate and compare values.

VISUALIZE WHERE GROUP BY
SUM(http.request_content_length)
HEATMAP(http.request_content_length)
http.request_content_length exists name

Use to:

  • understand the performance and efficiency of your service
  • analyze your data further with BubbleUp

How Much Time Database Calls Take in a Trace 

This query provides insight into the performance of your application. If a significant amount of time is spent on database calls, opportunity to improve speed and performance in the way that your application interacts with the database.

VISUALIZE WHERE GROUP BY
SUM(duration_ms) db.statement exists
trace.trace_id = abc123
db.statement

What is the Rate at Which the Average Duration for the Service Increases or Decreases 

This query calculates the rate of change in the average amount of time that it takes for your service to complete a request.

VISUALIZE WHERE GROUP BY
RATE_AVG(duration_ms) trace.parent_id does-not-exist name

Use to:

  • understand the performance of your service
  • identify potential trends or patterns in the duration of your service’s requests

Error Analysis 

Which Exception Happens the Most in the Service 

This query provides insight into potential problems in your system. For example, when running a web service that processes online transactions and the most frequent exception being thrown is “TimeoutException”, then your service may have issues connecting to the database to retrieve information about the transactions.

VISUALIZE WHERE GROUP BY
COUNT exception.message exists exception.message

Which Spans Contain Which Exceptions 

Some OpenTelemetry insrumentation or SDKs will record exception messages on Span Events rather than on the Span itself. This query identifies which Span Events events ccontain exceptions, and then groups by the name of the Span that corresponds to that Span Event, the name of the service, and then the name of the exception.

VISUALIZE WHERE GROUP BY
COUNT parent_name exists
exception.message exists
parent_name
service.name
exception.message

Show Only Errored Traces and Their Latency 

This query helps to investigate the reasons for errors and latencies. For example, if you know that a errored trace called “XYZ” experiences high latencies, you can take further steps like debugging the code for that trace, adding more resources to handle the workload, or implementing error handling and retry mechanisms.

VISUALIZE WHERE GROUP BY
COUNT
HEATMAP(duration_ms)
error = true
trace.parent_id does-not-exist
name

Which Tenants Experience Errors on Certain Endpoints 

This query identifies which tenants, or specific groups of users or data within a software system, experience endpoint errors. With this knowledge, you can provide specialized support and troubleshooting to help resolve the issue.

For example, when running a storage service with multiple tenants, you notice that a particular tenant experiences a high number of errors when accessing their data on your endpoint. This may indicate that a problem exists with their configuration or usage of your service.

VISUALIZE WHERE GROUP BY
COUNT error = true
trace.parent_id does-not-exist
app.tenant exists
app.tenant
name

User Behavior 

What is the Number of Requests per Time Period 

This query calculates the total number of requests received by your application, and provides a breakdown of those requests by different dimensions, such as the type of request, the endpoint, or the tenant.

VISUALIZE WHERE GROUP BY
COUNT trace.parent_id does-not-exist name

Use to:

  • monitor the overall traffic and usage of your application

What is the Number of Concurrent Calls for a Specific Span 

This query calculates the number of concurrent calls for the individual, specific span named my-span, which is the number of calls to that span that are executing simultaneously.

VISUALIZE WHERE
CONCURRENCY name = my-span

Use to:

  • understand the workload and performance of your span
  • identify potential issues or bottlenecks that may be affecting the concurrency of your calls

What is the Number of Distinct Users in the Application 

This query displays the level of demand on your system and the resources it uses. If the number of distinct users increases over time, it may indicate that your system is approaching its capacity and that action may be needed to improve its performance.

VISUALIZE WHERE
COUNT_DISTINCT(app.user_id) app.user_id exists

Endpoint Usage 

What is the Load Across Each Server 

This query calculates the number of executed, independent traces on each server.

VISUALIZE WHERE GROUP BY
COUNT trace.parent_id does-not-exist host.name

Use to:

  • understand the workload and performance of your servers
  • identify potential issues or bottlenecks

Which Tenant hits Each Endpoint the Most and Their Highest Experienced Latency 

The query identifies tenants, or specific groups of users or data within a software system, the endpoints they use, and their maximum experienced latency. For example, if you know that a certain tenant hits endpoint /api/users the most and experiences high latencies on that endpoint, you can investigate the reasons for those latencies and take steps to improve the performance of that endpoint for that tenant.

VISUALIZE WHERE GROUP BY
COUNT
MAX(duration_ms)
trace.parent_id does-not-exist
app.tenant exists
app.tenant
name

Advanced Visualization 

Distribution Density of Status Codes Over Time 

This query presents the frequency and density of different status codes that are returned by your application during a specified time period.

HEATMAP creates a histogram data visualization. Use BubbleUp further investigate and compare values.

VISUALIZE WHERE GROUP BY
HEATMAP(http.status_code) http.status_code exists name

Use to:

  • understand the performance and behavior of your application
  • analyze your data further with BubbleUp

Did you find what you were looking for?