Compare commits

..
2 Commits
Author SHA1 Message Date
Claude 5323e6c71a Add classic-ml-vs-llm module: Tribuo 4.3.2 and Smile 7.3.0 text classifiers, a zero-shot LLM client and a cost model
Seeded synthetic support tickets in five categories; Tribuo and Smile logistic regression and Smile naive Bayes against a
majority baseline; skewed classes, train/test duplicates, vocabulary drift and the three different answers to a ticket of
unseen words; a zero-shot client for OpenAI-compatible endpoints tested against a fake endpoint (no model was called) and
a cost formula with assumed prices. Every figure is written to output/ by the tests that assert it.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b69H5rTewUKPyhGS8r
2026-12-01 23:57:00 +05:30
asmhatreandClaude Sonnet 5.5 dc94d7fece Add log-anomaly module: Spring Boot log parser, template mining, swappable embedder, k-means baseline, novel-template and rate-spike detectors with measured blind spots, incidents and a template-only summary prompt on Spring Boot 4.2.0
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b69H5rTewUKPyhGS8r
2026-12-01 23:57:00 +05:30
5 changed files with 9 additions and 8 deletions
+1 -1
View File
@@ -17,5 +17,5 @@ target: 2196 physical lines, 1524 events, 0 orphan lines
that ERROR event: level=ERROR logger=HikariPool continuation lines=3 that ERROR event: level=ERROR logger=HikariPool continuation lines=3
exception line: java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 30000ms. exception line: java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 30000ms.
## The same line without the application name (Spring Boot before 3.4) ## The same line without the application name bracket
parsed: level=INFO thread=nio-8080-exec-1 logger=OrderController message=Order 42 placed parsed: level=INFO thread=nio-8080-exec-1 logger=OrderController message=Order 42 placed
+1 -1
View File
@@ -1,6 +1,6 @@
# The embedder is a seam: a remote one behind a stub /v1/embeddings # The embedder is a seam: a remote one behind a stub /v1/embeddings
embedder: openai-compatible:stub-model, dimensions: 32 embedder: openai-compatible:stub-model, dimensions: 32
HTTP requests while fitting 10 baseline templates: 2 HTTP requests while fitting 10 baseline templates: 2
first request body: {"input":["INFO CatalogController GET /api/products/<*> <*> in <*> ms","INFO AuthFilter Token validated for user u-<*>","INFO OrderController Order <*... first request body: {"model":"stub-model","input":["INFO CatalogController GET /api/products/<*> <*> in <*> ms","INFO AuthFilter Token validated for user u-<*>","INFO Ord...
distance of the pool-timeout template through the stub: 0.520 distance of the pool-timeout template through the stub: 0.520
The stub returns the hashing embedder's own vectors, so this shows the plumbing and says nothing about any real model. The stub returns the hashing embedder's own vectors, so this shows the plumbing and says nothing about any real model.
@@ -1,10 +1,10 @@
# A log file written by Spring Boot 4.2.0 itself (spring.application.name=shop) # A log file written by Spring Boot 4.2.0 itself (spring.application.name=shop)
## The first three lines, and the ERROR with its first stack-trace lines ## The first three lines, and the ERROR with its first stack-trace lines
2026-12-01T23:50:45.063+05:30 INFO 8974 --- [shop] [main] o.a.maven.surefire.booter.ForkedBooter : Starting ForkedBooter v3.5.4 using Java 25.0.5.1 with PID 8974 (started by root in /tmp/work/java-ai-agents/log-anomaly) 2026-12-01T23:53:34.953+05:30 INFO 12412 --- [shop] [main] o.a.maven.surefire.booter.ForkedBooter : Starting ForkedBooter v3.5.4 using Java 25.0.5.1 with PID 12412 (started by root in /tmp/work/java-ai-agents/log-anomaly)
2026-12-01T23:50:45.065+05:30 INFO 8974 --- [shop] [main] o.a.maven.surefire.booter.ForkedBooter : No active profile set, falling back to 1 default profile: "default" 2026-12-01T23:53:34.975+05:30 INFO 12412 --- [shop] [main] o.a.maven.surefire.booter.ForkedBooter : No active profile set, falling back to 1 default profile: "default"
2026-12-01T23:50:45.873+05:30 INFO 8974 --- [shop] [main] o.s.boot.tomcat.TomcatWebServer : Tomcat initialized with port 0 (http) 2026-12-01T23:53:37.369+05:30 INFO 12412 --- [shop] [main] o.s.boot.tomcat.TomcatWebServer : Tomcat initialized with port 0 (http)
2026-12-01T23:50:46.352+05:30 ERROR 8974 --- [shop] [main] com.ankurm.shop.OrderController : Failed to process order 42 2026-12-01T23:53:38.561+05:30 ERROR 12412 --- [shop] [main] com.ankurm.shop.OrderController : Failed to process order 42
java.lang.IllegalStateException: quantity must be greater than 0 java.lang.IllegalStateException: quantity must be greater than 0
at com.ankurm.logs.RealSpringBootLogTest.theParserReadsWhatSpringBootActuallyWrites(RealSpringBootLogTest.java:23) ~[test-classes/:na] at com.ankurm.logs.RealSpringBootLogTest.theParserReadsWhatSpringBootActuallyWrites(RealSpringBootLogTest.java:23) ~[test-classes/:na]
@@ -10,7 +10,8 @@ import java.util.stream.Stream;
/** /**
* Parses the default Spring Boot console/file layout: * Parses the default Spring Boot console/file layout:
* <pre>2026-11-30T09:00:00.123+05:30 INFO 4121 --- [shop] [nio-8080-exec-1] c.a.shop.OrderController : Order 42 placed</pre> * <pre>2026-11-30T09:00:00.123+05:30 INFO 4121 --- [shop] [nio-8080-exec-1] c.a.shop.OrderController : Order 42 placed</pre>
* The bracketed application name was added in Spring Boot 3.4; the pattern accepts logs with and without it. * The bracketed application name appears only when {@code spring.application.name} is set (observed on 4.2.0, see
* output/12); the pattern accepts logs with and without it.
* Any line that does not start with a timestamp is a continuation (a stack trace line) of the event before it. * Any line that does not start with a timestamp is a continuation (a stack trace line) of the event before it.
*/ */
public final class LogParser { public final class LogParser {
@@ -31,7 +31,7 @@ class LogAnomalyTest {
LogEvent withTrace = f.target.events().stream().filter(e -> e.message().startsWith("HikariPool-1 - Connection")).findFirst().orElseThrow(); LogEvent withTrace = f.target.events().stream().filter(e -> e.message().startsWith("HikariPool-1 - Connection")).findFirst().orElseThrow();
t.line("that ERROR event: level=%s logger=%s continuation lines=%d", withTrace.level(), withTrace.shortLogger(), withTrace.continuation().size()); t.line("that ERROR event: level=%s logger=%s continuation lines=%d", withTrace.level(), withTrace.shortLogger(), withTrace.continuation().size());
t.line("exception line: %s", withTrace.exceptionLine()); t.line("exception line: %s", withTrace.exceptionLine());
t.section("The same line without the application name (Spring Boot before 3.4)"); t.section("The same line without the application name bracket");
String old = "2026-11-30T09:00:00.123+05:30 INFO 4121 --- [nio-8080-exec-1] c.a.shop.OrderController : Order 42 placed"; String old = "2026-11-30T09:00:00.123+05:30 INFO 4121 --- [nio-8080-exec-1] c.a.shop.OrderController : Order 42 placed";
LogEvent e = new LogParser().parse(java.util.stream.Stream.of(old)).events().getFirst(); LogEvent e = new LogParser().parse(java.util.stream.Stream.of(old)).events().getFirst();
t.line("parsed: level=%s thread=%s logger=%s message=%s", e.level(), e.thread(), e.shortLogger(), e.message()); t.line("parsed: level=%s thread=%s logger=%s message=%s", e.level(), e.thread(), e.shortLogger(), e.message());