Added initial observability
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
using Elastic.Extensions.Logging;
|
||||
using Elastic.Extensions.Logging.Options;
|
||||
using Elastic.Transport;
|
||||
using Pushy.Components;
|
||||
using StackExchange.Redis;
|
||||
using LinkGenerator = Pushy.LinkGenerator;
|
||||
@@ -9,21 +12,43 @@ builder.UseOrleans(silo =>
|
||||
silo.UseLocalhostClustering();
|
||||
silo.UseRedisReminderService(conf =>
|
||||
{
|
||||
conf.ConfigurationOptions = ConfigurationOptions.Parse(builder.Configuration.GetConnectionString("Valkey"));
|
||||
conf.ConfigurationOptions = ConfigurationOptions.Parse(builder.Configuration.GetConnectionString("Valkey")!);
|
||||
});
|
||||
|
||||
silo.AddRedisGrainStorageAsDefault(options =>
|
||||
{
|
||||
options.ConfigurationOptions =
|
||||
ConfigurationOptions.Parse(builder.Configuration.GetConnectionString("Valkey"));
|
||||
ConfigurationOptions.Parse(builder.Configuration.GetConnectionString("Valkey")!);
|
||||
});
|
||||
|
||||
silo.AddActivityPropagation();
|
||||
});
|
||||
|
||||
var transport = new TransportConfiguration(new StaticNodePool([new Uri("https://elastic-node-1.home.local:9200")]))
|
||||
.Authentication(new ApiKey(builder.Configuration["Elasticsearch:ApiKey"]!));
|
||||
|
||||
builder.Logging.AddElasticsearch(opt =>
|
||||
{
|
||||
opt.IsEnabled = true;
|
||||
opt.DataStream = new DataStreamNameOptions()
|
||||
{
|
||||
Type = "logs", DataSet = "Pushy", Namespace = "pushy"
|
||||
};
|
||||
opt.Transport = new DistributedTransport(transport);
|
||||
});
|
||||
|
||||
builder.Services.AddScoped<LinkGenerator>();
|
||||
builder.Services.AddAllElasticApm();
|
||||
|
||||
builder.Services.AddHealthChecks();
|
||||
builder.Services.AddCors(policy =>
|
||||
{
|
||||
policy.AddDefaultPolicy(builder =>
|
||||
{
|
||||
builder.WithOrigins("https://henrikml.dk")
|
||||
.AllowAnyHeader();
|
||||
});
|
||||
});
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddRazorComponents()
|
||||
@@ -35,6 +60,7 @@ builder.Services.AddResponseCompression();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
@@ -51,6 +77,7 @@ else
|
||||
app.UseHttpsRedirection();
|
||||
app.UseResponseCompression();
|
||||
|
||||
app.UseCors();
|
||||
|
||||
app.MapStaticAssets();
|
||||
app.UseAntiforgery();
|
||||
|
||||
Reference in New Issue
Block a user