-
Couldn't load subscription status.
- Fork 123
[FileBasedConfiguration] Tracer Provider Configuration #4487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Kielek
merged 26 commits into
open-telemetry:main
from
ysolomchenko:FileBasedConfiguration-Traces
Oct 24, 2025
Merged
Changes from 11 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
bcedd1c
[File-Based] Add traces exporter configuration
ysolomchenko 00dda04
[FileBased] Add traces Tests
ysolomchenko d6ec27a
[File-Based] Add Batch options
ysolomchenko a64259e
Merge branch 'main' into FileBasedConfiguration-Traces
ysolomchenko d35c375
[File-Based] Add Tracer Provider Docs
ysolomchenko bee1a0c
fix docs
ysolomchenko 44bc7f1
Merge branch 'main' into FileBasedConfiguration-Traces
ysolomchenko afd0ece
Add note about multiple processor support
ysolomchenko 6ad3fbc
fix no_code
ysolomchenko 1e188bb
Merge branch 'main' into FileBasedConfiguration-Traces
Kielek 56eb56c
remove redundant usings
Kielek 89c9f2b
refactor tests
ysolomchenko 90590b8
[File Based] accept multiple processors
ysolomchenko f24901e
update tests
ysolomchenko de5d74f
update docs
ysolomchenko ea0f538
Merge branch 'main' into FileBasedConfiguration-Traces
ysolomchenko 28eb9cd
fix
ysolomchenko ba3800b
Merge branch 'FileBasedConfiguration-Traces' of https://github.com/ys…
ysolomchenko 4820495
fix
ysolomchenko 1416380
Merge branch 'main' into FileBasedConfiguration-Traces
ysolomchenko 21b860a
fix var name
ysolomchenko 5276b25
fix test
ysolomchenko 0faa54f
Separate configuration for batch/simple processors
Kielek ff00c98
Validate configuration while configuring exporters
Kielek 4b2b887
Merge branch 'main' into FileBasedConfiguration-Traces
Kielek 3f1651d
Merge branch 'main' into FileBasedConfiguration-Traces
Kielek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
...lemetry.AutoInstrumentation/Configurations/FileBasedConfiguration/BatchProcessorConfig.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| // Copyright The OpenTelemetry Authors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| using System.Diagnostics; | ||
| using Vendors.YamlDotNet.Serialization; | ||
|
|
||
| namespace OpenTelemetry.AutoInstrumentation.Configurations.FileBasedConfiguration; | ||
|
|
||
| internal class BatchProcessorConfig | ||
| { | ||
| /// <summary> | ||
| /// Gets or sets the delay interval (in milliseconds) between two consecutive exports. | ||
| /// Value must be non-negative. | ||
| /// If omitted or null, 5000 is used. | ||
| /// </summary> | ||
| [YamlMember(Alias = "schedule_delay")] | ||
| public int ScheduleDelay { get; set; } = 5000; | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the maximum allowed time (in milliseconds) to export data. | ||
| /// Value must be non-negative. A value of 0 indicates no limit (infinity). | ||
| /// If omitted or null, 30000 is used. | ||
| /// </summary> | ||
| [YamlMember(Alias = "export_timeout")] | ||
| public int ExportTimeout { get; set; } = 30000; | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the maximum queue size. | ||
| /// Value must be positive. | ||
| /// If omitted or null, 2048 is used. | ||
| /// </summary> | ||
| [YamlMember(Alias = "max_queue_size")] | ||
| public int MaxQueueSize { get; set; } = 2048; | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the maximum batch size. | ||
| /// Value must be positive. | ||
| /// If omitted or null, 512 is used. | ||
| /// </summary> | ||
| [YamlMember(Alias = "max_export_batch_size")] | ||
| public int MaxExportBatchSize { get; set; } = 512; | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the exporters. | ||
| /// </summary> | ||
| [YamlMember(Alias = "exporter")] | ||
| public ExporterConfig? Exporter { get; set; } | ||
|
|
||
| public void CopyTo(BatchExportProcessorOptions<Activity> options) | ||
| { | ||
| options.ScheduledDelayMilliseconds = ScheduleDelay; | ||
| options.ExporterTimeoutMilliseconds = ExportTimeout; | ||
| options.MaxQueueSize = MaxQueueSize; | ||
| options.MaxExportBatchSize = MaxExportBatchSize; | ||
| } | ||
| } |
39 changes: 39 additions & 0 deletions
39
...OpenTelemetry.AutoInstrumentation/Configurations/FileBasedConfiguration/ExporterConfig.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| // Copyright The OpenTelemetry Authors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| using Vendors.YamlDotNet.Serialization; | ||
|
|
||
| namespace OpenTelemetry.AutoInstrumentation.Configurations.FileBasedConfiguration; | ||
|
|
||
| internal class ExporterConfig | ||
Kielek marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| { | ||
| /// <summary> | ||
| /// Gets or sets the OTLP HTTP exporter configuration. | ||
| /// </summary> | ||
| [YamlMember(Alias = "otlp_http")] | ||
| public OtlpHttpExporterConfig? OtlpHttp { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the OTLP gRPC exporter configuration. | ||
| /// </summary> | ||
| [YamlMember(Alias = "otlp_grpc")] | ||
| public OtlpGrpcExporterConfig? OtlpGrpc { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the Zipkin exporter configuration. | ||
| /// </summary> | ||
| [YamlMember(Alias = "zipkin")] | ||
| public ZipkinExporterConfig? Zipkin { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the Prometheus exporter configuration. | ||
| /// </summary> | ||
| [YamlMember(Alias = "prometheus")] | ||
| public object? Prometheus { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the console exporter configuration. | ||
| /// </summary> | ||
| [YamlMember(Alias = "console")] | ||
| public object? Console { get; set; } | ||
| } | ||
21 changes: 21 additions & 0 deletions
21
src/OpenTelemetry.AutoInstrumentation/Configurations/FileBasedConfiguration/Header.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| // Copyright The OpenTelemetry Authors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| using Vendors.YamlDotNet.Serialization; | ||
|
|
||
| namespace OpenTelemetry.AutoInstrumentation.Configurations.FileBasedConfiguration; | ||
|
|
||
| internal class Header | ||
| { | ||
| /// <summary> | ||
| /// Gets or sets the name of the header. | ||
| /// </summary> | ||
| [YamlMember(Alias = "name")] | ||
| public string? Name { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the value of the header. | ||
| /// </summary> | ||
| [YamlMember(Alias = "value")] | ||
| public string? Value { get; set; } | ||
| } |
42 changes: 42 additions & 0 deletions
42
...metry.AutoInstrumentation/Configurations/FileBasedConfiguration/OtlpGrpcExporterConfig.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| // Copyright The OpenTelemetry Authors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| using Vendors.YamlDotNet.Serialization; | ||
|
|
||
| namespace OpenTelemetry.AutoInstrumentation.Configurations.FileBasedConfiguration; | ||
|
|
||
| internal class OtlpGrpcExporterConfig | ||
| { | ||
| /// <summary> | ||
| /// Gets or sets the endpoint for the OTLP gRPC exporter. | ||
| /// Configure endpoint. | ||
| /// If omitted or null, http://localhost:4317 is used. | ||
Kielek marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| /// </summary> | ||
| [YamlMember(Alias = "endpoint")] | ||
| public string? Endpoint { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the headers for the exporter. | ||
| /// Configure headers. Entries have higher priority than entries from <c>headers_list</c>. | ||
| /// If an entry's value is null, the entry is ignored. | ||
| /// </summary> | ||
| [YamlMember(Alias = "headers")] | ||
| public List<Header>? Headers { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the headers list for the exporter. | ||
| /// Configure headers. Entries have lower priority than entries from <c>headers</c>. | ||
| /// The value is a list of comma separated key-value pairs matching the format of OTEL_EXPORTER_OTLP_HEADERS. | ||
| /// If omitted or null, no headers are added. | ||
| /// </summary> | ||
| [YamlMember(Alias = "headers_list")] | ||
| public string? HeadersList { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the maximum time (in milliseconds) to wait for each export. | ||
| /// Value must be non-negative. A value of 0 indicates no limit (infinity). | ||
| /// If omitted or null, 10000 is used. | ||
| /// </summary> | ||
| [YamlMember(Alias = "timeout")] | ||
| public int? Timeout { get; set; } = 10000; | ||
| } | ||
42 changes: 42 additions & 0 deletions
42
...metry.AutoInstrumentation/Configurations/FileBasedConfiguration/OtlpHttpExporterConfig.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| // Copyright The OpenTelemetry Authors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| using Vendors.YamlDotNet.Serialization; | ||
|
|
||
| namespace OpenTelemetry.AutoInstrumentation.Configurations.FileBasedConfiguration; | ||
|
|
||
| internal class OtlpHttpExporterConfig | ||
| { | ||
| /// <summary> | ||
| /// Gets or sets the endpoint for the OTLP HTTP exporter. | ||
| /// Configure endpoint. | ||
| /// If omitted or null, http://localhost:4318 is used. | ||
| /// </summary> | ||
| [YamlMember(Alias = "endpoint")] | ||
| public string? Endpoint { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the headers for the exporter. | ||
| /// Configure headers. Entries have higher priority than entries from <c>headers_list</c>. | ||
| /// If an entry's value is null, the entry is ignored. | ||
| /// </summary> | ||
| [YamlMember(Alias = "headers")] | ||
| public List<Header>? Headers { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the headers list for the exporter. | ||
| /// Configure headers. Entries have lower priority than entries from <c>headers</c>. | ||
| /// The value is a list of comma separated key-value pairs matching the format of OTEL_EXPORTER_OTLP_HEADERS. | ||
| /// If omitted or null, no headers are added. | ||
| /// </summary> | ||
| [YamlMember(Alias = "headers_list")] | ||
| public string? HeadersList { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the maximum time (in milliseconds) to wait for each export. | ||
| /// Value must be non-negative. A value of 0 indicates no limit (infinity). | ||
| /// If omitted or null, 10000 is used. | ||
| /// </summary> | ||
| [YamlMember(Alias = "timeout")] | ||
| public int? Timeout { get; set; } = 10000; | ||
| } |
12 changes: 12 additions & 0 deletions
12
....AutoInstrumentation/Configurations/FileBasedConfiguration/TracerProviderConfiguration.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| // Copyright The OpenTelemetry Authors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| using Vendors.YamlDotNet.Serialization; | ||
|
|
||
| namespace OpenTelemetry.AutoInstrumentation.Configurations.FileBasedConfiguration; | ||
|
|
||
| internal class TracerProviderConfiguration | ||
| { | ||
| [YamlMember(Alias = "processors")] | ||
| public Dictionary<string, BatchProcessorConfig> Processors { get; set; } = new(); | ||
Kielek marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...lemetry.AutoInstrumentation/Configurations/FileBasedConfiguration/ZipkinExporterConfig.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| // Copyright The OpenTelemetry Authors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| using OpenTelemetry.Exporter; | ||
| using Vendors.YamlDotNet.Serialization; | ||
|
|
||
| namespace OpenTelemetry.AutoInstrumentation.Configurations.FileBasedConfiguration; | ||
|
|
||
| internal class ZipkinExporterConfig | ||
| { | ||
| /// <summary> | ||
| /// Gets or sets the Zipkin endpoint URL to which spans are exported. | ||
| /// If omitted or null, the default value "http://localhost:9411/api/v2/spans" is used. | ||
| /// </summary> | ||
| [YamlMember(Alias = "endpoint")] | ||
| public string Endpoint { get; set; } = "http://localhost:9411/api/v2/spans"; | ||
|
|
||
| public void CopyTo(ZipkinExporterOptions options) | ||
| { | ||
| options.Endpoint = new Uri(Endpoint); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.