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

making OtlpLogExporter public #4979

Merged
merged 4 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
OpenTelemetry.Exporter.OtlpLogExporter
OpenTelemetry.Exporter.OtlpLogExporter.OtlpLogExporter(OpenTelemetry.Exporter.OtlpExporterOptions options) -> void
override OpenTelemetry.Exporter.OtlpLogExporter.Export(in OpenTelemetry.Batch<OpenTelemetry.Logs.LogRecord> logRecordBatch) -> OpenTelemetry.ExportResult
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

* Made `OpenTelemetry.Exporter.OtlpLogExporter` public. ([#4979](https://github.com/open-telemetry/opentelemetry-dotnet/pull/4979))

## 1.7.0-alpha.1

Released 2023-Oct-16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace OpenTelemetry.Exporter;
/// Exporter consuming <see cref="LogRecord"/> and exporting the data using
/// the OpenTelemetry protocol (OTLP).
/// </summary>
internal sealed class OtlpLogExporter : BaseExporter<LogRecord>
public sealed class OtlpLogExporter : BaseExporter<LogRecord>
Copy link
Contributor

Choose a reason for hiding this comment

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

@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?

Copy link
Member

Choose a reason for hiding this comment

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

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 😄

Copy link
Member

Choose a reason for hiding this comment

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

Could be a good addition in future when we sort out the OtlpCollector.ExportLogsServiceRequest dependency. Right now the types are not exposed.

{
private readonly IExportClient<OtlpCollector.ExportLogsServiceRequest> exportClient;
private readonly OtlpLogRecordTransformer otlpLogRecordTransformer;
Expand Down