Complimentary Gartner® Report! 'A CTO's Guide to Open-Source Software: Answering the Top 10 FAQs.'Read more
Technical “How-To’s”

How to Monitor Jetty using OpenTelemetry

Miguel Rodriguez
Miguel Rodriguez
Share:

You can now monitor Jetty for free using top-of-the-line open-source monitoring tools in OpenTelemetry. If you are as excited as we are, look at the details of this support in OpenTelemetry’s repo.

The best part is that this receiver works with any OpenTelemetry collector, including the OpenTelemetry Collector and observIQ’s collector distribution.

Jetty uses the JMX receiver. In this post, we take you through the steps to set up the JMX receiver with the observIQ OpenTelemetry collector, configure it for Jetty, and send the metrics to Google Cloud.

What signals matter?

Jetty only produces seven metrics–you can see a complete list below near the end of the blog. You likely want to pay the closest attention to these three metrics: the jetty.select.count, jetty.session.count, and jetty.session.time.total.

  • Select Count
    • Monitors the number of select calls to the server.
  • Session Count
    • Monitors the number of sessions created in the server.
  • Session Time
    • Monitors the total amount of time sessions are active.

Related Content: How to Install and Configure an OpenTelemetry Collector

Configuring the JMX metrics receiver

After the installation, the config file for the collector can be found at:

  • C:\Program Files\observIQ OpenTelemetry Collector\config.yaml (Windows)
  • /opt/observiq-otel-collector/config.yaml(Linux)

The first step is building the receiver’s configuration:

  • We are using the JMX receiver to gather jetty metrics. The jar_path attribute lets you specify the path to the jar file that facilitates gathering jetty metrics using the JMX receiver. This file path is created automatically when the observIQ OpenTelemetry collector is installed.
  • Set the IP address and port for the system from which the metrics are gathered as the endpoint.
  • When we connect to JMX, there are different categories of metrics; the jetty metrics and JVM metrics are the ones that this configuration intends to scrape. This target_system attribute specifies that.
  • Set the time interval for fetching the metrics for the collection_interval attribute. The default value for this parameter is 10s. However, if metrics are exported to Google Cloud, this value is set to 60s by default.

The Properties attribute allows you to set arbitrary attributes. For instance, if you are configuring multiple JMX receivers to collect metrics from many jetty servers, this attribute enables you to set the unique IP addresses for each endpoint system. So that you know, this is not the only use of the properties option.

yaml
1receivers:
2  jmx:
3    jar_path: /opt/opentelemetry-java-contrib-jmx-metrics.jar
4    endpoint: localhost:1099
5    target_system: jetty,jvm
6    collection_interval: 60s
7    resource_attributes:
8      jetty.endpoint: localhost:1099

Set up a destination for exporting the metrics, as shown below.
You can check the configuration for your preferred destination from OpenTelemetry’s documentation here.

yaml
1exporters: 
2  googlecloud:
3    metric:
4      resource_filters:
5        - prefix: jetty

Set up the pipeline.

yaml
1service:
2  pipelines:
3    metrics:
4      receivers:
5      - jmx
6      exporters:
7      - googlecloud

Viewing the metrics collected

Based on the config detailed above, the JMX metrics gatherer scrapes the following metrics and exports them to the destination.

MetricDescription
jetty.select.countThe number of select calls.
jetty.session.countThe number of sessions created.
jetty.client.request.range_slice.latency.50pThe total number of requests that are range sliced at 50%
jetty.session.time.totalThe total time sessions have been active.
jetty.session.time.maxThe maximum amount of time a session has been active.
jetty.thread.countThe current number of threads.
jetty.thread.queue.countThe current number of threads in the queue.

Related Content: Turning Logs into Metrics with OpenTelemetry and BindPlane OP

observIQ’s distribution is a game-changer for companies looking to implement the OpenTelemetry standards. The single-line installer, seamlessly integrated receivers, exporter, and processor pool make working with this collector simple. Follow this space to keep up with all our future posts and simplified configurations for various sources. For questions, requests, and suggestions, contact our support team at support@observIQ.com.

Miguel Rodriguez
Miguel Rodriguez
Share:

Related posts

All posts

Get our latest content
in your inbox every week

By subscribing to our Newsletter, you agreed to our Privacy Notice

Community Engagement

Join the Community

Become a part of our thriving community, where you can connect with like-minded individuals, collaborate on projects, and grow together.

Ready to Get Started

Deploy in under 20 minutes with our one line installation script and start configuring your pipelines.

Try it now