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

Conversation

juliuskoval
Copy link
Contributor

@juliuskoval juliuskoval commented Oct 23, 2023

Fixes #4971

Changes

Making OtlpLogExporter public.

Merge requirement checklist

  • CONTRIBUTING guidelines followed (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)

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Oct 23, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

@juliuskoval juliuskoval marked this pull request as ready for review October 23, 2023 07:35
@juliuskoval juliuskoval requested a review from a team October 23, 2023 07:35
@juliuskoval juliuskoval changed the title making OtlpExporter public making OtlpLogExporter public Oct 23, 2023
Copy link
Member

@cijothomas cijothomas left a comment

Choose a reason for hiding this comment

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

Looks good.
Please add a changelog entry as well.

@codecov
Copy link

codecov bot commented Oct 23, 2023

Codecov Report

Merging #4979 (04961fd) into main (637ddcf) will decrease coverage by 0.15%.
The diff coverage is n/a.

❗ Current head 04961fd differs from pull request most recent head 8dad02c. Consider uploading reports for the commit 8dad02c to get more accurate results

Impacted file tree graph

@@            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     
Flag Coverage Δ
unittests 83.39% <ø> (-0.15%) ⬇️

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

Files Coverage Δ
....Exporter.OpenTelemetryProtocol/OtlpLogExporter.cs 100.00% <ø> (ø)

... and 4 files with indirect coverage changes

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

@utpilla utpilla merged commit c0a5577 into open-telemetry:main Oct 25, 2023
66 of 67 checks passed
@juliuskoval juliuskoval deleted the otlpLogExporterPublic branch January 29, 2024 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make OtlpLogExporter public
5 participants