jaeger cum fuck love get fucked you mother fucker
parent
8cf701d408
commit
3f23240ded
|
@ -0,0 +1,8 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="AutoCloseableResource" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="METHOD_MATCHER_CONFIG" value="java.util.Formatter,format,java.io.Writer,append,com.google.common.base.Preconditions,checkNotNull,org.hibernate.Session,close,java.io.PrintWriter,printf,java.io.PrintStream,printf,io.opentelemetry.context.ImplicitContextKeyed,makeCurrent" />
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
|
@ -0,0 +1,159 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AutoImportSettings">
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="0f41691c-0555-42fa-871c-696e835fdcc1" name="Changes" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/compiler.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/compiler.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Class" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="ProjectColorInfo">{
|
||||
"associatedIndex": 1
|
||||
}</component>
|
||||
<component name="ProjectId" id="2XzrKhWhzn1ftuh1BdX52WhmbVY" />
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||
"WebServerToolWindowFactoryState": "false",
|
||||
"git-widget-placeholder": "main",
|
||||
"last_opened_file_path": "/home/brett/Documents/Brock/CS 3P95/Assignments/Assignment 2 Java/libs",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"project.structure.last.edited": "Modules",
|
||||
"project.structure.proportion": "0.15",
|
||||
"project.structure.side.proportion": "0.2",
|
||||
"settings.editor.selected.configurable": "reference.settings.project.maven.repository.indices",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
}
|
||||
}</component>
|
||||
<component name="RecentsManager">
|
||||
<key name="MoveFile.RECENT_KEYS">
|
||||
<recent name="$PROJECT_DIR$/in" />
|
||||
</key>
|
||||
</component>
|
||||
<component name="RunManager" selected="Maven.Maven Client">
|
||||
<configuration name="Maven Client" type="MavenRunConfiguration" factoryName="Maven">
|
||||
<MavenSettings>
|
||||
<option name="myGeneralSettings" />
|
||||
<option name="myRunnerSettings" />
|
||||
<option name="myRunnerParameters">
|
||||
<MavenRunnerParameters>
|
||||
<option name="cmdOptions" />
|
||||
<option name="profiles">
|
||||
<set />
|
||||
</option>
|
||||
<option name="goals">
|
||||
<list>
|
||||
<option value="compile" />
|
||||
<option value="exec:java" />
|
||||
<option value="-Dexec.mainClass=client.Client" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="pomFileName" />
|
||||
<option name="profilesMap">
|
||||
<map />
|
||||
</option>
|
||||
<option name="projectsCmdOptionValues">
|
||||
<list />
|
||||
</option>
|
||||
<option name="resolveToWorkspace" value="false" />
|
||||
<option name="workingDirPath" value="$PROJECT_DIR$" />
|
||||
</MavenRunnerParameters>
|
||||
</option>
|
||||
</MavenSettings>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="Maven Server" type="MavenRunConfiguration" factoryName="Maven">
|
||||
<MavenSettings>
|
||||
<option name="myGeneralSettings" />
|
||||
<option name="myRunnerSettings" />
|
||||
<option name="myRunnerParameters">
|
||||
<MavenRunnerParameters>
|
||||
<option name="cmdOptions" />
|
||||
<option name="profiles">
|
||||
<set />
|
||||
</option>
|
||||
<option name="goals">
|
||||
<list>
|
||||
<option value="compile" />
|
||||
<option value="exec:java" />
|
||||
<option value="-Dexec.mainClass=server.Server" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="pomFileName" />
|
||||
<option name="profilesMap">
|
||||
<map />
|
||||
</option>
|
||||
<option name="projectsCmdOptionValues">
|
||||
<list />
|
||||
</option>
|
||||
<option name="resolveToWorkspace" value="false" />
|
||||
<option name="workingDirPath" value="$PROJECT_DIR$" />
|
||||
</MavenRunnerParameters>
|
||||
</option>
|
||||
</MavenSettings>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<list>
|
||||
<item itemvalue="Maven.Maven Server" />
|
||||
<item itemvalue="Maven.Maven Client" />
|
||||
</list>
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="0f41691c-0555-42fa-871c-696e835fdcc1" name="Changes" comment="" />
|
||||
<created>1699642690668</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1699642690668</updated>
|
||||
<workItem from="1699642691698" duration="1780000" />
|
||||
<workItem from="1699644554205" duration="4483000" />
|
||||
<workItem from="1699649046958" duration="1659000" />
|
||||
<workItem from="1699753268434" duration="7789000" />
|
||||
<workItem from="1699771695888" duration="8878000" />
|
||||
<workItem from="1699855895607" duration="8075000" />
|
||||
<workItem from="1699982150005" duration="1160000" />
|
||||
<workItem from="1699983647788" duration="7319000" />
|
||||
<workItem from="1700071773870" duration="526000" />
|
||||
<workItem from="1700158706429" duration="3509000" />
|
||||
<workItem from="1700165455778" duration="4488000" />
|
||||
<workItem from="1700178396414" duration="4007000" />
|
||||
<workItem from="1700184489732" duration="1251000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="3" />
|
||||
</component>
|
||||
<component name="XSLT-Support.FileAssociations.UIState">
|
||||
<expand />
|
||||
<select />
|
||||
</component>
|
||||
</project>
|
5
pom.xml
5
pom.xml
|
@ -100,5 +100,10 @@
|
|||
<artifactId>lz4-java</artifactId>
|
||||
<version>1.8.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.opentelemetry</groupId>
|
||||
<artifactId>opentelemetry-sdk-trace</artifactId>
|
||||
<version>1.32.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -28,7 +28,7 @@ public class ChunkedCompressedChecksumFileReader {
|
|||
}
|
||||
|
||||
public FileHeader readChunk(Tracer trace, Span sp) throws IOException {
|
||||
Span gf = trace.spanBuilder("Chunk Read").setParent(Context.current().with(sp)).startSpan();
|
||||
Span gf = trace.spanBuilder("Chunk Read").startSpan();
|
||||
FileHeader header = readHeader();
|
||||
try (Scope scope = gf.makeCurrent()) {
|
||||
if (header.getUncompressed() == 0)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package server;
|
||||
|
||||
import client.Client;
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.SpanBuilder;
|
||||
import io.opentelemetry.api.trace.Tracer;
|
||||
|
@ -18,10 +19,10 @@ public class Connection implements Runnable {
|
|||
private final Server server;
|
||||
private DataOutputStream out;
|
||||
private DataInputStream in;
|
||||
private Tracer trace;
|
||||
private Span fileSend;
|
||||
private final Tracer trace;
|
||||
private final Span fileSend;
|
||||
|
||||
public Connection(Server server, Tracer trace, Span parent, Socket clientSocket) {
|
||||
public Connection(Server server, Tracer trace, Socket clientSocket) {
|
||||
this.server = server;
|
||||
this.clientSocket = clientSocket;
|
||||
this.trace = trace;
|
||||
|
@ -31,12 +32,12 @@ public class Connection implements Runnable {
|
|||
} catch (Exception e) {
|
||||
ExceptionLogger.log(e);
|
||||
}
|
||||
parent.addEvent("Connection Established");
|
||||
SpanBuilder sb = trace.spanBuilder("New Connection");
|
||||
SpanBuilder sb = trace.spanBuilder("New Client Connection");
|
||||
sb.setAttribute("INetAddress", clientSocket.getInetAddress().toString());
|
||||
sb.setAttribute("Port", clientSocket.getPort());
|
||||
sb.setAttribute("LocalPort", clientSocket.getLocalPort());
|
||||
fileSend = sb.startSpan();
|
||||
fileSend.addEvent("Connection Established");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -66,6 +67,7 @@ public class Connection implements Runnable {
|
|||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
fileSend.recordException(e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
@ -76,9 +78,16 @@ public class Connection implements Runnable {
|
|||
out.close();
|
||||
in.close();
|
||||
clientSocket.close();
|
||||
} catch (Exception ignored) {}
|
||||
} catch (Exception e) {
|
||||
ExceptionLogger.log(e);
|
||||
}
|
||||
System.out.println("Client Disconnected");
|
||||
Server.running = false;
|
||||
Server.close();
|
||||
// try {
|
||||
// // evil hack
|
||||
// new Client("localhost", Server.SERVER_PORT).close();
|
||||
// } catch (IOException ignored) {
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,9 +11,10 @@ public class FileHeader {
|
|||
private int compressed;
|
||||
private long hash;
|
||||
|
||||
public FileHeader() {}
|
||||
public FileHeader() {
|
||||
}
|
||||
|
||||
public FileHeader read(DataInputStream reader) throws IOException{
|
||||
public FileHeader read(DataInputStream reader) throws IOException {
|
||||
uncompressed = reader.readInt();
|
||||
if (uncompressed == 0)
|
||||
return this;
|
||||
|
|
|
@ -11,6 +11,7 @@ import shared.OTelUtils;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.net.ServerSocket;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
@ -27,39 +28,32 @@ public class Server {
|
|||
|
||||
public Server() {
|
||||
Tracer main = ot.getTracer("Main Server", "0.69");
|
||||
Span sbs = main.spanBuilder("Start Server").setAttribute("Server Port", SERVER_PORT).startSpan();
|
||||
try (Scope scope = sbs.makeCurrent()) {
|
||||
try {
|
||||
System.out.println("Starting server");
|
||||
sbs.addEvent("Server Start", System.nanoTime(), TimeUnit.NANOSECONDS);
|
||||
ServerSocket serverSocket = new ServerSocket(SERVER_PORT);
|
||||
Runtime.getRuntime().addShutdownHook(new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
System.out.println("Closing Server");
|
||||
running = false;
|
||||
sbs.end();
|
||||
executor.shutdown();
|
||||
try {
|
||||
serverSocket.close();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
System.out.println("Server Started");
|
||||
|
||||
while (running)
|
||||
executor.execute(new Connection(this, main, sbs, serverSocket.accept()));
|
||||
executor.execute(new Connection(this, main, serverSocket.accept()));
|
||||
|
||||
serverSocket.close();
|
||||
} catch (IOException e) {
|
||||
sbs.recordException(e);
|
||||
ExceptionLogger.log(e);
|
||||
} finally {
|
||||
sbs.end();
|
||||
}
|
||||
System.out.println("Closing thread pool");
|
||||
executor.shutdown();
|
||||
try {
|
||||
if (!executor.awaitTermination(1, TimeUnit.SECONDS)){
|
||||
List<Runnable> runs = executor.shutdownNow();
|
||||
System.out.println("Hello runs " + runs.size());
|
||||
if (!executor.awaitTermination(1, TimeUnit.SECONDS))
|
||||
System.out.println("Unable to terminate");
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
executor.shutdownNow();
|
||||
Thread.currentThread().interrupt();
|
||||
ExceptionLogger.log(e);
|
||||
}
|
||||
System.out.println("Server exited!");
|
||||
}
|
||||
|
||||
|
@ -74,7 +68,8 @@ public class Server {
|
|||
}
|
||||
|
||||
public static void close(){
|
||||
srv.notifyAll();
|
||||
if (srv != null)
|
||||
srv.notifyAll();
|
||||
}
|
||||
|
||||
}
|
|
@ -3,6 +3,7 @@ package shared;
|
|||
import client.ChunkedCompressedChecksumFileWriter;
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.Tracer;
|
||||
import io.opentelemetry.context.Scope;
|
||||
import net.jpountz.lz4.LZ4Compressor;
|
||||
import net.jpountz.lz4.LZ4Factory;
|
||||
import net.jpountz.lz4.LZ4FastDecompressor;
|
||||
|
@ -70,7 +71,7 @@ public class FileUtil {
|
|||
ChunkedCompressedChecksumFileReader reader = new ChunkedCompressedChecksumFileReader(dataIn, path, FileUtil.SEED);
|
||||
|
||||
// ugh I want while(reader.readChunk().getUncompressed()); but it makes warnings!!!
|
||||
while(true) {
|
||||
while (true) {
|
||||
if (reader.readChunk(trace, sp).getUncompressed() == 0) {
|
||||
sp.addEvent("Chunk Read");
|
||||
break;
|
||||
|
|
|
@ -16,6 +16,7 @@ import io.opentelemetry.sdk.metrics.SdkMeterProvider;
|
|||
import io.opentelemetry.sdk.metrics.export.PeriodicMetricReader;
|
||||
import io.opentelemetry.sdk.resources.Resource;
|
||||
import io.opentelemetry.sdk.trace.SdkTracerProvider;
|
||||
import io.opentelemetry.sdk.trace.export.BatchSpanProcessor;
|
||||
import io.opentelemetry.sdk.trace.export.SimpleSpanProcessor;
|
||||
import io.opentelemetry.sdk.trace.export.SpanExporter;
|
||||
import io.opentelemetry.semconv.ResourceAttributes;
|
||||
|
@ -30,20 +31,10 @@ public class OTelUtils {
|
|||
.setResource(resource)
|
||||
.build();
|
||||
|
||||
SdkMeterProvider sdkMeterProvider = SdkMeterProvider.builder()
|
||||
.registerMetricReader(PeriodicMetricReader.builder(LoggingMetricExporter.create()).build())
|
||||
.setResource(resource)
|
||||
.build();
|
||||
|
||||
SdkLoggerProvider sdkLoggerProvider = SdkLoggerProvider.builder()
|
||||
.addLogRecordProcessor(BatchLogRecordProcessor.builder(SystemOutLogRecordExporter.create()).build())
|
||||
.setResource(resource)
|
||||
.build();
|
||||
|
||||
return OpenTelemetrySdk.builder()
|
||||
.setTracerProvider(sdkTracerProvider)
|
||||
.setMeterProvider(sdkMeterProvider)
|
||||
.setLoggerProvider(sdkLoggerProvider)
|
||||
.setMeterProvider(createLoggingMeter(resource))
|
||||
.setLoggerProvider(createLoggerProvider(resource))
|
||||
.setPropagators(ContextPropagators.create(TextMapPropagator.composite(W3CTraceContextPropagator.getInstance(), W3CBaggagePropagator.getInstance())))
|
||||
.buildAndRegisterGlobal();
|
||||
}
|
||||
|
@ -53,29 +44,39 @@ public class OTelUtils {
|
|||
|
||||
SpanExporter otlpExporter = OtlpGrpcSpanExporter.builder()
|
||||
.setEndpoint("http://sc.on.underlying.skynet.tpgc.me:4317")
|
||||
.setCompression("gzip")
|
||||
.build();
|
||||
|
||||
BatchSpanProcessor batchSpanProcessor = BatchSpanProcessor.builder(otlpExporter)
|
||||
.setMaxQueueSize(2048)
|
||||
.setMaxExportBatchSize(512) // Example max export batch size
|
||||
.build();
|
||||
|
||||
SdkTracerProvider sdkTracerProvider = SdkTracerProvider.builder()
|
||||
.addSpanProcessor(SimpleSpanProcessor.create(otlpExporter))
|
||||
.setResource(resource)
|
||||
.build();
|
||||
|
||||
SdkMeterProvider sdkMeterProvider = SdkMeterProvider.builder()
|
||||
.registerMetricReader(PeriodicMetricReader.builder(LoggingMetricExporter.create()).build())
|
||||
.setResource(resource)
|
||||
.build();
|
||||
|
||||
SdkLoggerProvider sdkLoggerProvider = SdkLoggerProvider.builder()
|
||||
.addLogRecordProcessor(BatchLogRecordProcessor.builder(SystemOutLogRecordExporter.create()).build())
|
||||
.addSpanProcessor(batchSpanProcessor)
|
||||
.setResource(resource)
|
||||
.build();
|
||||
|
||||
return OpenTelemetrySdk.builder()
|
||||
.setTracerProvider(sdkTracerProvider)
|
||||
.setMeterProvider(sdkMeterProvider)
|
||||
.setLoggerProvider(sdkLoggerProvider)
|
||||
.setMeterProvider(createLoggingMeter(resource))
|
||||
.setLoggerProvider(createLoggerProvider(resource))
|
||||
.setPropagators(ContextPropagators.create(TextMapPropagator.composite(W3CTraceContextPropagator.getInstance(), W3CBaggagePropagator.getInstance())))
|
||||
.buildAndRegisterGlobal();
|
||||
}
|
||||
|
||||
private static SdkMeterProvider createLoggingMeter(Resource resource){
|
||||
return SdkMeterProvider.builder()
|
||||
.registerMetricReader(PeriodicMetricReader.builder(LoggingMetricExporter.create()).build())
|
||||
.setResource(resource)
|
||||
.build();
|
||||
}
|
||||
|
||||
private static SdkLoggerProvider createLoggerProvider(Resource resource){
|
||||
return SdkLoggerProvider.builder()
|
||||
.addLogRecordProcessor(BatchLogRecordProcessor.builder(SystemOutLogRecordExporter.create()).build())
|
||||
.setResource(resource)
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,13 +1,12 @@
|
|||
shared/ExceptionLogger.class
|
||||
server/Server$1.class
|
||||
shared/FileUtil$InvalidUsageException.class
|
||||
shared/FileUtil.class
|
||||
shared/OTelUtils.class
|
||||
client/Client.class
|
||||
server/Server.class
|
||||
server/Connection.class
|
||||
server/FileHeader.class
|
||||
shared/FileUtil$COMMAND.class
|
||||
shared/ArrayData.class
|
||||
server/ChunkedCompressedChecksumFileReader.class
|
||||
client/ChunkedCompressedChecksumFileWriter.class
|
||||
shared/FileUtil$InvalidUsageException.class
|
||||
shared/OTelUtils.class
|
||||
client/Client.class
|
||||
server/FileHeader.class
|
||||
shared/FileUtil$COMMAND.class
|
||||
|
|
Loading…
Reference in New Issue