OpenTelemetry Dev Services
Arconia Dev Services provide a zero-code integration to services your application depends on, both at development and test time, relying on the power of Testcontainers and Spring Boot. This page describes the OpenTelemetry Dev Services.
For more information, see the Dev Services page. |
Grafana LGTM
When your application uses OpenTelemetry for observability, you can use the OpenTelemetry LGTM Dev Service to start automatically a Grafana observability platform based on OpenTelemetry. This enables you to visualize and explore your application’s telemetry data during development and testing.
Dependencies
First, you need to add the OpenTelemetry LGTM Dev Service dependency to your project. You can also include the Spring Boot DevTools dependency to enable live reload of your application during development.
dependencies {
developmentOnly "org.springframework.boot:spring-boot-devtools"
testAndDevelopmentOnly "io.arconia:arconia-dev-services-opentelemetry-lgtm"
}
When you use the Spring Boot DevTools in your project, Arconia will keep the Dev Services running while you make changes to your code instead of restarting them with the application. This allows you to see the changes in real-time without having to restart the Dev Services. |
Running the Application
Unlike the lower-level Testcontainers support in Spring Boot, Arconia doesn’t require special tasks to run your application when using Dev Services (./gradlew bootTestRun
or ./mvnw spring-boot:test-run
). You can simply run your application using the usual tasks provided by the Spring Boot plugins for Gradle or Maven.
-
Gradle:
./gradlew bootRun
-
Maven:
./mvnw spring-boot:run
The Dev Service will automatically start when you run your application. By default, the Dev Service will be reused across multiple applications, useful for reducing resource consumption, speeding up the startup time, and enabling observability across multiple applications.
Your integration tests will automatically use the Dev Services without any additional configuration.
The application logs will show you the URL where you can access the Grafana observability platform and information about logs, metrics, and traces being exported to the platform.
...o.t.grafana.LgtmStackContainer : Access to the Grafana dashboard: http://localhost:38125
...s.l.e.o.OtlpLoggingExporterConfiguration : Configuring OpenTelemetry HTTP/Protobuf log exporter with endpoint: http://localhost:39117/v1/logs
...s.m.e.o.OtlpMetricsExporterConfiguration : Configuring OpenTelemetry HTTP/Protobuf metric exporter with endpoint: http://localhost:39117/v1/metrics
...s.t.e.o.OtlpTracingExporterConfiguration : Configuring OpenTelemetry HTTP/Protobuf span exporter with endpoint: http://localhost:39117/v1/traces
By default, logs, metrics, and traces are exported via OTLP using the HTTP/Protobuf format.
Customizing the Dev Service
You can customize the Dev Service via configuration properties, such as changing the image name or not reusing the service across multiple applications.
arconia:
dev:
services:
lgtm:
image-name: grafana/otel-lgtm
environment:
ENABLE_LOGS_ALL: "true"
reusable: true
Disabling the Dev Service
If you want to disable the Dev Service, you can do so via configuration properties.
arconia:
dev:
services:
lgtm:
enabled: false
You can enable/disable the Dev Service for a specific test class by using the @TestProperty annotation or equivalent Spring testing utilities.
|
You can enable/disable the Dev Service for a specific application mode (development, test, production), relying on one of the profiles which are automatically configured by Arconia (see Profiles). |