-
Notifications
You must be signed in to change notification settings - Fork 773
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
[Do not Merge] [Otlp Exporter] Remove Google.Protobuf and Grpc.Net.Client dependency #5731
[Do not Merge] [Otlp Exporter] Remove Google.Protobuf and Grpc.Net.Client dependency #5731
Conversation
if (attributeCount < maxAttributeCount) | ||
{ | ||
/* | ||
// Alternate approach |
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.
@CodeBlanch - Could you take a look at this to see if it matches your expectation? I have not done the complete implementation yet, but can change if the direction looks good to you.
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Includes work from: |
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 think that it will require us to extend LICENCSE.md/create rd-party notice and include it into nuget package. It is required by Apache 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 actually already have one: https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/THIRD-PARTY-NOTICES.TXT
Both LICENSE.txt
and THIRD-PARTY-NOTICES.TXT
get included in the packages today. Ex: https://nuget.info/packages/OpenTelemetry.Exporter.OpenTelemetryProtocol/1.9.0
Directions look good to me. When you plan to create smaller PRs, consider adding detailed comments at the top of every method to help ease the review and later debugging process, as most of the methods perform calculations. |
} | ||
else | ||
{ | ||
if (!ActivityListPool.TryTake(out var newList)) |
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 such complex storage? I understand that we need to track a single ActivitySource.Name
for the instrumentation scope. Can we rely on Activity.Source
and a simple thing like isSeen
during the serialization process?
ref byte[] buffer, | ||
int cursor, | ||
int fieldNumber, | ||
ReadOnlySpan<char> value, |
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.
@vishweshbankwar I pushed an update so Writer
understands how to write a ReadOnlySpan<char>
to the buffer. Previously we called ToString
in TagWriter
which would have caused a lot of extra allocations. Also updated this so it calls into the code to grow the buffer if needed before writing instead of having two branches with one performing that check per-byte/char written. Should be much faster this way and I think simpler.
This PR was marked stale due to lack of activity and will be closed in 7 days. Commenting or Pushing will instruct the bot to automatically remove the label. This bot runs once per day. |
Closed as inactive. Feel free to reopen if this PR is still being worked on. |
if (isBrowser) | ||
{ | ||
detail += " If the gRPC call is cross domain then CORS must be correctly configured. Access-Control-Expose-Headers needs to include 'grpc-status' and 'grpc-message'."; | ||
} | ||
|
||
if (isWinHttp) | ||
{ | ||
detail += " Using gRPC with WinHttp has Windows and package version requirements. See https://aka.ms/aspnet/grpc/netstandard for details."; | ||
} |
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.
You don't need to worry about grpc-web or CORS.
Do you plan on supporting WinHttpHandler for .NET Framework support?
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 you plan on supporting WinHttpHandler for .NET Framework support?
No
// We do not need to return back response and deadline for successful response so using cached value. | ||
return SuccessExportResponse; | ||
} | ||
catch (Exception ex) |
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 whole catch block is a bit of a mess. Why not separate catch statements?
// https://github.com/grpc/grpc-dotnet/blob/1416340c85bb5925b5fed0c101e7e6de71e367e0/src/Grpc.Net.Client/Internal/GrpcCall.cs#L799-L803 | ||
// Utilizing the inner exception here to determine deadline exceeded related failures. | ||
// https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpclient.sendasync?view=net-8.0#remarks | ||
if (ex.InnerException is TimeoutException) |
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.
Using HttpClient.Timeout for deadline is probably ok. I assume you have global deadline duration that is applied to all requests so timetout works.
For Grpc.Net.Client, the deadline can differ per call.
var dataLength = contentLength - 5; | ||
BinaryPrimitives.WriteUInt32BigEndian(data, (uint)dataLength); | ||
|
||
// TODO: Support compression. |
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 you ever send compressed gRPC request data today? If you don't, then it's not needed.
You probably need to handle compressed responses. There might be an OTLP gRPC server that sends a compressed response for some reason.
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.
My understanding is users can specify grpc-encoding
header which will result in compressed payload to be transmitted.
// grpc-dotnet calls specifies the HttpCompletion.ResponseHeadersRead. | ||
// However, it is useful specifically for streaming calls? | ||
// https://github.com/grpc/grpc-dotnet/blob/1416340c85bb5925b5fed0c101e7e6de71e367e0/src/Grpc.Net.Client/Internal/GrpcCall.cs#L485-L486 | ||
return this.HttpClient.SendAsync(request, cancellationToken).GetAwaiter().GetResult(); |
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 is blocking so you need to worry about thread pool starvation. Are OTLP gRPC calls made on a dedicated thread? If so, that means a maximum of one thread is blocked and this isn't a bad.
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.
Are OTLP gRPC calls made on a dedicated thread
Yes. (but there will be 3 such threads created by traces,logs,metrics)
public static readonly string ResponseTrailersKey = "__ResponseTrailers"; | ||
|
||
public static HttpHeaders TrailingHeaders(this HttpResponseMessage responseMessage) | ||
{ | ||
#if !NETSTANDARD2_0 && !NET462 | ||
return responseMessage.TrailingHeaders; | ||
#else | ||
if (responseMessage.RequestMessage.Properties.TryGetValue(ResponseTrailersKey, out var headers) && | ||
headers is HttpHeaders httpHeaders) | ||
{ | ||
return httpHeaders; | ||
} | ||
|
||
// App targets .NET Standard 2.0 and the handler hasn't set trailers | ||
// in RequestMessage.Properties with known key. Return empty collection. | ||
// Client call will likely fail because it is unable to get a grpc-status. | ||
return ResponseTrailers.Empty; | ||
#endif | ||
} |
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 you plan to support .NET Framework with WinHttpHandler? If not, then this can be simplified to always return TrailingHeaders.
This PR was marked stale due to lack of activity and will be closed in 7 days. Commenting or Pushing will instruct the bot to automatically remove the label. This bot runs once per day. |
Closed as inactive. Feel free to reopen if this PR is still being worked on. |
Towards #5730 #5450
Changes
OTEL_DOTNET_EXPERIMENTAL_USE_CUSTOM_PROTOBUF_SERIALIZER
for now.Note: This is a proof of concept PR to collect the initial feedback and is not intended to be merged. Smaller follow-up PRs will be done once the approach is finalized.
Merge requirement checklist
CHANGELOG.md
files updated for non-trivial changes