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

Add support for event driven framework #1250

Open
lalitb opened this issue Mar 8, 2022 · 4 comments
Open

Add support for event driven framework #1250

lalitb opened this issue Mar 8, 2022 · 4 comments
Labels
do-not-stale good first issue Good for newcomers help wanted Good for taking. Extra help will be provided by maintainers

Comments

@lalitb
Copy link
Member

lalitb commented Mar 8, 2022

This would be eventually required for

  • To support async interface between span/log processor and exporters.
  • Async IO while exporting the spans.
  • Timers to poll for Spans in BatchSpanProcessor, and metrics in PeriodicMetricReader.
  • Asynchronously collect metrics for all the instruments across all the meters ( this would be a costly operation sequentially or even using threads).

References:

@github-actions
Copy link

github-actions bot commented May 8, 2022

This issue was marked as stale due to lack of activity. It will be closed in 7 days if no furthur activity occurs.

@github-actions github-actions bot added the Stale label May 8, 2022
@github-actions
Copy link

Closed as inactive. Feel free to reopen if this is still an issue.

@lalitb lalitb added do-not-stale and removed Stale labels May 15, 2022
@lalitb lalitb reopened this May 15, 2022
@owent
Copy link
Member

owent commented Jul 15, 2022

Note: This issue is simular to grpc/grpc#20194 of grpc

We should also support to share our event loop with grpc's in the future.

@lalitb lalitb added the help wanted Good for taking. Extra help will be provided by maintainers label Jul 15, 2022
@amirouche
Copy link

amirouche commented Sep 27, 2023

Quoting grpc/grpc#20194 (comment):

In order for an API to integrate into a foreign event loop, it needs to provide a polling interface as well as a callback function which can be used to signal a mutex condition to wake up, or activate an eventfd, or put an item on a kqueue, etc.

To develop on Zig's Andrew comment, nested quote above:

Say opentelemetry-cpp client (OTC) has its own whatnot event-loop, then to integrate that event-loop to a hosting application (APP) that has also an event-loop; OTC need to provide:

  1. a way to notify APP that OTC has io work to do 1
  2. a way to wake up OTC's event-loop for one iteration 2

That should work when there is a dedicated POSIX thread for OTC's whatnot event-loop running the exporter. It is also the best time-to-market way to make OTC work better with async apps.

There is more work if OTC's event-loop need to run in the same POSIX thread as APP's event-loop; and there is even more work if OTC need to re-use APP's event-loop. In the latter case, OTC requires something like an n+1 eventloop library ala hiredis, and libwebsockets adapters.

Next step is too choose what "integration" opentelemetry-cpp need:

  1. Dedicated POSIX thread => Choose an eventloop library;
  2. APP, and OTC have different eventloops in one POSIX thread => Choose an eventloop;
  3. APP, and OTC share the same eventloop;

At some point to achieve the "async dream" exporters will also need to be aware of OTC's event-loop; in the meantime, we call Exporter::ExportResult, and Exporter::ForceFlush in one-shot POSIX threads;

Footnotes

  1. it may be polling as an OTC function that is regularly called by APP; or nest epoll_create1 fd, or io_uring_setup fd;

  2. see libuv's UV_RUN_ONCE to actually do the io work;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-stale good first issue Good for newcomers help wanted Good for taking. Extra help will be provided by maintainers
Projects
None yet
Development

No branches or pull requests

3 participants