forked from Cysharp/MagicOnion
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMagicOnionOpenTelemetryOption.cs
More file actions
43 lines (41 loc) · 1.6 KB
/
MagicOnionOpenTelemetryOption.cs
File metadata and controls
43 lines (41 loc) · 1.6 KB
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
using System;
using System.Reflection;
using OpenTelemetry.Metrics;
using OpenTelemetry.Metrics.Export;
namespace MagicOnion.Server.OpenTelemetry
{
public class MagicOnionOpenTelemetryOptions
{
/// <summary>
/// Metrics Exporter Endpoint. Default Prometheus endpoint.
/// </summary>
public string MetricsExporterEndpoint { get; set; } = "http://127.0.0.1:9184/metrics/";
/// <summary>
/// Metrics Exporter Hosting Endpoint.
/// </summary>
public string MetricsExporterHostingEndpoint { get; set; } = "http://+:9184/metrics/";
/// <summary>
/// Tracer ServiceName use as ActivitySource
/// </summary>
public string MagicOnionActivityName { get; set; } = Assembly.GetEntryAssembly().GetName().Name;
}
public class MagicOnionOpenTelemetryMeterFactoryOption
{
/// <summary>
/// OpenTelemetry MetricsProcessor. default is <see cref="UngroupedBatcher"/>
/// </summary>
public MetricProcessor MetricProcessor { get; set; } = new UngroupedBatcher();
/// <summary>
/// OpenTelemetry MetricsExporter Implementation to use.
/// </summary>
public MetricExporter MetricExporter { get; set; }
/// <summary>
/// OpenTelemetry Metric Push Interval.
/// </summary>
public TimeSpan MetricPushInterval { get; set; } = TimeSpan.FromSeconds(10);
/// <summary>
/// MagicOnionLogger to collect OpenTelemetry metrics.
/// </summary>
public Func<MeterProvider, IMagicOnionLogger> MeterLogger { get; set; }
}
}