Configuring OpenTelemetry and Jaegar Agent

The configuration of OpenTelemetry and Jaegar agent lets you analyze the traces of scheduled job in logs. Jaegar is an open-source tool which helps you to visualize the traces and spans in the logs for a scheduled report.

Setting up OpenTelemetry and Jaeger Agent on JasperReports Server Application

This section includes the steps for setting up the OpenTelemetry and Jaeger agent on JasperReports Server application and analyzing the traces and spans of the application.

Prerequisites

The below prerequisite must be satisfied before configuring OpenTelemetry and Jaegar on JasperReports Server application:

  • JasperReports Server setup.

Steps to configure OpenTelemetry and Jaegar on JasperReports Server

To configure OpenTelemetry and Jaegar in the JasperReports Server, do the following:

1. Stop tomcat service.
2. Download OpenTelemetry Java agent using https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v1.26.0/opentelemetry-javaagent.jar and then place this Java agent on the JasperReports Servernode. The Java agent involves some useful libraries, which help in instrumenting the code.
3. Go to the tomcat bin directory of each JRS node and update the following arguments in the setenv.sh file of the Tomcat bin:
export JAVA_OPTS: Provide the correct path of the java agent where the java agent is placed.
export OTEL_TRACES_EXPORTER: In exporter name, provide Jaeger exporter name as we are using Jaeger exporter to visualize the trace. You can provide whatever exporter you are using to visualize traces.
export OTEL_EXPORTER_JAEGER_ENDPOINT: Provide the correct hostname with port number. If you are using localhost, then provide the localhost name else provide the hostname directly.
export OTEL_RESOURCE_ATTRIBUTES=service.name: In service name, provide jasperserver-pro service name.
export OTEL_JAVAAGENT_DEBUG: The default value is false for this argument and is not editable.
export OTEL_METRICS_EXPORTER: The default value is none for this argument and is not editable.
export JAVA_OPTS="$JAVA_OPTS -javaagent:/opt/jaeger/opentelemetry-javaagent.jar"
export OTEL_TRACES_EXPORTER=jaeger
export OTEL_EXPORTER_JAEGER_ENDPOINT=http://infra-platforms-na2-15557-sanand.pfa.jaspersoft.com:14250
export OTEL_RESOURCE_ATTRIBUTES=service.name=jasperserver-pro
export OTEL_JAVAAGENT_DEBUG=false
export OTEL_METRICS_EXPORTER=none

Ensure that the correct path of the Java agent and hostname is provided in the stenv.sh file.

4. Download Jaeger on the JasperReports Server node using this link https://www.jaegertracing.io/download/. As a result, Jaeger gets downloaded in ZIP format.
5. Extract the Jaeger package and go to the location under which the jaeger-all-in-one is placed.
6. Open the command prompt and run ./jaeger-all-in-one --collector.zipkin.host-port=:9411 & command to start Jaeger application.

Ensure that the root user has setup OTel and Jaegar in the respective folders and assigned permissions for the jasperserver user to setup Java agent and Jaeger files. If no files are set up, then the application misbehaves. In such case, start the services by logging as a jasperserver user.

7. Start tomcat service to access Jaeger using the JasperReports Server URL: http://<hostname>:16686 to see traces of JasperReports Server application node. As a result, Jaeger is successfully configured with JasperReports Server running in one tab and Jaeger running in other tab in the browser.

To view traces of the Load balancer replace hostname with the load balancer URL.

Setting up OpenTelemetry and Jaeger Agent on JasperReports Server Cluster

This section includes steps for setting up OpenTelemetry and Jaeger agent on JasperReports Servercluster environment and analyzing the generated traces and spans for each nodes of the cluster.

Prerequisites

The below prerequisite must be satisfied before configuring OpenTelemetry and Jaegar on JasperReports Servercluster environment:

  • JasperReports Servercluster setup.

Steps to configure OpenTelemetry and Jaegar on JasperReports Server Cluster

To configure OpenTelemetry and Jaegar in the JasperReports Server cluster environment, do the following:

1. Stop tomcat service.
2. Download OpenTelemetry Java agent https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v1.26.0/opentelemetry-javaagent.jar and then place this Java agent on all the JRS nodes of the cluster. The Java agent involves some useful libraries which help in instrumenting the code.
3. Go to tomcat bin directory of each JasperReports Servernode and update the below arguments in setenv.sh file of the tomcat bin:
export JAVA_OPTS: Provide the correct path of the java agent where the java agent is placed.
export OTEL_TRACES_EXPORTER: In exporter name, provide Jaeger exporter name. As we are using Jaeger exporter to visualize the traces so Jaeger exporter name was provided. You can provide whatever exporter you are using to visualize traces.
export OTEL_EXPORTER_JAEGER_ENDPOINT: Provide the correct hostname with port number. If you are using localhost, then provide the localhost name else provide hostname directly.
export OTEL_RESOURCE_ATTRIBUTES=service.name: In service name, provide jasperserver-pro service name.
export OTEL_JAVAAGENT_DEBUG: The default value is false for this argument and is not editable.
export OTEL_METRICS_EXPORTER: The default value is none for this argument and is not editable.

Ensure that the correct path of the Java agent and hostname is provided in the stenv.sh file.

export JAVA_OPTS="$JAVA_OPTS -javaagent:/opt/jaeger/opentelemetry-javaagent.jar"
export OTEL_TRACES_EXPORTER=jaeger
export OTEL_EXPORTER_JAEGER_ENDPOINT=http://infra-platforms-na2-15557-sanand.pfa.jaspersoft.com:14250
export OTEL_RESOURCE_ATTRIBUTES=service.name=jasperserver-pro
export OTEL_JAVAAGENT_DEBUG=false
export OTEL_METRICS_EXPORTER=none

In the above code snippet, ensure OTEL_EXPORTER_JAEGER_ENDPOINT option should have the URL of JRS load balancer and -javaagent option should have the correct path where OpenTelemetry javaagent is stored.

4. Login to load balancer node and then download Jaeger using https://www.jaegertracing.io/download/. As a reult, Jaeger gets downloaded in zip format, extract the Jaeger package.
5. Go to the extracted folder location under which jaeger-all-in-one is placed. Open the command prompt and run ./jaeger-all-in-one --collector.zipkin.host-port=:9411 & command to start Jaeger application.

Ensure that the root user has setup OTel and Jaegar in the respective folders and assigned the required permissions for the jasperserver user for setting up javaagent and jaeger files, else no files are set up in the application and application misbehaves. In such case, start the services using jasperserver user.

6. Start tomcat service to access Jaeger using the JasperReports Server URL: http://<hostname>:16686 to view traces of JasperReports Server application node. Jaeger is successfully configured. As a result, you can now run JasperReports Server in one tab in the browser and Jaeger in other tab.

To view traces of the Load balancer replace hostname(http://<hostname>:16686/search) with the Load balancer URL.

 

By default, Jaeger shows traces of all the nodes of JRS cluster. To view the spans and traces of a specific node of the cluster, segregate the trace of specific node using host.name tag under the tags option of Jaeger UI. For example, to view traces of specific node, enter the "host.name=na2devjaspf831" tag under the tags option of Jaeger UI. As a result, the traces and spans of the mentioned node having "host.name=na2devjaspf831" tag will only be displayed.