Remove Prometheus
This commit is contained in:
parent
fc5ff87c8f
commit
c031d2bfb4
2 changed files with 2 additions and 22 deletions
|
@ -15,8 +15,6 @@ using Geekbot.net.Lib.Logger;
|
|||
using Geekbot.net.Lib.ReactionListener;
|
||||
using Geekbot.net.Lib.UserRepository;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Prometheus;
|
||||
|
||||
namespace Geekbot.net
|
||||
{
|
||||
public class Handlers
|
||||
|
@ -24,7 +22,6 @@ namespace Geekbot.net
|
|||
private readonly DatabaseContext _database;
|
||||
private readonly IDiscordClient _client;
|
||||
private readonly IGeekbotLogger _logger;
|
||||
private readonly IAlmostRedis _redis;
|
||||
private readonly IServiceProvider _servicesProvider;
|
||||
private readonly CommandService _commands;
|
||||
private readonly IUserRepository _userRepository;
|
||||
|
@ -33,10 +30,7 @@ namespace Geekbot.net
|
|||
private readonly RestApplication _applicationInfo;
|
||||
private readonly List<ulong> _ignoredServers;
|
||||
|
||||
private readonly Counter _messageCounterPrometheus =
|
||||
Metrics.CreateCounter("messages", "Number of discord messages", new CounterConfiguration() {LabelNames = new[] {"guild", "channel", "user"}});
|
||||
|
||||
public Handlers(DatabaseInitializer databaseInitializer, IDiscordClient client, IGeekbotLogger logger, IAlmostRedis redis,
|
||||
public Handlers(DatabaseInitializer databaseInitializer, IDiscordClient client, IGeekbotLogger logger,
|
||||
IServiceProvider servicesProvider, CommandService commands, IUserRepository userRepository,
|
||||
IReactionListener reactionListener, RestApplication applicationInfo)
|
||||
{
|
||||
|
@ -44,7 +38,6 @@ namespace Geekbot.net
|
|||
_messageCounterDatabaseContext = databaseInitializer.Initialize();
|
||||
_client = client;
|
||||
_logger = logger;
|
||||
_redis = redis;
|
||||
_servicesProvider = servicesProvider;
|
||||
_commands = commands;
|
||||
_userRepository = userRepository;
|
||||
|
@ -150,8 +143,6 @@ namespace Geekbot.net
|
|||
_messageCounterDatabaseContext.SaveChanges();
|
||||
}
|
||||
|
||||
_messageCounterPrometheus.WithLabels(channel.Guild.Id.ToString(), channel.Id.ToString(), message.Author.Id.ToString()).Inc();
|
||||
|
||||
if (message.Author.IsBot) return;
|
||||
_logger.Information(LogSource.Message, message.Content, SimpleConextConverter.ConvertSocketMessage(message));
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ using Geekbot.net.Lib.UserRepository;
|
|||
using Geekbot.net.WebApi;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Prometheus;
|
||||
using WikipediaApi;
|
||||
|
||||
namespace Geekbot.net
|
||||
|
@ -173,7 +172,7 @@ namespace Geekbot.net
|
|||
_servicesProvider = _services.BuildServiceProvider();
|
||||
await _commands.AddModulesAsync(Assembly.GetEntryAssembly(), _servicesProvider);
|
||||
|
||||
var handlers = new Handlers(_databaseInitializer, _client, _logger, _redis, _servicesProvider, _commands, _userRepository, reactionListener, applicationInfo);
|
||||
var handlers = new Handlers(_databaseInitializer, _client, _logger, _servicesProvider, _commands, _userRepository, reactionListener, applicationInfo);
|
||||
|
||||
_client.MessageReceived += handlers.RunCommand;
|
||||
_client.MessageDeleted += handlers.MessageDeleted;
|
||||
|
@ -184,8 +183,6 @@ namespace Geekbot.net
|
|||
_client.ReactionRemoved += handlers.ReactionRemoved;
|
||||
if (!_runParameters.InMemory) _client.MessageReceived += handlers.UpdateStats;
|
||||
|
||||
StartPrometheusServer();
|
||||
|
||||
var webserver = _runParameters.DisableApi ? Task.Delay(10) : StartWebApi();
|
||||
_logger.Information(LogSource.Geekbot, "Done and ready for use");
|
||||
|
||||
|
@ -213,13 +210,5 @@ namespace Geekbot.net
|
|||
WebApiStartup.StartWebApi(_logger, _runParameters, _commands, _databaseInitializer.Initialize(), _client, _globalSettings, highscoreManager);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private void StartPrometheusServer()
|
||||
{
|
||||
var port = _runParameters.PrometheusPort == "12991" ? 12991 : int.Parse(_runParameters.PrometheusPort);
|
||||
var server = new MetricServer(_runParameters.PrometheusHost, port);
|
||||
server.Start();
|
||||
_logger.Information(LogSource.Geekbot, $"Prometheus Metric Server running on {_runParameters.PrometheusHost}:{_runParameters.PrometheusPort}");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue