-
Notifications
You must be signed in to change notification settings - Fork 775
/
OtlpExporterBuilderOptions.cs
64 lines (48 loc) · 2.89 KB
/
OtlpExporterBuilderOptions.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
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
#nullable enable
using System.Diagnostics;
using Microsoft.Extensions.Configuration;
using OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation;
using OpenTelemetry.Logs;
using OpenTelemetry.Metrics;
using OpenTelemetry.Trace;
namespace OpenTelemetry.Exporter;
internal sealed class OtlpExporterBuilderOptions
{
internal readonly SdkLimitOptions SdkLimitOptions;
internal readonly ExperimentalOptions ExperimentalOptions;
internal readonly LogRecordExportProcessorOptions? LogRecordExportProcessorOptions;
internal readonly MetricReaderOptions? MetricReaderOptions;
internal readonly ActivityExportProcessorOptions? ActivityExportProcessorOptions;
internal readonly OtlpExporterOptions DefaultOptionsInstance;
internal readonly OtlpExporterOptions LoggingOptionsInstance;
internal readonly OtlpExporterOptions MetricsOptionsInstance;
internal readonly OtlpExporterOptions TracingOptionsInstance;
internal OtlpExporterBuilderOptions(
IConfiguration configuration,
SdkLimitOptions sdkLimitOptions,
ExperimentalOptions experimentalOptions,
LogRecordExportProcessorOptions? logRecordExportProcessorOptions,
MetricReaderOptions? metricReaderOptions,
ActivityExportProcessorOptions? activityExportProcessorOptions)
{
Debug.Assert(configuration != null, "configuration was null");
Debug.Assert(sdkLimitOptions != null, "sdkLimitOptions was null");
Debug.Assert(experimentalOptions != null, "experimentalOptions was null");
this.SdkLimitOptions = sdkLimitOptions!;
this.ExperimentalOptions = experimentalOptions!;
this.LogRecordExportProcessorOptions = logRecordExportProcessorOptions;
this.MetricReaderOptions = metricReaderOptions;
this.ActivityExportProcessorOptions = activityExportProcessorOptions;
var defaultBatchOptions = this.ActivityExportProcessorOptions!.BatchExportProcessorOptions;
this.DefaultOptionsInstance = new OtlpExporterOptions(configuration!, OtlpExporterOptionsConfigurationType.Default, defaultBatchOptions);
this.LoggingOptionsInstance = new OtlpExporterOptions(configuration!, OtlpExporterOptionsConfigurationType.Logs, defaultBatchOptions);
this.MetricsOptionsInstance = new OtlpExporterOptions(configuration!, OtlpExporterOptionsConfigurationType.Metrics, defaultBatchOptions);
this.TracingOptionsInstance = new OtlpExporterOptions(configuration!, OtlpExporterOptionsConfigurationType.Traces, defaultBatchOptions);
}
public IOtlpExporterOptions DefaultOptions => this.DefaultOptionsInstance;
public IOtlpExporterOptions LoggingOptions => this.LoggingOptionsInstance;
public IOtlpExporterOptions MetricsOptions => this.MetricsOptionsInstance;
public IOtlpExporterOptions TracingOptions => this.TracingOptionsInstance;
}