Grafana LGTM
A service providing a Grafana LGTM observability platform based on OpenTelemetry for development and testing purposes. It consists of:
-
Grafana for visualizing and exploring telemetry data.
-
OpenTelemetry Collector for collecting telemetry data from your application using OTLP.
-
Grafana Loki for storing and querying logs.
-
Prometheus for storing and querying metrics.
-
Grafana Tempo for storing and querying traces.
It works with Spring Boot libraries that support OpenTelemetry, including:
Dependencies
First, you need to add the Dev Service dependency to your project.
-
Gradle
-
Maven
dependencies {
testAndDevelopmentOnly "io.arconia:arconia-dev-services-lgtm"
}
<dependency>
<groupId>io.arconia</groupId>
<artifactId>arconia-dev-services-lgtm</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
You can optionally include the Spring Boot DevTools dependency to enable live reload of your application during development.
-
Gradle
-
Maven
dependencies {
developmentOnly "org.springframework.boot:spring-boot-devtools"
}
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
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
When using the Arconia Dev Services, you can keep running your application as you normally would. The Dev Services will automatically start when you run your application.
-
CLI
-
Gradle
-
Maven
arconia dev
./gradlew bootRun
./mvnw spring-boot:run
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 ) nor requires you to define a separate @SpringBootApplication class for configuring Testcontainers.
|
Your integration tests will automatically use the Dev Services without any additional configuration.
By default, when running the application in development mode, the Dev Service will be shared across multiple applications.
Accessing Grafana
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.
Configuring the Dev Service
You can configure the Dev Service via configuration properties.
Property | Default | Description |
---|---|---|
|
|
Whether the dev service is enabled. |
|
|
Full name of the container image used in the dev service. |
|
|
Environment variables to set in the container. Example: |
|
|
When the container used in the dev service is shared across applications. |
You can enable/disable the Dev Service selectively for a specific application mode (development, test), relying on one of the profiles which are automatically configured by Arconia (see Profiles).
You can enable/disable the Dev Service for a specific test class by using the @TestProperty annotation or equivalent Spring testing utilities.
|