-
Notifications
You must be signed in to change notification settings - Fork 543
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
Add OTEL messaging semantic conventions to Kafka integration #5765
Conversation
@mitchdenny Could you add this package https://www.nuget.org/packages/OpenTelemetry.Instrumentation.ConfluentKafka/0.1.0-alpha.2 ? |
Its importing now. |
/azp run |
Commenter does not have sufficient privileges for PR 5765 in repo dotnet/aspire |
10cb4cb
to
d19b556
Compare
@davidfowl / @eerhardt We now have 2 metrics sources. Should we still emit both ? Should we add an AppContext.Switch ? |
I think we should start deprecating the existing one. Either removing it entirely now, or putting it behind an AppContext switch first, and then remove it later. |
Can you update aspire/src/Components/Telemetry.md Lines 88 to 105 in 62f8cf7
|
Directory.Packages.props
Outdated
@@ -139,6 +139,7 @@ | |||
<PackageVersion Include="OpenTelemetry.Instrumentation.Http" Version="1.9.0" /> | |||
<PackageVersion Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.9.0" /> | |||
<PackageVersion Include="OpenTelemetry.Instrumentation.Runtime" Version="1.9.0" /> | |||
<PackageVersion Include="OpenTelemetry.Instrumentation.ConfluentKafka" Version="0.1.0-alpha.2" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the plan for shipping this library stable? We won't be able to ship Aspire.Confluent.Kafka
stable again until this package goes stable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/open-telemetry/semantic-conventions/blob/main/docs/messaging/messaging-spans.md and https://github.com/open-telemetry/semantic-conventions/blob/main/docs/messaging/messaging-metrics.md needs to be stable first. Than we can think about making this package stable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming that isn't going to happen this calendar year, is that correct?
If that is the case, maybe we need to think about "vendoring" this code and compiling it into the Aspire.Confluent.Kafka library like we do with SqlServer and Redis here:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we're going to need to copy the implementation @eerhardt ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not found any ETA for this. My feeling is more likely - early next year.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we're going to need to copy the implementation @eerhardt ?
If we want to continue shipping "stable" versions of the Kafka client integration library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aspire.Component.Kafka is a bit more than 10k dl while Aspire.Hosting.Kafka is 7-8k. Aspire.Hosting.AppHost is 400-500k.
Can you add some tests? |
@g7ed6e we're marching towards the date for Aspire 9 shutdown, are you interested in having this support land in 9? (I ask because I think this is a high value change for 9) |
@davidfowl Yes that would be great. I will try to copy/paste the code from the otel repo this week so we can drop the dependency to the alpha otel package. |
ace513b
to
f9df469
Compare
done |
done. |
f9df469
to
ae1f616
Compare
[ModuleInitializer] | ||
public static void Initialize() | ||
{ | ||
AppContext.SetSwitch("EnableAspire8ConfluentKafkaMetrics", true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can do this in the runtimeconfig instead. See
aspire/playground/Directory.Build.props
Lines 21 to 25 in 72fe8bd
<!-- Enable Azure ActivitySources so Azure Components participate in tracing. --> | |
<ItemGroup> | |
<RuntimeHostConfigurationOption Include="Azure.Experimental.EnableActivitySource" | |
Value="true" /> | |
</ItemGroup> |
for an example how to do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -0,0 +1,16 @@ | |||
// Licensed to the .NET Foundation under one or more agreements. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this file isn't removed, it should have a decent name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it contains a ModuleInitializer that set the AppContext switch. How would you name it ? Program.cs ?
@@ -0,0 +1,16 @@ | |||
// Licensed to the .NET Foundation under one or more agreements. | |||
// The .NET Foundation licenses this file to you under the MIT license. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to add real tests here. Verify traces are working.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eerhardt These tests would require a Kafka container running (this is how I wrote the tests in the OTEL repo). Is this what you would like to see here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hum I did not noticed yet we were pulling TestContainers. Let's write integration tests :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eerhardt / @mitchdenny TestContainers.Kafka
default image is confluentinc/cp-kafka:6.1.9 can you please:
- add
confluentinc/cp-kafka:6.1.9
to netaspireci.azurecr.io - add
TestContainers.Kafka
3.10.0 to the nuget feed
edit: using the default TestContainers.Kafka default image will ease further maintenance of the UT.
@davidfowl I updated the PR with integration tests similar to those present in otel repo, i hope we are still able to make this land for .NET9. CI is failing but should work once:
edit: /cc @mitchdenny / @eerhardt |
082e123
to
5e8ea6c
Compare
Testcontainers package should be in there in a few moments. I'm working on getting my access sorted for the container image. |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
We shouldn't be using this container for tests. Instead we should use the Kafka container we reference in our Hosting package - aspire/src/Aspire.Hosting.Kafka/KafkaContainerImageTags.cs Lines 12 to 15 in 4e7e0de
You can override the TestContainer's image like the following: aspire/tests/Aspire.RabbitMQ.Client.Tests/RabbitMQContainerFixture.cs Lines 34 to 38 in 4e7e0de
|
@eerhardt
One thought: As the aim of these tests is to validate that the kafka clients behave correctly we could rely on whatever Kafka implementation and should not rely on the actual kafka server version. I mean that the aspire kafka integration should be compatible with others implementation like RedPanda for which a TestContainer.RedPanda NuGet package is published too. Update: @eerhardt what do you think about not relying to a specific kafka version ? |
0350894
to
d025618
Compare
@eerhardt I've updated the PR adding a specific KafkaContainerBuilder for the requirements of the |
f0239c7
to
5b2218f
Compare
5b2218f
to
b1748b2
Compare
b1748b2
to
b283275
Compare
Hi @mitchdenny it looks like TestContainers.Kafka 4.0.0 package is missing in the feed. Could you please add it ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay @g7ed6e. This is looking really good. I just have a few comments. Once those are addressed I think we should be able to merge this.
I have added Testcontainers.Kafka
4.0.0 to our nuget mirror so CI should be unblocked.
{ | ||
return base.Init() | ||
.WithImage(KafkaImage) | ||
.WithPortBinding(KafkaPort, true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to copy all this from test containers? Can't we just override the Image like we do elsewhere?
aspire/tests/Aspire.RabbitMQ.Client.Tests/RabbitMQContainerFixture.cs
Lines 36 to 37 in 3991282
var container = new RabbitMqBuilder() | |
.WithImage($"{ComponentTestConstants.AspireTestContainerRegistry}/{RabbitMQContainerImageTags.Image}:{RabbitMQContainerImageTags.Tag}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No we can't, that's why i first used the kafka 6.x images.
Please notice that client side packages should not be bound to a specific version of kafka. Confluent.Kafka producer and consumer can be used with other queue system that support the kafka protocol like redpanda or Azure Event Hub. Thus unit tests should not be tied to a specific service provider.
Add a specific KafkaContainerBuilder matching confluentinc/confluent-local:7.7.1 requirements Update tests/Aspire.Confluent.Kafka.Tests/MeterProviderExtensions.cs Co-authored-by: Eric Erhardt <[email protected]> Update ConfigurationSchema.json Update src/Vendoring/README.md Co-authored-by: Eric Erhardt <[email protected]> Use constants
3077e79
to
b0d74c3
Compare
@eerhardt Thanks. CI is all green now. I updated the PR according to your comments and rebased main branch. |
@eerhardt may i ask a review ? |
Yep. Sorry was lost after coming back from the holidays. Looking now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! Thanks for the great work and contribution here.
I just had one nit to follow coding conventions (use a property when used outside of the class). But I think this can be merged.
Since the PR validation hasn't run in a while, we should re-run with the current code just to make sure everything is still green.
@lmolkova wheh you have some time can you look |
Description
Add OTEL messaging semantic conventions to
Aspire.ConfluentKafka
component/integration.Fixes # (issue)
Checklist
<remarks />
and<code />
elements on your triple slash comments?Microsoft Reviewers: Open in CodeFlow