Skip to content
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

[kafka] bytecode instrumentation - sync #3055

Merged
merged 28 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
bbf764a
kafka instrumentation - sync
lachmatt Oct 30, 2023
6e3df61
remove bom
lachmatt Oct 30, 2023
8471219
remove BOM in additional file
lachmatt Oct 30, 2023
eb63351
initial pr feedback
lachmatt Oct 30, 2023
9f5bb92
duck types cleanup
lachmatt Oct 30, 2023
2393a60
tag to attribute rename
lachmatt Oct 30, 2023
5d92a7d
fix header
lachmatt Oct 30, 2023
c57b6d9
Merge branch 'main' into kafka-instrumentation
lachmatt Oct 31, 2023
a58ffdf
dockerfiles for kafka and zookeeper
lachmatt Oct 31, 2023
e326123
set only groupid conditionally
lachmatt Oct 31, 2023
59128d7
Merge branch 'main' into kafka-instrumentation
lachmatt Nov 2, 2023
7ca6ee1
duck typing improvements
lachmatt Nov 2, 2023
3712a5b
Merge branch 'main' into kafka-instrumentation
rajkumar-rangaraj Nov 6, 2023
cb209c3
remove duplicated line
lachmatt Nov 7, 2023
f528de7
add links to semantic conventions repo
lachmatt Nov 7, 2023
5f84b9a
fixed headers instantiation
lachmatt Nov 8, 2023
47e64ba
Merge branch 'main' into kafka-instrumentation
lachmatt Nov 8, 2023
d8c429d
cleanup
lachmatt Nov 9, 2023
9ae0c78
Merge branch 'main' into kafka-instrumentation
lachmatt Nov 17, 2023
fb2e35b
pr feedback
lachmatt Nov 17, 2023
6d898f7
Merge branch 'main' into kafka-instrumentation
lachmatt Nov 20, 2023
ded1dcc
Update src/OpenTelemetry.AutoInstrumentation/Instrumentations/Kafka/I…
lachmatt Nov 20, 2023
0cbe0f4
Merge branch 'main' into kafka-instrumentation
lachmatt Nov 20, 2023
a494a95
Merge branch 'main' into kafka-instrumentation
lachmatt Nov 22, 2023
e7ccb7a
reflect api changes correctly
lachmatt Nov 22, 2023
357dc48
Merge branch 'main' into kafka-instrumentation
lachmatt Nov 22, 2023
1fbfe86
Merge branch 'main' into kafka-instrumentation
lachmatt Nov 22, 2023
2a9183f
Merge branch 'main' into kafka-instrumentation
lachmatt Nov 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ This component adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.h
- Added support for [System.Data.SqlClient](https://www.nuget.org/packages/System.Data.SqlClient/)
(NuGet package) traces instrumentation from `4.8.5`.
- Ability to update installation via PS module (`OpenTelemetry.DotNet.Auto.psm1`).
- Added support for `KAFKA` traces instrumentation.

### Changed

Expand Down
43 changes: 29 additions & 14 deletions OpenTelemetry.AutoInstrumentation.sln
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestApplication.Wcf.Client.
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestApplication.MinimalApi", "test\test-applications\integrations\TestApplication.MinimalApi\TestApplication.MinimalApi.csproj", "{803A3DD1-016E-4713-8066-A1C81A6ADBA3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestApplication.Worker", "test\test-applications\integrations\TestApplication.Worker\TestApplication.Worker.csproj", "{E04065C2-0512-41C6-A428-AC85342B3D03}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestApplication.Kafka", "test\test-applications\integrations\TestApplication.Kafka\TestApplication.Kafka.csproj", "{A7551BDB-AD27-4E80-8B13-67C42F83554C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestApplication.Worker", "test\test-applications\integrations\TestApplication.Worker\TestApplication.Worker.csproj", "{AE2AAA2D-A214-4381-ACF5-D57980097873}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestApplication.SqlClient.System.NetFramework", "test\test-applications\integrations\TestApplication.SqlClient.System.NetFramework\TestApplication.SqlClient.System.NetFramework.csproj", "{D6720242-70E4-4C62-95BE-AA11944AE0DE}"
EndProject
Expand Down Expand Up @@ -957,18 +959,30 @@ Global
{803A3DD1-016E-4713-8066-A1C81A6ADBA3}.Release|x64.Build.0 = Release|x64
{803A3DD1-016E-4713-8066-A1C81A6ADBA3}.Release|x86.ActiveCfg = Release|x86
{803A3DD1-016E-4713-8066-A1C81A6ADBA3}.Release|x86.Build.0 = Release|x86
{E04065C2-0512-41C6-A428-AC85342B3D03}.Debug|Any CPU.ActiveCfg = Debug|x64
{E04065C2-0512-41C6-A428-AC85342B3D03}.Debug|Any CPU.Build.0 = Debug|x64
{E04065C2-0512-41C6-A428-AC85342B3D03}.Debug|x64.ActiveCfg = Debug|x64
{E04065C2-0512-41C6-A428-AC85342B3D03}.Debug|x64.Build.0 = Debug|x64
{E04065C2-0512-41C6-A428-AC85342B3D03}.Debug|x86.ActiveCfg = Debug|x86
{E04065C2-0512-41C6-A428-AC85342B3D03}.Debug|x86.Build.0 = Debug|x86
{E04065C2-0512-41C6-A428-AC85342B3D03}.Release|Any CPU.ActiveCfg = Release|x64
{E04065C2-0512-41C6-A428-AC85342B3D03}.Release|Any CPU.Build.0 = Release|x64
{E04065C2-0512-41C6-A428-AC85342B3D03}.Release|x64.ActiveCfg = Release|x64
{E04065C2-0512-41C6-A428-AC85342B3D03}.Release|x64.Build.0 = Release|x64
{E04065C2-0512-41C6-A428-AC85342B3D03}.Release|x86.ActiveCfg = Release|x86
{E04065C2-0512-41C6-A428-AC85342B3D03}.Release|x86.Build.0 = Release|x86
{A7551BDB-AD27-4E80-8B13-67C42F83554C}.Debug|Any CPU.ActiveCfg = Debug|x64
{A7551BDB-AD27-4E80-8B13-67C42F83554C}.Debug|Any CPU.Build.0 = Debug|x64
{A7551BDB-AD27-4E80-8B13-67C42F83554C}.Debug|x64.ActiveCfg = Debug|x64
{A7551BDB-AD27-4E80-8B13-67C42F83554C}.Debug|x64.Build.0 = Debug|x64
{A7551BDB-AD27-4E80-8B13-67C42F83554C}.Debug|x86.ActiveCfg = Debug|x86
{A7551BDB-AD27-4E80-8B13-67C42F83554C}.Debug|x86.Build.0 = Debug|x86
{A7551BDB-AD27-4E80-8B13-67C42F83554C}.Release|Any CPU.ActiveCfg = Release|x64
{A7551BDB-AD27-4E80-8B13-67C42F83554C}.Release|Any CPU.Build.0 = Release|x64
{A7551BDB-AD27-4E80-8B13-67C42F83554C}.Release|x64.ActiveCfg = Release|x64
{A7551BDB-AD27-4E80-8B13-67C42F83554C}.Release|x64.Build.0 = Release|x64
{A7551BDB-AD27-4E80-8B13-67C42F83554C}.Release|x86.ActiveCfg = Release|x86
{A7551BDB-AD27-4E80-8B13-67C42F83554C}.Release|x86.Build.0 = Release|x86
{AE2AAA2D-A214-4381-ACF5-D57980097873}.Debug|Any CPU.ActiveCfg = Debug|x64
{AE2AAA2D-A214-4381-ACF5-D57980097873}.Debug|Any CPU.Build.0 = Debug|x64
{AE2AAA2D-A214-4381-ACF5-D57980097873}.Debug|x64.ActiveCfg = Debug|x64
{AE2AAA2D-A214-4381-ACF5-D57980097873}.Debug|x64.Build.0 = Debug|x64
{AE2AAA2D-A214-4381-ACF5-D57980097873}.Debug|x86.ActiveCfg = Debug|x86
{AE2AAA2D-A214-4381-ACF5-D57980097873}.Debug|x86.Build.0 = Debug|x86
{AE2AAA2D-A214-4381-ACF5-D57980097873}.Release|Any CPU.ActiveCfg = Release|x64
{AE2AAA2D-A214-4381-ACF5-D57980097873}.Release|Any CPU.Build.0 = Release|x64
{AE2AAA2D-A214-4381-ACF5-D57980097873}.Release|x64.ActiveCfg = Release|x64
{AE2AAA2D-A214-4381-ACF5-D57980097873}.Release|x64.Build.0 = Release|x64
{AE2AAA2D-A214-4381-ACF5-D57980097873}.Release|x86.ActiveCfg = Release|x86
{AE2AAA2D-A214-4381-ACF5-D57980097873}.Release|x86.Build.0 = Release|x86
{D6720242-70E4-4C62-95BE-AA11944AE0DE}.Debug|Any CPU.ActiveCfg = Debug|x64
{D6720242-70E4-4C62-95BE-AA11944AE0DE}.Debug|Any CPU.Build.0 = Debug|x64
{D6720242-70E4-4C62-95BE-AA11944AE0DE}.Debug|x64.ActiveCfg = Debug|x64
Expand Down Expand Up @@ -1077,7 +1091,8 @@ Global
{3A125210-A784-4982-ACDB-C3442E414E44} = {E409ADD3-9574-465C-AB09-4324D205CC7C}
{EDE168E0-DBCD-4DE3-B55A-4B633ED6565E} = {E409ADD3-9574-465C-AB09-4324D205CC7C}
{803A3DD1-016E-4713-8066-A1C81A6ADBA3} = {E409ADD3-9574-465C-AB09-4324D205CC7C}
{E04065C2-0512-41C6-A428-AC85342B3D03} = {E409ADD3-9574-465C-AB09-4324D205CC7C}
{A7551BDB-AD27-4E80-8B13-67C42F83554C} = {E409ADD3-9574-465C-AB09-4324D205CC7C}
{AE2AAA2D-A214-4381-ACF5-D57980097873} = {E409ADD3-9574-465C-AB09-4324D205CC7C}
{D6720242-70E4-4C62-95BE-AA11944AE0DE} = {E409ADD3-9574-465C-AB09-4324D205CC7C}
{3E53C72E-7711-4BD2-942C-4CEA895D2F98} = {E409ADD3-9574-465C-AB09-4324D205CC7C}
{C8DD1858-9C26-419F-9DE2-8E06F988EC66} = {E409ADD3-9574-465C-AB09-4324D205CC7C}
Expand Down
8 changes: 8 additions & 0 deletions build/LibraryVersions.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,5 +157,13 @@ public static class LibraryVersion
new("6.2.0"),
}
},
{
"TestApplication.Kafka",
new List<PackageBuildInfo>
{
new("1.4.0"),
new("2.3.0"),
}
},
};
}
3 changes: 2 additions & 1 deletion docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,14 @@ due to lack of stable semantic convention.
| `GRAPHQL` | [GraphQL](https://www.nuget.org/packages/GraphQL) **Not supported on .NET Framework** | ≥7.5.0 | source | [Experimental](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/versioning-and-stability.md) |
| `GRPCNETCLIENT` | [Grpc.Net.Client](https://www.nuget.org/packages/Grpc.Net.Client) | ≥2.52.0 & < 3.0.0 | source | [Experimental](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/versioning-and-stability.md) |
| `HTTPCLIENT` | [System.Net.Http.HttpClient](https://docs.microsoft.com/dotnet/api/system.net.http.httpclient) and [System.Net.HttpWebRequest](https://docs.microsoft.com/dotnet/api/system.net.httpwebrequest) | * | source | [Experimental](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/versioning-and-stability.md) |
| `QUARTZ` | [Quartz](https://www.nuget.org/packages/Quartz) **Not supported on .NET Framework 4.7.1 and older** | ≥3.4.0 | source | [Experimental](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/versioning-and-stability.md) |
| `KAFKA` | [Confluent.Kafka](https://www.nuget.org/packages/Confluent.Kafka) | ≥1.4.0 < 3.0.0 | bytecode | [Experimental](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/versioning-and-stability.md) |
| `MASSTRANSIT` | [MassTransit](https://www.nuget.org/packages/MassTransit) **Not supported on .NET Framework** | ≥8.0.0 | source | [Experimental](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/versioning-and-stability.md) |
| `MONGODB` | [MongoDB.Driver.Core](https://www.nuget.org/packages/MongoDB.Driver.Core) | ≥2.13.3 & < 3.0.0 | source & bytecode | [Experimental](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/versioning-and-stability.md) |
| `MYSQLCONNECTOR` | [MySqlConnector](https://www.nuget.org/packages/MySqlConnector) | ≥2.0.0 | source | [Experimental](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/versioning-and-stability.md) |
| `MYSQLDATA` | [MySql.Data](https://www.nuget.org/packages/MySql.Data) **Not supported on .NET Framework** | ≥8.1.0 | source | [Experimental](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/versioning-and-stability.md) |
| `NPGSQL` | [Npgsql](https://www.nuget.org/packages/Npgsql) | ≥6.0.0 | source | [Experimental](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/versioning-and-stability.md) |
| `NSERVICEBUS` | [NServiceBus](https://www.nuget.org/packages/NServiceBus) | ≥8.0.0 | source & bytecode | [Experimental](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/versioning-and-stability.md) |
| `QUARTZ` | [Quartz](https://www.nuget.org/packages/Quartz) **Not supported on .NET Framework 4.7.1 and older** | ≥3.4.0 | source | [Experimental](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/versioning-and-stability.md) |
| `SQLCLIENT` | [Microsoft.Data.SqlClient](https://www.nuget.org/packages/Microsoft.Data.SqlClient), [System.Data.SqlClient](https://www.nuget.org/packages/System.Data.SqlClient) and `System.Data` (shipped with .NET Framework) | * \[4\] | source | [Experimental](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/versioning-and-stability.md) |
| `STACKEXCHANGEREDIS` | [StackExchange.Redis](https://www.nuget.org/packages/StackExchange.Redis) **Not supported on .NET Framework** | ≥2.0.405 < 3.0.0 | source & bytecode | [Experimental](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/versioning-and-stability.md) |
| `WCFCLIENT` | WCF | * | source & bytecode | [Experimental](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/versioning-and-stability.md) |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
OpenTelemetry.AutoInstrumentation.CallTarget.CallTargetState.CallTargetState(System.Diagnostics.Activity? activity, object? state) -> void
OpenTelemetry.AutoInstrumentation.CallTarget.CallTargetState.CallTargetState(System.Diagnostics.Activity? activity, object? state, System.DateTimeOffset? startTime) -> void
OpenTelemetry.AutoInstrumentation.CallTarget.CallTargetState.StartTime.get -> System.DateTimeOffset?
OpenTelemetry.AutoInstrumentation.Instrumentations.Kafka.Integrations.ConsumerCloseIntegration
OpenTelemetry.AutoInstrumentation.Instrumentations.Kafka.Integrations.ConsumerConstructorIntegration
OpenTelemetry.AutoInstrumentation.Instrumentations.Kafka.Integrations.ConsumerConsumeSyncIntegration
OpenTelemetry.AutoInstrumentation.Instrumentations.Kafka.Integrations.ConsumerDisposeIntegration
OpenTelemetry.AutoInstrumentation.Instrumentations.Kafka.Integrations.ProducerDeliveryHandlerActionIntegration
OpenTelemetry.AutoInstrumentation.Instrumentations.Kafka.Integrations.ProducerProduceSyncIntegration
*REMOVED*OpenTelemetry.AutoInstrumentation.CallTarget.CallTargetState.CallTargetState(System.Diagnostics.Activity? activity, object! state) -> void
*REMOVED*OpenTelemetry.AutoInstrumentation.CallTarget.CallTargetState.CallTargetState(System.Diagnostics.Activity! activity, object! state, System.DateTimeOffset? startTime) -> void
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
OpenTelemetry.AutoInstrumentation.CallTarget.CallTargetState.CallTargetState(System.Diagnostics.Activity? activity, object? state) -> void
OpenTelemetry.AutoInstrumentation.CallTarget.CallTargetState.CallTargetState(System.Diagnostics.Activity? activity, object? state, System.DateTimeOffset? startTime) -> void
OpenTelemetry.AutoInstrumentation.CallTarget.CallTargetState.StartTime.get -> System.DateTimeOffset?
OpenTelemetry.AutoInstrumentation.Instrumentations.Kafka.Integrations.ConsumerCloseIntegration
OpenTelemetry.AutoInstrumentation.Instrumentations.Kafka.Integrations.ConsumerConstructorIntegration
OpenTelemetry.AutoInstrumentation.Instrumentations.Kafka.Integrations.ConsumerConsumeSyncIntegration
OpenTelemetry.AutoInstrumentation.Instrumentations.Kafka.Integrations.ConsumerDisposeIntegration
OpenTelemetry.AutoInstrumentation.Instrumentations.Kafka.Integrations.ProducerDeliveryHandlerActionIntegration
OpenTelemetry.AutoInstrumentation.Instrumentations.Kafka.Integrations.ProducerProduceSyncIntegration
*REMOVED*OpenTelemetry.AutoInstrumentation.CallTarget.CallTargetState.CallTargetState(System.Diagnostics.Activity? activity, object! state) -> void
*REMOVED*OpenTelemetry.AutoInstrumentation.CallTarget.CallTargetState.CallTargetState(System.Diagnostics.Activity! activity, object! state, System.DateTimeOffset? startTime) -> void
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public readonly struct CallTargetState
private readonly Activity? _previousActivity;
private readonly Activity? _activity;
private readonly object? _state;
private readonly DateTimeOffset? _startTime;

/// <summary>
/// Initializes a new instance of the <see cref="CallTargetState"/> struct.
Expand All @@ -37,18 +38,20 @@ public CallTargetState(Activity activity)
_previousActivity = null;
_activity = activity;
_state = null;
_startTime = null;
}

/// <summary>
/// Initializes a new instance of the <see cref="CallTargetState"/> struct.
/// </summary>
/// <param name="activity">Activity instance</param>
/// <param name="state">Object state instance</param>
public CallTargetState(Activity? activity, object state)
public CallTargetState(Activity? activity, object? state)
{
_previousActivity = null;
_activity = activity;
_state = state;
_startTime = null;
}

/// <summary>
Expand All @@ -57,18 +60,20 @@ public CallTargetState(Activity? activity, object state)
/// <param name="activity">Activity instance</param>
/// <param name="state">Object state instance</param>
/// <param name="startTime">The intended start time of the activity, intended for activities created in the OnMethodEnd handler</param>
public CallTargetState(Activity activity, object state, DateTimeOffset? startTime)
public CallTargetState(Activity? activity, object? state, DateTimeOffset? startTime)
{
_previousActivity = null;
_activity = activity;
_state = state;
_startTime = startTime;
}

internal CallTargetState(Activity? previousActivity, CallTargetState state)
{
_previousActivity = previousActivity;
_activity = state._activity;
_state = state._state;
_startTime = state.StartTime;
}

/// <summary>
Expand All @@ -81,6 +86,11 @@ internal CallTargetState(Activity? previousActivity, CallTargetState state)
/// </summary>
public object? State => _state;

/// <summary>
/// Gets the start time.
/// </summary>
public DateTimeOffset? StartTime => _startTime;

internal Activity? PreviousActivity => _previousActivity;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,9 @@ internal enum TracerInstrumentation
/// Elastic.Transport instrumentation.
/// </summary>
ElasticTransport = 19,

/// <summary>
/// Kafka client instrumentation
/// </summary>
Kafka = 20
}
Loading