Package net.pl3x.map.core.metrics
Class Metrics.MetricsBase
java.lang.Object
net.pl3x.map.core.metrics.Metrics.MetricsBase
- Enclosing class:
Metrics
-
Field Summary
-
Constructor Summary
ConstructorDescriptionMetricsBase
(@NotNull String platform, @NotNull String serverUuid, boolean enabled, @NotNull Consumer<@NotNull Metrics.JsonObjectBuilder> appendPlatformDataConsumer, @NotNull Consumer<@NotNull Metrics.JsonObjectBuilder> appendServiceDataConsumer, @NotNull Consumer<@NotNull Runnable> submitTaskConsumer, @NotNull Supplier<@NotNull Boolean> checkServiceEnabledSupplier, @NotNull BiConsumer<@NotNull String, @NotNull Throwable> errorLogger, @NotNull Consumer<@NotNull String> infoLogger, boolean logErrors, boolean logSentData, boolean logResponseStatusText) Creates a new MetricsBase class instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCustomChart
(@NotNull Metrics.CustomChart chart) void
shutdown()
-
Field Details
-
METRICS_VERSION
- See Also:
-
-
Constructor Details
-
MetricsBase
public MetricsBase(@NotNull @NotNull String platform, @NotNull @NotNull String serverUuid, boolean enabled, @NotNull @NotNull Consumer<@NotNull Metrics.JsonObjectBuilder> appendPlatformDataConsumer, @NotNull @NotNull Consumer<@NotNull Metrics.JsonObjectBuilder> appendServiceDataConsumer, @NotNull @NotNull Consumer<@NotNull Runnable> submitTaskConsumer, @NotNull @NotNull Supplier<@NotNull Boolean> checkServiceEnabledSupplier, @NotNull @NotNull BiConsumer<@NotNull String, @NotNull Throwable> errorLogger, @NotNull @NotNull Consumer<@NotNull String> infoLogger, boolean logErrors, boolean logSentData, boolean logResponseStatusText) Creates a new MetricsBase class instance.- Parameters:
platform
- The platform of the service.serverUuid
- The server uuid.enabled
- Whether data sending is enabled.appendPlatformDataConsumer
- A consumer that receives aJsonObjectBuilder
and appends all platform-specific data.appendServiceDataConsumer
- A consumer that receives aJsonObjectBuilder
and appends all service-specific data.submitTaskConsumer
- A consumer that takes a runnable with the submit task. This can be used to delegate the data collection to another thread to prevent errors caused by concurrency. Can benull
.checkServiceEnabledSupplier
- A supplier to check if the service is still enabled.errorLogger
- A consumer that accepts log message and an error.infoLogger
- A consumer that accepts info log messages.logErrors
- Whether errors should be logged.logSentData
- Whether the data sent should be logged.logResponseStatusText
- Whether the response status text should be logged.
-
-
Method Details
-
addCustomChart
-
shutdown
public void shutdown()
-