-
Notifications
You must be signed in to change notification settings - Fork 123
[FileBasedConfiguration] Instrumentation Configuration #4492
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
Open
ysolomchenko
wants to merge
24
commits into
open-telemetry:main
Choose a base branch
from
ysolomchenko:FileBasedConfiguration-Instrumentation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
10d1342
[FileBased] Add Instrumentation
ysolomchenko a5ac594
[File-Based] Add Instrumentation option tests
ysolomchenko 9038aef
Merge branch 'main' into FileBasedConfiguration-Instrumentation
ysolomchenko bde4ef5
[File-Based] Add instrumentation docs
ysolomchenko bb63fe8
fix
ysolomchenko 0eab3d1
fix
ysolomchenko 255c2e5
git ignore regex
ysolomchenko b9833e3
Update .gitignore for RegexGenerator file
ysolomchenko 9bf9d1e
Fix formatting and spacing in RegexGenerator.g.cs
ysolomchenko bffc31d
Remove gitignore
ysolomchenko ee5baf5
fix test
ysolomchenko 4eabeac
fix docs
ysolomchenko a929a87
Merge branch 'main' into FileBasedConfiguration-Instrumentation
ysolomchenko f5f1396
[File-Based] Fix capture headers
ysolomchenko 241ea19
docs disable nstrumentation
ysolomchenko 548f7e4
multiple headers in example
ysolomchenko 2c36af4
`GraphQLSetDocumentConfiguration` instead of `SetDocumentConfiguration`.
ysolomchenko 65692bc
[FileBased] Add Log4Net Bridge support
ysolomchenko 2b1b8dd
Merge branch 'main' into FileBasedConfiguration-Instrumentation
ysolomchenko 8e7658e
remove set_db_statement_for_text for Entity Framework
ysolomchenko 0ec2986
fix log4net bridge
ysolomchenko ea047c0
update docs
ysolomchenko 554d0b2
update docs
ysolomchenko 138a943
fix
ysolomchenko 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
25 changes: 25 additions & 0 deletions
25
....AutoInstrumentation/Configurations/FileBasedConfiguration/CaptureHeadersConfiguration.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,25 @@ | ||
| // Copyright The OpenTelemetry Authors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| using OpenTelemetry.AutoInstrumentation.Configurations.FileBasedConfiguration.Parser; | ||
| using Vendors.YamlDotNet.Serialization; | ||
|
|
||
| namespace OpenTelemetry.AutoInstrumentation.Configurations.FileBasedConfiguration; | ||
|
|
||
| [EmptyObjectOnEmptyYaml] | ||
| internal class CaptureHeadersConfiguration | ||
| { | ||
| /// <summary> | ||
| /// Gets or sets a comma-separated list of HTTP header names. | ||
| /// Instrumentations will capture HTTP request header values for all configured header names. | ||
| /// </summary> | ||
| [YamlMember(Alias = "capture_request_headers")] | ||
| public string? CaptureRequestHeaders { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets a comma-separated list of HTTP header names. | ||
| /// Instrumentations will capture HTTP response header values for all configured header names. | ||
| /// </summary> | ||
| [YamlMember(Alias = "capture_response_headers")] | ||
| public string? CaptureResponseHeaders { get; set; } | ||
| } |
25 changes: 25 additions & 0 deletions
25
...AutoInstrumentation/Configurations/FileBasedConfiguration/CaptureMetadataConfiguration.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,25 @@ | ||
| // Copyright The OpenTelemetry Authors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| using OpenTelemetry.AutoInstrumentation.Configurations.FileBasedConfiguration.Parser; | ||
| using Vendors.YamlDotNet.Serialization; | ||
|
|
||
| namespace OpenTelemetry.AutoInstrumentation.Configurations.FileBasedConfiguration; | ||
|
|
||
| [EmptyObjectOnEmptyYaml] | ||
| internal class CaptureMetadataConfiguration | ||
| { | ||
| /// <summary> | ||
| /// Gets or sets a comma-separated list of gRPC metadata names. | ||
| /// Grpc.Net.Client instrumentations will capture gRPC request metadata values for all configured metadata names. | ||
| /// </summary> | ||
| [YamlMember(Alias = "capture_request_metadata")] | ||
| public string? CaptureRequestMetadata { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets a comma-separated list of gRPC metadata names. | ||
| /// Grpc.Net.Client instrumentations will capture gRPC response metadata values for all configured metadata names. | ||
| /// </summary> | ||
| [YamlMember(Alias = "capture_response_metadata")] | ||
| public string? CaptureResponseMetadata { get; set; } | ||
| } |
27 changes: 27 additions & 0 deletions
27
...emetry.AutoInstrumentation/Configurations/FileBasedConfiguration/DotNetInstrumentation.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,27 @@ | ||
| // Copyright The OpenTelemetry Authors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| using Vendors.YamlDotNet.Serialization; | ||
|
|
||
| namespace OpenTelemetry.AutoInstrumentation.Configurations.FileBasedConfiguration; | ||
|
|
||
| internal class DotNetInstrumentation | ||
| { | ||
| /// <summary> | ||
| /// Gets or sets the configuration for .NET traces instrumentation. | ||
| /// </summary> | ||
| [YamlMember(Alias = "traces")] | ||
| public DotNetTraces? Traces { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the configuration for .NET metrics instrumentation. | ||
| /// </summary> | ||
| [YamlMember(Alias = "metrics")] | ||
| public DotNetMetrics? Metrics { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the configuration for .NET logs instrumentation. | ||
| /// </summary> | ||
| [YamlMember(Alias = "logs")] | ||
| public DotNetLogs? Logs { get; set; } | ||
| } |
41 changes: 41 additions & 0 deletions
41
src/OpenTelemetry.AutoInstrumentation/Configurations/FileBasedConfiguration/DotNetLogs.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,41 @@ | ||
| // Copyright The OpenTelemetry Authors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| using Vendors.YamlDotNet.Serialization; | ||
|
|
||
| namespace OpenTelemetry.AutoInstrumentation.Configurations.FileBasedConfiguration; | ||
|
|
||
| internal class DotNetLogs | ||
| { | ||
| /// <summary> | ||
| /// Gets or sets the ILogger logs instrumentation configuration. | ||
| /// </summary> | ||
| [YamlMember(Alias = "ilogger")] | ||
| public object? ILogger { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the Log4Net logs instrumentation configuration. | ||
| /// </summary> | ||
| [YamlMember(Alias = "log4net")] | ||
| public Log4NetBridgeEnabled? Log4Net { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Returns the list of enabled log instrumentations. | ||
| /// </summary> | ||
| public IReadOnlyList<LogInstrumentation> GetEnabledInstrumentations() | ||
| { | ||
| var result = new List<LogInstrumentation>(); | ||
|
|
||
| if (ILogger != null) | ||
| { | ||
| result.Add(LogInstrumentation.ILogger); | ||
| } | ||
|
|
||
| if (Log4Net != null) | ||
| { | ||
| result.Add(LogInstrumentation.Log4Net); | ||
| } | ||
|
|
||
| return result; | ||
| } | ||
| } |
79 changes: 79 additions & 0 deletions
79
src/OpenTelemetry.AutoInstrumentation/Configurations/FileBasedConfiguration/DotNetMetrics.cs
zacharycmontoya marked this conversation as resolved.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| // Copyright The OpenTelemetry Authors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| using System.Reflection; | ||
| using Vendors.YamlDotNet.Serialization; | ||
|
|
||
| namespace OpenTelemetry.AutoInstrumentation.Configurations.FileBasedConfiguration; | ||
|
|
||
| internal class DotNetMetrics | ||
| { | ||
| #if NETFRAMEWORK | ||
| /// <summary> | ||
| /// Gets or sets the ASP.NET metrics instrumentation configuration. | ||
| /// </summary> | ||
| [YamlMember(Alias = "aspnet")] | ||
| public object? AspNet { get; set; } | ||
| #endif | ||
|
|
||
| #if NET | ||
| /// <summary> | ||
| /// Gets or sets the ASP.NET Core metrics instrumentation configuration. | ||
| /// </summary> | ||
| [YamlMember(Alias = "aspnetcore")] | ||
| public object? AspNetCore { get; set; } | ||
| #endif | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the HttpClient metrics instrumentation configuration. | ||
| /// </summary> | ||
| [YamlMember(Alias = "httpclient")] | ||
| public object? HttpClient { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the .NET runtime metrics instrumentation configuration. | ||
| /// </summary> | ||
| [YamlMember(Alias = "netruntime")] | ||
| public object? NetRuntime { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the NServiceBus metrics instrumentation configuration. | ||
| /// </summary> | ||
| [YamlMember(Alias = "nservicebus")] | ||
| public object? NServiceBus { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the process metrics instrumentation configuration. | ||
| /// </summary> | ||
| [YamlMember(Alias = "process")] | ||
| public object? Process { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the SqlClient metrics instrumentation configuration. | ||
| /// </summary> | ||
| [YamlMember(Alias = "sqlclient")] | ||
| public object? SqlClient { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Returns the list of enabled metric instrumentations. | ||
| /// </summary> | ||
| public IReadOnlyList<MetricInstrumentation> GetEnabledInstrumentations() | ||
| { | ||
| var enabled = new List<MetricInstrumentation>(); | ||
| var properties = typeof(DotNetMetrics).GetProperties(BindingFlags.Instance | BindingFlags.Public); | ||
|
|
||
| foreach (var prop in properties) | ||
| { | ||
| var value = prop.GetValue(this); | ||
| if (value != null) | ||
| { | ||
| if (Enum.TryParse<MetricInstrumentation>(prop.Name, out var instrumentation)) | ||
| { | ||
| enabled.Add(instrumentation); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| return enabled; | ||
| } | ||
| } |
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.