Add boot42-otel module: Spring Boot 4.2.0-RC1 OpenTelemetry conventions, shared OTLP settings and MDC keys vs 4.1.2
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package com.ankurm.otel;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/** Collects lines and writes output/NN-name[-on-4.1.2].txt. Tests assert what they write. */
|
||||
final class Transcript {
|
||||
|
||||
static final String LABEL = System.getProperty("boot.label", "4.2.0-RC1");
|
||||
|
||||
static boolean is42() {
|
||||
return LABEL.startsWith("4.2");
|
||||
}
|
||||
|
||||
private final List<String> lines = new ArrayList<>();
|
||||
private final Path file;
|
||||
|
||||
Transcript(String name) {
|
||||
String suffix = is42() ? "" : "-on-" + LABEL;
|
||||
this.file = Path.of("output", name + suffix + ".txt");
|
||||
line("# " + name + " (Spring Boot " + LABEL + ", JDK " + Runtime.version().feature() + ")");
|
||||
}
|
||||
|
||||
Transcript line(String s) {
|
||||
lines.add(s);
|
||||
return this;
|
||||
}
|
||||
|
||||
void write() {
|
||||
try {
|
||||
Files.createDirectories(file.getParent());
|
||||
Files.write(file, lines);
|
||||
}
|
||||
catch (IOException ex) {
|
||||
throw new IllegalStateException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user