making OtlpLogExporter public#4979
Conversation
cijothomas
left a comment
There was a problem hiding this comment.
Looks good.
Please add a changelog entry as well.
Codecov Report
@@ Coverage Diff @@
## main #4979 +/- ##
==========================================
- Coverage 83.54% 83.39% -0.15%
==========================================
Files 295 295
Lines 12336 12336
==========================================
- Hits 10306 10288 -18
- Misses 2030 2048 +18
Flags with carried forward coverage won't be shown. Click here to find out more.
|
| /// the OpenTelemetry protocol (OTLP). | ||
| /// </summary> | ||
| internal sealed class OtlpLogExporter : BaseExporter<LogRecord> | ||
| public sealed class OtlpLogExporter : BaseExporter<LogRecord> |
There was a problem hiding this comment.
@CodeBlanch How do you feel about using a public sealed modifier instead of just public? All the other public classes are not marked sealed. Should we unmark sealed from this class as well?
There was a problem hiding this comment.
Probably fine to make it public. The reason to seal it would be to reserve the right to make changes to it in the future by preventing people from making more derived types. But just looking at the class, I don't see a strong need for that.
If we really wanted to make it nicely extensible we should consider the use cases. The class as it is probably isn't too useful for extension. Consider something like this...
public class OtlpLogExporter
{
public override ExportResult Export(in Batch<LogRecord> logRecordBatch)
{
// ...some logic omitted...
request.AddBatch(this.sdkLimitOptions, this.ProcessResource, activityBatch);
OnRequestSending(request); // Extension point
if (!this.exportClient.SendExportRequest(request))
{
return ExportResult.Failure;
}
// ...some logic omitted...
}
// Give a nice extension point for manipulating the request before it is sent
protected virtual void OnRequestSending(OtlpCollector.ExportLogsServiceRequest request) {}
}Not saying we need to do this, just food for thought 😄
There was a problem hiding this comment.
Could be a good addition in future when we sort out the OtlpCollector.ExportLogsServiceRequest dependency. Right now the types are not exposed.
Fixes #4971
Changes
Making OtlpLogExporter public.
Merge requirement checklist
CHANGELOG.mdfiles updated for non-trivial changes