-
Notifications
You must be signed in to change notification settings - Fork 794
/
Copy pathIOtlpExporterOptions.cs
106 lines (99 loc) · 4.34 KB
/
IOtlpExporterOptions.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
#if NETFRAMEWORK
using System.Net.Http;
#endif
namespace OpenTelemetry.Exporter;
/// <summary>
/// Describes the OpenTelemetry Protocol (OTLP) exporter options shared by all
/// signals.
/// </summary>
internal interface IOtlpExporterOptions
{
/// <summary>
/// Gets or sets the OTLP transport protocol.
/// </summary>
OtlpExportProtocol Protocol { get; set; }
/// <summary>
/// Gets or sets the target to which the exporter is going to send
/// telemetry.
/// </summary>
/// <remarks>
/// Notes:
/// <list type="bullet">
/// <item>When setting <see cref="Endpoint"/> the value must be a valid <see
/// cref="Uri"/> with scheme (http or https) and host, and may contain a
/// port and path.</item>
/// <item>The default value when not set is based on the <see
/// cref="Protocol"/> property:
/// <list type="bullet">
/// <item><c>http://localhost:4317</c> for <see
/// cref="OtlpExportProtocol.Grpc"/>.</item>
/// <item><c>http://localhost:4318</c> for <see
/// cref="OtlpExportProtocol.HttpProtobuf"/></item>.
/// </list>
/// <item>When <see cref="Protocol"/> is set to <see
/// cref="OtlpExportProtocol.HttpProtobuf"/> and <see cref="Endpoint"/> has
/// not been set the default value (<c>http://localhost:4318</c>) will have
/// a signal-specific path appended. The final default endpoint values will
/// be constructed as:
/// <list type="bullet">
/// <item>Logging: <c>http://localhost:4318/v1/logs</c></item>
/// <item>Metrics: <c>http://localhost:4318/v1/metrics</c></item>
/// <item>Tracing: <c>http://localhost:4318/v1/traces</c></item>
/// </list>
/// </item>
/// </item>
/// </list>
/// </remarks>
Uri Endpoint { get; set; }
/// <summary>
/// Gets or sets optional headers for the connection.
/// </summary>
/// <remarks>
/// Note: Refer to the <see
/// href="https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#specifying-headers-via-environment-variables">
/// OpenTelemetry Specification</see> for details on the format of <see
/// cref="Headers"/>.
/// </remarks>
string? Headers { get; set; }
/// <summary>
/// Gets or sets the max waiting time (in milliseconds) for the backend to
/// process each batch. Default value: <c>10000</c>.
/// </summary>
int TimeoutMilliseconds { get; set; }
/// <summary>
/// Gets or sets the factory function called to create the <see
/// cref="HttpClient"/> instance that will be used at runtime to
/// transmit telemetry over HTTP. The returned instance will be reused
/// for all export invocations.
/// </summary>
/// <remarks>
/// Notes:
/// <list type="bullet">
/// <item>This is only invoked for the <see
/// cref="OtlpExportProtocol.HttpProtobuf"/> protocol.</item>
/// <item>The default behavior when using tracing registration extensions is
/// if an <a
/// href="https://docs.microsoft.com/dotnet/api/system.net.http.ihttpclientfactory">IHttpClientFactory</a>
/// instance can be resolved through the application <see
/// cref="IServiceProvider"/> then an <see cref="HttpClient"/> will be
/// created through the factory with the name "OtlpTraceExporter" otherwise
/// an <see cref="HttpClient"/> will be instantiated directly.</item>
/// <item>The default behavior when using metrics registration extensions is
/// if an <a
/// href="https://docs.microsoft.com/dotnet/api/system.net.http.ihttpclientfactory">IHttpClientFactory</a>
/// instance can be resolved through the application <see
/// cref="IServiceProvider"/> then an <see cref="HttpClient"/> will be
/// created through the factory with the name "OtlpMetricExporter" otherwise
/// an <see cref="HttpClient"/> will be instantiated directly.</item>
/// <item>
/// The default behavior when using logging registration extensions is an
/// <see cref="HttpClient"/> will be instantiated directly. <a
/// href="https://docs.microsoft.com/dotnet/api/system.net.http.ihttpclientfactory">IHttpClientFactory</a>
/// is not currently supported for logging.
/// </item>
/// </list>
/// </remarks>
Func<HttpClient> HttpClientFactory { get; set; }
}