Skip to content

This is a sample devon4j project which spins up the OpenTelemetry Collector with Jaegar, Zipkin, Prometheus. This can be used to receive the traces/spans from projects which implement OpenTelemetry agents.

Notifications You must be signed in to change notification settings

devonfw-sample/devon4j-opentelemetry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

devon4j-opentelemetry

What is OpenTelemetry

It is an observability framework for distributed systems which helps to monitor your microservices, REST APIs. It is a collection of tools, APIs, and SDKs. You can use it to instrument, generate, collect, and export telemetry data (metrics, logs, and traces) for analysis in order to understand your software's performance and behavior.

Open Telemetry Collector

This is a sample devon4j project which spins up the OpenTelemetry Collector with telemetry backends such as Jaegar, Zipkin & Prometheus. This can be used to receive the traces/spans from applications through OpenTelemetry agents. The below image represents the functionality of OpenTelemetry with only a few telemetry backends though OpenTelemetry supports many other. The Collector collects the telemetry data and exports it to various backends.

opentel (1)

The collector can be spinned up by using a simple command from the parent directory once you clone this repository.

docker-compose up

And can be accessible at http://localhost:4317

Jaegar endpoint http://localhost:16686/

Zipkin endpoint http://localhost:9411/

Prometheus endpoint http://localhost:9090/

devon4j OpenTelemetry Integration

Apart from creating a OpenTelemetry collector this is also a sample devon4j project which has open telemetry agent that exports traces/spans to the opentelemetry collector.

To integrate OpenTelemetry with devon4j/any Spring Boot application we have 2 different ways

  1. Auto Instrumentation
  2. Manual Instrumentation

This sample covers only Auto Instrumentation.

Auto Instrumentation

This is rather straight forward and faster approach to integrate any SpringBoot application with OpenTelemetry.

Below are the steps:-

  1. Download the latest OpenTelemetry JavaAgent JAR file from here
  2. The devon4j SpringBootApp can be booted by passing the below JVM arguments.
-javaagent:agent/opentelemetry-javaagent-all.jar -Dotel.traces.exporter=otlp -Dotel.exporter.otlp.endpoint=http://localhost:4317 -Dotel.resource.attributes=service.name=mtsj -Dotel.javaagent.debug=false -Dotel.metrics.exporter=none
  1. After booting the application for this sample - this URL can be hit from a postman client to generate traffic - http://localhost:%app-port%/services/rest/employeemanagement/v1/employee/1234
  2. The trace information can be visualized in the Jaegar, Zipkin or any other telemetry backends using the above endpoints provided. Currently this sample is integrated with Jaegar and Zipkin.

MyThaiStar OpenTelemetry Integration

The backend of MyThaiStar a devon reference application can be booted to send the trace information to the OpenTelemetry Collector.

Follow the below steps:

  1. Download the latest OpenTelemetry JavaAgent JAR file from here
  1. Boot the SpringBootApp by passing the below JVM arguments.
-javaagent:agent/opentelemetry-javaagent-all.jar -Dotel.traces.exporter=otlp -Dotel.exporter.otlp.endpoint=http://localhost:4317 -Dotel.resource.attributes=service.name=mtsj -Dotel.javaagent.debug=false -Dotel.metrics.exporter=none

image

  1. From any rest client or a postman we can hit the http://localhost:8081/mythaistar/services/rest/dishmanagement/v1/dish/search to generate traffic.

Sample JSON request:

{
    "categories": [],
    "searchBy": "",
    "pageable": {
        "pageSize": 8,
        "pageNumber": 0,
        "sort": [
            {
                "property": "price",
                "direction": "DESC"
            }
        ]
    },
    "maxPrice": null,
    "minLikes": null
}

Note:- You might have to provide the login while testing this in local due to SpringSecurity login configuration in MyThaiStar.

  1. Then Jaegar and Zipkin endpoint can be accessed to visualize the trace information from MyThaiStar application.

Zipkin endpoint http://localhost:9411/

image

Jaegar endpoint http://localhost:16686/

image

Drill down one more level

image

This sample will continue to evolve as we investigate different ways to improve of using OpenTelemetry and implement the same.

Relevant components:

OpenTelemetry Collector

Jaeger

Zipkin

VictoriaMetrics

Grafana

About

This is a sample devon4j project which spins up the OpenTelemetry Collector with Jaegar, Zipkin, Prometheus. This can be used to receive the traces/spans from projects which implement OpenTelemetry agents.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages