opentelemetry-dotnet icon indicating copy to clipboard operation
opentelemetry-dotnet copied to clipboard

[sdk] Provide better concurrency modes

Open reyang opened this issue 1 year ago • 1 comments

This is following the same design as push/pull metrics exporter: https://github.com/open-telemetry/opentelemetry-dotnet/blob/3cff6dbfd15ed0b539c289a4444198fe437a5ebf/src/OpenTelemetry/Metrics/ExportModesAttribute.cs#L9-L10

Exporter (also processors, samplers, etc.) authors can optionally provide additional hints so the SDK can better serve the need:

[ConcurrencyModes(ConcurrencyModes.Multithreaded | ConcurrencyModes.Reentrant)]
internal class MyExporter : BaseExporter<LogRecord>
{
    ...
}

In addition, I envision that Console Exporters can leverage this to provide synchronization across multiple instances, so a log exporter and metrics exporter won't have race condition and cause garbled text in stdout:

[ConcurrencyModes(ConcurrencyModes.Global)]
internal class ConsoleExporter<T> : BaseExporter<T>
{
    ...
}

reyang avatar May 22 '24 01:05 reyang

Codecov Report

Attention: Patch coverage is 66.66667% with 7 lines in your changes missing coverage. Please review.

Project coverage is 85.67%. Comparing base (6250307) to head (c5b6dd1). Report is 259 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5643      +/-   ##
==========================================
+ Coverage   83.38%   85.67%   +2.29%     
==========================================
  Files         297      255      -42     
  Lines       12531    11051    -1480     
==========================================
- Hits        10449     9468     -981     
+ Misses       2082     1583     -499     
Flag Coverage Δ
unittests ?
unittests-Project-Experimental 85.62% <66.66%> (?)
unittests-Project-Stable 85.60% <66.66%> (?)

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

Files Coverage Δ
src/OpenTelemetry/SimpleExportProcessor.cs 85.71% <82.35%> (-14.29%) :arrow_down:
src/OpenTelemetry/ConcurrencyModesAttribute.cs 0.00% <0.00%> (ø)

... and 114 files with indirect coverage changes

codecov[bot] avatar May 22 '24 01:05 codecov[bot]

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.

github-actions[bot] avatar Jun 05 '24 03:06 github-actions[bot]

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.

github-actions[bot] avatar Jun 14 '24 03:06 github-actions[bot]

Closed as inactive. Feel free to reopen if this PR is still being worked on.

github-actions[bot] avatar Jun 21 '24 03:06 github-actions[bot]

@reyang @CodeBlanch - I see this got closed due to inactivity. Do we have a plan for removing the private reflection in the GenevaExporter?

eerhardt avatar Jun 21 '24 17:06 eerhardt

@reyang @CodeBlanch - I see this got closed due to inactivity. Do we have a plan for removing the private reflection in the GenevaExporter?

@CodeBlanch would you follow up?

reyang avatar Jun 21 '24 17:06 reyang

@eerhardt Still working on the plan. I've been exploring some other possible APIs/alternatives. Hoping to have something to propose soon and then we'll pick a direction to have in place for the next release.

CodeBlanch avatar Jun 21 '24 18:06 CodeBlanch