Skip to content
Codeskop

Java & Kotlin

codeskop-server captures errors, incoming requests and outgoing API calls from Java 11+ and Kotlin services. No runtime dependencies; events are batched and sent from a background thread.

Supported frameworks

Version 0.1. Spring Boot 3 and any Jakarta Servlet container (Tomcat, Jetty, Undertow), OkHttp and java.net.http.HttpClient.

Install

build.gradle.kts
dependencies {    implementation("com.codeskop.sdk:codeskop-server:0.1.0")}

Initialize

Call Codeskop.init once at startup. On its own this reports uncaught exceptions on any thread and flushes before the JVM exits.

Codeskop.init(Codeskop.options()    .apiKey(System.getenv("CODESKOP_API_KEY"))   // cs_live_pk_… (public key)    .environment("production"));

Spring Boot and Servlet apps

Register CodeskopFilter. Requests are recorded by route pattern (/orders/{id}), unhandled exceptions are reported with their route, and the authenticated principal's name is attached as the user ID.

ShopApplication.java
@SpringBootApplicationpublic class ShopApplication {    public static void main(String[] args) {        Codeskop.init(Codeskop.options().apiKey(System.getenv("CODESKOP_API_KEY")));        SpringApplication.run(ShopApplication.class, args);    }     @Bean    CodeskopFilter codeskopFilter() {        return new CodeskopFilter();    }}

Outside Spring, add the filter to your container (web.xml or ServletContext.addFilter) for all paths. Health checks and /actuator/* aren't recorded.

Outgoing calls

// OkHttpOkHttpClient client = new OkHttpClient.Builder()    .addInterceptor(new CodeskopOkHttpInterceptor())    .build(); // java.net.http.HttpClientHttpResponse<String> res = CodeskopHttp.send(httpClient, request, HttpResponse.BodyHandlers.ofString());

Report errors yourself

try {    payments.charge(order);} catch (PaymentException e) {    Codeskop.captureException(e, Map.of("provider", "stripe"));} Codeskop.captureMessage("Inventory sync skipped");Codeskop.setUser(user.getId()); // inside a request: your own ID, never an email

Options

OptionTypeDefaultDescription
apiKeyStringCODESKOP_API_KEYThe project's public key. Secret keys are refused and the SDK stays off.
environmentStringproductionEnv var CODESKOP_ENVIRONMENT.
releaseStringautoAuto-detected from common hosts and CI. Env var CODESKOP_RELEASE.
captureRequests / captureOutgoingbooleantrueIncoming requests / outgoing calls.
ignoreRoutesListhealth checksGlob patterns never recorded.
ignoreExceptionsList[]Exception class names never sent.
beforeSendFunctionnoneEdit or drop any event before it's sent.
sendUserIdbooleantrueAttach the authenticated principal's name.
debugbooleanfalseLog what the SDK does.

Privacy

Never captured: request or response bodies, cookies, Authorization headers and query strings. See Privacy & Security.