# Tracing with Jaeger

The 4ALLPORTAL uses tracing to monitor the software, specifically the duration of requests and their parameters, such as database queries and HTTP requests as well as internal jobs. Tracing enables the administrator to find performance problems, like an unoptimized SQL condition behind a slow frontend.

The monitored events are reported as spans: logical units with an operation name, timestamps and duration, which in their sum define a trace.

The 4ALLPORTAL uses Jaeger's (opens new window) java implementaion of OpenTracing (opens new window), which is the current open tracing standard.

# Testing Jaeger

To test Jaeger's functionalities and to see how it looks like, you can start an all-in-one Docker container using the following example setup (testing purposes only):

version: '3.7'
services:
  jaeger:
    image: jaegertracing/all-in-one:latest
    ports:
      - "16686:16686"

  4allportal:
    image: registry.4allportal.net/4allportal:SNAPSHOT
    ports:
      - 8181:8181
    environment:
      APPS_INSTALL: 4allportal-dam
      JAEGER_ENABLED: "true"
      JAEGER_AGENT_HOST: jaeger
      JAEGER_AGENT_PORT: "6831"
      JAEGER_SERVICE_NAME: 4allportal
      JAEGER_TAGS: instance=dev
      JAEGER_SAMPLER_TYPE: const
      JAEGER_SAMPLER_PARAM: "1"

  db:
    image: mariadb
    environment:
      MYSQL_ROOT_PASSWORD: toor

After starting this stack, you can visit the 4allportal (opens new window) (http://localhost:8181) and jaeger (opens new window) (http://localhost:16686), where you can select 4ALLPORTAL as the service and then take a look at the spans.

# Basic configuration

The basic configuration parameters for starting Jeager in Docker are:

Environment Variable Description Example Explanation
JAEGER_ENABLED enables custom 4allportal tracer true If not set to "true" a default tracer will be crated to avoid Errors if Jeager is not configured.
JAEGER_AGENT_HOST hostname / IP where the Jaeger agent is available jaeger-agent / 10.10.10.10
JAEGER_AGENT_PORT port behind which the Jaeger agent is available 6831
JAEGER_SERVICE_NAME service name, under which the spans are reported 4ALLPORTAL
JAEGER_SAMPLER_TYPE sampler type const const means spans are reported deterministically
JAEGER_SAMPLER_PARAM sampler parameter 1 1 means all spans are reported
JAEGER_TAGS tags which are added to the spans instance=dev This makes searching for spans easier

Note: Find out all configuration steps and details by checking out Jaeger's readme (opens new window).

# References

Request missing documentation