Skip to content

Conversation

RassK
Copy link
Contributor

@RassK RassK commented Jul 18, 2025

Changes

Adds support for plain http transport (send & receive).

Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files updated for non-trivial changes
  • Changes in public API reviewed (if applicable)

@RassK RassK requested a review from a team as a code owner July 18, 2025 12:47
@github-actions github-actions bot added the comp:opamp.client Things related to OpenTelemetry.OpAmp.Client label Jul 18, 2025
@RassK RassK changed the title [OpAmp.Client] Add support for plain http transport [OpAMP.Client] Add support for plain http transport Jul 18, 2025
import "anyvalue.proto";

option go_package = "github.com/open-telemetry/opamp-go/protobufs";
option csharp_namespace = "OpAmp.Protocol";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still under review open-telemetry/opamp-spec#243

Copy link

codecov bot commented Jul 18, 2025

Codecov Report

❌ Patch coverage is 61.08108% with 72 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.58%. Comparing base (d97922c) to head (54d57a8).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/OpenTelemetry.OpAmp.Client/OpAmpClient.cs 0.00% 12 Missing ⚠️
src/OpenTelemetry.OpAmp.Client/FrameProcessor.cs 82.00% 9 Missing ⚠️
src/OpenTelemetry.OpAmp.Client/FrameDispatcher.cs 75.00% 6 Missing ⚠️
...t/Listeners/Messages/AgentIdentificationMessage.cs 0.00% 4 Missing ⚠️
...p.Client/Listeners/Messages/CapabilitiesMessage.cs 0.00% 4 Missing ⚠️
....OpAmp.Client/Listeners/Messages/CommandMessage.cs 0.00% 4 Missing ⚠️
...nt/Listeners/Messages/ConnectionSettingsMessage.cs 0.00% 4 Missing ⚠️
...nt/Listeners/Messages/CustomCapabilitiesMessage.cs 0.00% 4 Missing ⚠️
....Client/Listeners/Messages/ErrorResponseMessage.cs 0.00% 4 Missing ⚠️
...ry.OpAmp.Client/Listeners/Messages/FlagsMessage.cs 0.00% 4 Missing ⚠️
... and 6 more
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2926      +/-   ##
==========================================
- Coverage   69.79%   69.58%   -0.22%     
==========================================
  Files         396      413      +17     
  Lines       15992    16177     +185     
==========================================
+ Hits        11161    11256      +95     
- Misses       4831     4921      +90     
Flag Coverage Δ
unittests-Contrib.Shared.Tests 86.25% <ø> (ø)
unittests-Exporter.Geneva 53.33% <ø> (-0.34%) ⬇️
unittests-Exporter.InfluxDB 95.14% <ø> (ø)
unittests-Exporter.Instana 74.86% <ø> (ø)
unittests-Exporter.OneCollector 94.61% <ø> (ø)
unittests-Extensions 90.65% <ø> (ø)
unittests-Extensions.Enrichment 100.00% <ø> (ø)
unittests-Instrumentation.AWS 83.69% <ø> (ø)
unittests-Instrumentation.AspNet 74.93% <ø> (ø)
unittests-Instrumentation.AspNetCore 70.32% <ø> (ø)
unittests-Instrumentation.Cassandra 23.52% <ø> (ø)
unittests-Instrumentation.ConfluentKafka 14.10% <ø> (ø)
unittests-Instrumentation.ElasticsearchClient 80.12% <ø> (ø)
unittests-Instrumentation.EntityFrameworkCore 78.63% <ø> (ø)
unittests-Instrumentation.EventCounters 76.36% <ø> (ø)
unittests-Instrumentation.GrpcCore 91.42% <ø> (ø)
unittests-Instrumentation.GrpcNetClient 79.61% <ø> (ø)
unittests-Instrumentation.Hangfire 84.61% <ø> (ø)
unittests-Instrumentation.Http 74.09% <ø> (ø)
unittests-Instrumentation.Owin 88.62% <ø> (ø)
unittests-Instrumentation.Process 100.00% <ø> (ø)
unittests-Instrumentation.Quartz 78.76% <ø> (ø)
unittests-Instrumentation.Runtime 100.00% <ø> (ø)
unittests-Instrumentation.ServiceFabricRemoting 34.54% <ø> (ø)
unittests-Instrumentation.SqlClient 88.50% <ø> (ø)
unittests-Instrumentation.StackExchangeRedis 70.81% <ø> (ø)
unittests-Instrumentation.Wcf 78.95% <ø> (ø)
unittests-OpAmp.Client 61.08% <61.08%> (?)
unittests-PersistentStorage 65.55% <ø> (-0.34%) ⬇️
unittests-Resources.AWS 75.00% <ø> (ø)
unittests-Resources.Azure 84.56% <ø> (ø)
unittests-Resources.Container 67.34% <ø> (ø)
unittests-Resources.Gcp 71.42% <ø> (ø)
unittests-Resources.Host 73.91% <ø> (ø)
unittests-Resources.OperatingSystem 76.98% <ø> (ø)
unittests-Resources.Process 100.00% <ø> (ø)
unittests-Resources.ProcessRuntime 79.59% <ø> (ø)
unittests-Sampler.AWS 88.25% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
....Client/Listeners/Messages/CustomMessageMessage.cs 100.00% <100.00%> (ø)
.../OpenTelemetry.OpAmp.Client/OpAmpClientSettings.cs 80.00% <80.00%> (ø)
...OpenTelemetry.OpAmp.Client/Utils/SequenceHelper.cs 66.66% <66.66%> (ø)
src/OpenTelemetry.OpAmp.Client/FrameBuilder.cs 85.00% <85.00%> (ø)
...t/Listeners/Messages/AgentIdentificationMessage.cs 0.00% <0.00%> (ø)
...p.Client/Listeners/Messages/CapabilitiesMessage.cs 0.00% <0.00%> (ø)
....OpAmp.Client/Listeners/Messages/CommandMessage.cs 0.00% <0.00%> (ø)
...nt/Listeners/Messages/ConnectionSettingsMessage.cs 0.00% <0.00%> (ø)
...nt/Listeners/Messages/CustomCapabilitiesMessage.cs 0.00% <0.00%> (ø)
....Client/Listeners/Messages/ErrorResponseMessage.cs 0.00% <0.00%> (ø)
... and 7 more

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

`OpenTelemetry.OpAmp.Client`
project.
* Initial release of `OpenTelemetry.OpAmp.Client` project.
* Added support for OpAMP Plain Http transport.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also needs a link to this PR.

Suggested change
* Added support for OpAMP Plain Http transport.
* Added support for OpAMP Plain HTTP transport.


namespace OpenTelemetry.OpAmp.Client;

internal class FrameBuilder : IFrameBuilder
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless there's inheritance happening, internal classes can be sealed as this can help the JIT create better code.

/// <remarks>This enumeration defines the available transport protocols for communication. Use <see
/// cref="WebSocket"/> for WebSocket-based communication, or <see cref="Http"/> for
/// HTTP-based communication.</remarks>
#pragma warning disable SA1201 // Elements should appear in the correct order
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix rather than suppress?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was mistakenly looking that SA1201 doesn't like it either way, basically prohibits multiple classes in the same file, but didn't want to extract it (yet, or at least not into root).

<!-- .NET Framework supporting packages -->
<ItemGroup Condition="'$(TargetFramework)' == '$(NetFrameworkMinimumSupportedVersion)'">
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="System.Collections.Immutable" Version="9.0.7" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering open-telemetry/opentelemetry-dotnet#6327, I suggest starting with the lowest version possible (e.g. 8.0.0).

Comment on lines 49 to 52
if (!response.IsSuccessStatusCode)
{
throw new HttpRequestException($"Failed to send message: {response.ReasonPhrase}");
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just use EnsureSuccessStatusCode()?

Comment on lines +65 to +69
public void Dispose()
{
this.httpClient?.Dispose();
this.handler?.Dispose();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The HttpClient should be able to be constructed so that it can be told to dispose of the handler itself, then this instance doesn't need to do that or keep a reference to it.

Copy link
Contributor Author

@RassK RassK Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then you need to suppress CA2000 manually. disposeHandler is there but static analysis does not pass.

@github-actions github-actions bot added the infra Infra work - CI/CD, code coverage, linters label Jul 18, 2025
@RassK
Copy link
Contributor Author

RassK commented Jul 18, 2025

FYI: PTO 🌴, Will be back in 4th of August. Feel free to push changes and merge if critical stuff got resolved.

(you can find context in #2872 if there is something looking very weird, there is kind of a big picture)

Copy link
Contributor

github-actions bot commented Aug 2, 2025

This PR was marked stale due to lack of activity. It will be closed in 7 days.

@github-actions github-actions bot added the Stale label Aug 2, 2025
@RassK
Copy link
Contributor Author

RassK commented Aug 4, 2025

Q: are you tracking aot incompatible libs somewhere? - seems protobuf is not compatible, therefore opamp also.

@martincostello
Copy link
Member

There's an issue in Google.Protobuf that broke some native AoT compatibility that I'm aware of: protocolbuffers/protobuf#21824

@github-actions github-actions bot removed the Stale label Aug 5, 2025
@RassK
Copy link
Contributor Author

RassK commented Aug 18, 2025

@martincostello do you see anything else that requires attention, since we wait for spec to commit changes.

/// <remarks>This enumeration defines the available transport protocols for communication. Use <see
/// cref="WebSocket"/> for WebSocket-based communication, or <see cref="Http"/> for
/// HTTP-based communication.</remarks>
internal enum ConnectionType
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be in its own file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where would you put it? ... I did not like root.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would put it in ConnectionType.cs in the root, as otherwise I think the analyzers would complain about the style (having more than one type defined in the same file).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So far no errors like in #2926 (comment)

In the PoC branch I added them to Settings (since the subs would bloat root).
Those will become public and after that are not movable (not without creating a mess in namespaces).-
So need to get that internal / public boundary right.

Copy link
Member

@Kielek Kielek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I will merge as is. It is good groundwork for further changes. I would like to avoid any more huge PRs.

Changes related to the proto namespace can be easily fixed later.


<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.31.1" />
<PackageReference Include="Grpc.Tools" Version="2.72.0">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note: It will not work on ARM, if anybody decide to compile on this machine.

grpc/grpc#38538


<PropertyGroup>
<TargetFrameworks>$(NetMinimumSupportedVersion);$(NetStandardMinimumSupportedVersion);$(NetFrameworkMinimumSupportedVersion)</TargetFrameworks>
<TargetFrameworks>net9.0;$(NetMinimumSupportedVersion);$(NetStandardMinimumSupportedVersion);$(NetFrameworkMinimumSupportedVersion)</TargetFrameworks>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for myself, uid should be generated based on Guid.V7. It is available on .NET9+.

@Kielek Kielek merged commit da244a5 into open-telemetry:main Aug 19, 2025
223 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp:opamp.client Things related to OpenTelemetry.OpAmp.Client infra Infra work - CI/CD, code coverage, linters

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants