aboutsummaryrefslogtreecommitdiff
path: root/spark-velocity
diff options
context:
space:
mode:
authorLuck <git@lucko.me>2022-09-19 18:57:02 +0100
committerLuck <git@lucko.me>2022-09-19 20:09:01 +0100
commit7079484d428321c9b3db09394577efda4d591a4e (patch)
tree1e751e3c832d6df00c7e50357be44b85a2fd5df9 /spark-velocity
parent7ef9b6281135ce0a24f3c14c2255d9a2c2eca969 (diff)
downloadspark-7079484d428321c9b3db09394577efda4d591a4e.tar.gz
spark-7079484d428321c9b3db09394577efda4d591a4e.tar.bz2
spark-7079484d428321c9b3db09394577efda4d591a4e.zip
Provide extra metadata about sources in sampler data
Diffstat (limited to 'spark-velocity')
-rw-r--r--spark-velocity/src/main/java/me/lucko/spark/velocity/VelocityClassSourceLookup.java2
-rw-r--r--spark-velocity/src/main/java/me/lucko/spark/velocity/VelocitySparkPlugin.java14
2 files changed, 14 insertions, 2 deletions
diff --git a/spark-velocity/src/main/java/me/lucko/spark/velocity/VelocityClassSourceLookup.java b/spark-velocity/src/main/java/me/lucko/spark/velocity/VelocityClassSourceLookup.java
index bcb8176..9b697c3 100644
--- a/spark-velocity/src/main/java/me/lucko/spark/velocity/VelocityClassSourceLookup.java
+++ b/spark-velocity/src/main/java/me/lucko/spark/velocity/VelocityClassSourceLookup.java
@@ -23,7 +23,7 @@ package me.lucko.spark.velocity;
import com.velocitypowered.api.plugin.PluginContainer;
import com.velocitypowered.api.plugin.PluginManager;
-import me.lucko.spark.common.util.ClassSourceLookup;
+import me.lucko.spark.common.sampler.source.ClassSourceLookup;
import org.checkerframework.checker.nullness.qual.Nullable;
diff --git a/spark-velocity/src/main/java/me/lucko/spark/velocity/VelocitySparkPlugin.java b/spark-velocity/src/main/java/me/lucko/spark/velocity/VelocitySparkPlugin.java
index 7d9ced8..4a89a4e 100644
--- a/spark-velocity/src/main/java/me/lucko/spark/velocity/VelocitySparkPlugin.java
+++ b/spark-velocity/src/main/java/me/lucko/spark/velocity/VelocitySparkPlugin.java
@@ -34,11 +34,13 @@ import me.lucko.spark.common.SparkPlatform;
import me.lucko.spark.common.SparkPlugin;
import me.lucko.spark.common.monitor.ping.PlayerPingProvider;
import me.lucko.spark.common.platform.PlatformInfo;
-import me.lucko.spark.common.util.ClassSourceLookup;
+import me.lucko.spark.common.sampler.source.ClassSourceLookup;
+import me.lucko.spark.common.sampler.source.SourceMetadata;
import org.slf4j.Logger;
import java.nio.file.Path;
+import java.util.Collection;
import java.util.List;
import java.util.logging.Level;
import java.util.stream.Stream;
@@ -134,6 +136,16 @@ public class VelocitySparkPlugin implements SparkPlugin, SimpleCommand {
}
@Override
+ public Collection<SourceMetadata> getKnownSources() {
+ return SourceMetadata.gather(
+ this.proxy.getPluginManager().getPlugins(),
+ plugin -> plugin.getDescription().getId(),
+ plugin -> plugin.getDescription().getVersion().orElse("unspecified"),
+ plugin -> String.join(", ", plugin.getDescription().getAuthors())
+ );
+ }
+
+ @Override
public PlayerPingProvider createPlayerPingProvider() {
return new VelocityPlayerPingProvider(this.proxy);
}