-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMauiProgram.cs
52 lines (42 loc) · 1.47 KB
/
MauiProgram.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using MauiAppClient.Services;
using Microsoft.AspNetCore.SignalR.Client;
using Microsoft.Extensions.Logging;
using OpenTelemetry;
using OpenTelemetry.Metrics;
namespace MauiAppClient;
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
});
#if DEBUG
builder.Logging.AddDebug();
#endif
builder.Services.AddSingleton<MainPage>();
// Include signalR connections.
CounterHubService.SetConnection(
new HubConnectionBuilder()
.WithUrl("https://localhost:7007/counterHub")
.Build());
StockHubService.SetConnection(
new HubConnectionBuilder()
.WithUrl("https://localhost:7007/stockHub")
.Build());
// Include OpenTelemetry meter provider.
var meterProvider = Sdk
.CreateMeterProviderBuilder()
.AddMeter("counterHubMeter")
.AddPrometheusHttpListener(options => options.UriPrefixes = new string[] { "http://localhost:9464/" })
.Build();
builder.Services.AddSingleton(meterProvider);
// Include more OpenTelemetry provider if necessary.
return builder.Build();
}
}