SDKs
Java SDK Guide
Java 17+ SDK for Spring Boot, Quarkus, and Micronaut. Thread-safe non-blocking telemetry client.
The Lazers Java SDK (`com.oneverse:lazers`) runs on Java 17+ and provides thread-safe asynchronous dispatch.
Dependency (Maven / Gradle) ```xml <dependency> <groupId>com.oneverse</groupId> <artifactId>lazers</artifactId> <version>0.1.0</version> </dependency> ```
Integration Code Examples
Spring Boot Global Exception Handler
package com.example.demo;
import com.oneverse.lazers.LazersClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import jakarta.annotation.PreDestroy;
@Configuration
class LazersConfig {
@Bean
public LazersClient lazersClient() {
return LazersClient.builder()
.apiKey(System.getenv("LAZERS_API_KEY"))
.endpoint("https://api.lazers.app")
.projectId(System.getenv("LAZERS_PROJECT_ID"))
.environment("production")
.serviceName("inventory-api")
.release(System.getenv("GIT_COMMIT_SHA"))
.build();
}
}
@ControllerAdvice
class GlobalExceptionHandler {
private final LazersClient lazers;
public GlobalExceptionHandler(LazersClient lazers) {
this.lazers = lazers;
}
@ExceptionHandler(Exception.class)
public void handle(Exception ex) {
lazers.captureError(ex);
}
}