maybe
Some checks failed
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Failing after 2m1s

This commit is contained in:
Lee
2024-04-18 16:28:09 +01:00
parent 3ac4bfe2ee
commit 046df7fd1f
18 changed files with 22 additions and 35 deletions

View File

@ -1,10 +1,8 @@
package xyz.mcutils.backend.config;
import lombok.extern.log4j.Log4j2;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
@Configuration
@EnableMongoRepositories(basePackages = "xyz.mcutils.backend.repository.mongo")
public class MongoConfig {
}
public class MongoConfig { }

View File

@ -1,9 +1,6 @@
package xyz.mcutils.backend.repository.mongo;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import xyz.mcutils.backend.service.metric.Metric;
/**
@ -11,4 +8,4 @@ import xyz.mcutils.backend.service.metric.Metric;
*
* @author Braydon
*/
public interface MetricsRepository extends CrudRepository<Metric<?>, String> { }
public interface MetricsRepository extends MongoRepository<Metric<?>, String> { }

View File

@ -1,8 +1,6 @@
package xyz.mcutils.backend.repository.redis;
import org.springframework.data.redis.repository.configuration.EnableRedisRepositories;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import xyz.mcutils.backend.model.cache.CachedEndpointStatus;
/**

View File

@ -1,8 +1,6 @@
package xyz.mcutils.backend.repository.redis;
import org.springframework.data.redis.repository.configuration.EnableRedisRepositories;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import xyz.mcutils.backend.model.cache.CachedMinecraftServer;
/**

View File

@ -1,8 +1,6 @@
package xyz.mcutils.backend.repository.redis;
import org.springframework.data.redis.repository.configuration.EnableRedisRepositories;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import xyz.mcutils.backend.model.cache.CachedPlayer;
import java.util.UUID;

View File

@ -1,8 +1,6 @@
package xyz.mcutils.backend.repository.redis;
import org.springframework.data.redis.repository.configuration.EnableRedisRepositories;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import xyz.mcutils.backend.model.cache.CachedPlayerName;
/**

View File

@ -1,8 +1,6 @@
package xyz.mcutils.backend.repository.redis;
import org.springframework.data.redis.repository.configuration.EnableRedisRepositories;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import xyz.mcutils.backend.model.cache.CachedPlayerSkinPart;
/**

View File

@ -7,6 +7,7 @@ import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import xyz.mcutils.backend.common.Timer;
import xyz.mcutils.backend.config.Config;
import xyz.mcutils.backend.repository.mongo.MetricsRepository;
import xyz.mcutils.backend.service.metric.Metric;
import xyz.mcutils.backend.service.metric.metrics.*;
@ -55,17 +56,19 @@ public class MetricService {
collectorEnabled.put(metric, metric.isCollector());
}
// Load the metrics from Redis
loadMetrics();
if (Config.INSTANCE.isProduction()) {
// Load the metrics from Redis
loadMetrics();
for (Map.Entry<Metric<?>, Boolean> entry : collectorEnabled.entrySet()) {
entry.getKey().setCollector(entry.getValue());
for (Map.Entry<Metric<?>, Boolean> entry : collectorEnabled.entrySet()) {
entry.getKey().setCollector(entry.getValue());
}
Timer.scheduleRepeating(() -> {
saveMetrics();
writeToInflux();
}, saveInterval, saveInterval);
}
Timer.scheduleRepeating(() -> {
saveMetrics();
writeToInflux();
}, saveInterval, saveInterval);
}
/**

View File

@ -9,7 +9,6 @@ import lombok.ToString;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.mapping.Document;
import xyz.mcutils.backend.service.MetricService;
@AllArgsConstructor
@Getter @Setter @ToString

View File

@ -1,6 +1,5 @@
package xyz.mcutils.backend.service.metric.metrics;
import xyz.mcutils.backend.service.MetricService;
import xyz.mcutils.backend.service.metric.impl.IntegerMetric;
import xyz.mcutils.backend.websocket.MetricsWebSocketHandler;

View File

@ -1,6 +1,5 @@
package xyz.mcutils.backend.service.metric.metrics;
import xyz.mcutils.backend.service.MetricService;
import xyz.mcutils.backend.service.metric.impl.IntegerMetric;
import java.util.ArrayList;

View File

@ -1,6 +1,5 @@
package xyz.mcutils.backend.service.metric.metrics;
import xyz.mcutils.backend.service.MetricService;
import xyz.mcutils.backend.service.metric.impl.IntegerMetric;
import java.util.ArrayList;

View File

@ -1,7 +1,6 @@
package xyz.mcutils.backend.service.metric.metrics.process;
import com.sun.management.OperatingSystemMXBean;
import xyz.mcutils.backend.service.MetricService;
import xyz.mcutils.backend.service.metric.impl.DoubleMetric;
import java.lang.management.ManagementFactory;

View File

@ -1,6 +1,5 @@
package xyz.mcutils.backend.service.metric.metrics.process;
import xyz.mcutils.backend.service.MetricService;
import xyz.mcutils.backend.service.metric.impl.MapMetric;
public class MemoryMetric extends MapMetric<String, Long> {