Add distributed monitoring service and real-time observability dashboard#2
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a new Spring Boot monitor-service (TCP telemetry ingestion + WebSocket broadcast) and a Vue dashboard scaffold, and refactors the shared MetricsSnapshot DTO into a com.videoprocessor.shared package. However, the refactor leaves the main worker project in a broken state, the new TCP ingestion uses Java's unsafe ObjectInputStream.readObject(), the WebSocket endpoint is open to all origins, and the pom.xml references non-existent Spring Boot starter artifacts.
Changes:
- New
monitor-serviceSpring Boot module:MetricsTcpServer(port 8081),MetricsHub,MetricsWebSocketHandlerbroadcasting on/metrics,MetricsMessageenvelope. - Move/duplicate of
MetricsSnapshotintocom.videoprocessor.shared(with no-arg constructor + setters for deserialization); the original location in the main source tree is reduced to an empty stub. - Vue dashboard scaffolding (mostly empty placeholder files) and a small
metricsStorewith default counters.
Reviewed changes
Copilot reviewed 17 out of 27 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/com/videoprocessor/shared/MetricsSnapshot.java | Replaced with empty stub — breaks main project compilation. |
| monitor-service/src/main/java/com/videoprocessor/shared/MetricsSnapshot.java | Full DTO with no-arg ctor + setters for (de)serialization. |
| monitor-service/.../tcp/MetricsTcpServer.java | Accepts TCP clients, deserializes via ObjectInputStream (unsafe). |
| monitor-service/.../websocket/MetricsWebSocketHandler.java | Virtual-thread broadcast loop, every 2 s, with printStackTrace error handling. |
| monitor-service/.../websocket/WebSocketConfig.java | Registers /metrics handler with setAllowedOrigins("*"). |
| monitor-service/.../metrics/MetricsHub.java | Volatile snapshot holder. |
| monitor-service/.../metrics/MetricsMessage.java | JSON envelope (type, timestamp, payload). |
| monitor-service/.../MonitorServiceApplication.java | Spring Boot entry point. |
| monitor-service/src/test/.../MonitorServiceApplicationTests.java | Default contextLoads smoke test. |
| monitor-service/pom.xml | Spring Boot 4.0.6 parent, Java 25, references non-existent spring-boot-starter-webmvc-test/-websocket-test artifacts. |
| monitor-service/application.properties | Sets spring.application.name. |
| monitor-service/mvnw, mvnw.cmd, .mvn/wrapper/..., .gitignore, .gitattributes | Standard Maven Wrapper / scaffolding files. |
| dashboard/src/stores/metricsStore.js | Exports initialMetrics defaults. |
| dashboard/src/** (.vue, .css, .js) | Empty placeholder files for the dashboard scaffold. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -0,0 +1,4 @@ | |||
| package com.videoprocessor.shared; | |||
|
|
|||
| public class MetricsSnapshot { | |||
Comment on lines
+67
to
+79
| try ( | ||
| ObjectInputStream input = | ||
| new ObjectInputStream( | ||
| socket.getInputStream() | ||
| ) | ||
| ) { | ||
| System.out.println( | ||
| "[TCP] Client connected" | ||
| ); | ||
|
|
||
| MetricsSnapshot snapshot = | ||
| (MetricsSnapshot) | ||
| input.readObject(); |
Comment on lines
+17
to
+19
| private static final String HOST = "localhost"; | ||
|
|
||
| private static final int PORT = 8081; |
Comment on lines
+27
to
+31
| registry.addHandler( | ||
| handler, | ||
| "/metrics" | ||
| ) | ||
| .setAllowedOrigins("*"); |
Comment on lines
+72
to
+88
| Thread.ofVirtual().start(() -> { | ||
|
|
||
| while (true) { | ||
|
|
||
| try { | ||
|
|
||
| broadcastMetrics(); | ||
|
|
||
| Thread.sleep(2000); | ||
|
|
||
| } catch (Exception e) { | ||
|
|
||
| e.printStackTrace(); | ||
| } | ||
| } | ||
| }); | ||
| } |
Comment on lines
+61
to
+69
| <artifactId>spring-boot-starter-webmvc-test</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-starter-websocket-test</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| <dependency> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement distributed monitoring and real-time dashboard