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

Refactor exporter - step 2 #1081

Merged
merged 3 commits into from
Aug 14, 2020
Merged

Refactor exporter - step 2 #1081

merged 3 commits into from
Aug 14, 2020

Conversation

reyang
Copy link
Member

@reyang reyang commented Aug 14, 2020

This is a follow up PR of #1078.

Changes

  • Added SimpleExportActivityProcessor.
  • Added skeleton of BatchExportActivityProcessor.
  • The reason why these names are picked was covered in bullet point 6 of PR #1078.
  • Removed unused using statements.

For significant contributions please make sure you have completed the following items:

  • Design discussion issue #
  • Changes in public API reviewed

@reyang reyang requested a review from a team August 14, 2020 17:30
@codecov
Copy link

codecov bot commented Aug 14, 2020

Codecov Report

Merging #1081 into master will decrease coverage by 0.67%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1081      +/-   ##
==========================================
- Coverage   77.35%   76.68%   -0.68%     
==========================================
  Files         221      223       +2     
  Lines        6104     6158      +54     
==========================================
  Hits         4722     4722              
- Misses       1382     1436      +54     
Impacted Files Coverage Δ
...porter.Jaeger/Implementation/JaegerThriftClient.cs 100.00% <ø> (ø)
src/OpenTelemetry/Trace/ActivityExporterSync.cs 0.00% <ø> (ø)
...penTelemetry/Trace/BatchExportActivityProcessor.cs 0.00% <0.00%> (ø)
...enTelemetry/Trace/SimpleExportActivityProcessor.cs 0.00% <0.00%> (ø)

{
if (!this.stopped)
{
this.exporter.Shutdown();
Copy link
Member

Choose a reason for hiding this comment

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

No need for try/catch here?

Copy link
Member

Choose a reason for hiding this comment

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

@reyang I merged to unblock you, but probably need try/catch in a future PR?

Copy link
Member Author

Choose a reason for hiding this comment

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

I need to get feedback here.

The spec is saying that exporter should not throw.

I had similar struggle here, whether should I trust the other processors won't throw, or I should make the composite one bullet proof.

Copy link
Member Author

Choose a reason for hiding this comment

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

So the higher order question is, how much do we trust / rely on the other components (whether processors/exporters that we own / in this repo, or we don't own / in other repos) to follow the spec / be a good citizen.

Copy link
Member Author

@reyang reyang Aug 14, 2020

Choose a reason for hiding this comment

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

Here is my take while I was a C/C++ runtime library dev:

  1. If a developer calls free on a buffer (allocated by malloc) that is already freed, we want to fail him instead of keep silent. In this way we are actually helping that developer to discover his bug, instead of hiding it since his bug could potentially has other implications (e.g. data loss, corruption, logical flaw).
  2. If the heap manager observed any sign of an incorrect heap (e.g. via integrity check on sentry bytes), it should crash the app ASAP instead of trying to hide the mistake (since the app might run on dangling pointers which writes dirty data to a database/file).

However, here I'm struggling as I believe we have another design principle - a telemetry SDK, once initialized, should not punish the users by killing their applications.

Copy link
Member Author

@reyang reyang Aug 14, 2020

Choose a reason for hiding this comment

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

It is mainly from the responsibility and dev experience perspective (no perf concern here).

For example if some bad guy developed a broken exporter that throws (against the spec law) and we swallowed the exception for him, it seems like we are contributing to a crime instead of reporting to the cops.

And if a good guy is developing an exporter where he made subtle mistake, by throwing error directly we helped him to fix his bug. Otherwise he will have to look at the self diagnostic logs.

Anyways, I'm struggling here which means I don't have strong preference (and as you can see, I do have strong preference that we should catch Dispose exception and I put that catch statement 😄). So I'm happy to change either way (or even have a global flag to turn on/off such behavior) if @alanwest @CodeBlanch or anyone in the community has a strong preference.

Copy link
Member

Choose a reason for hiding this comment

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

As usual, @reyang raises good points! I'm good with letting it throw. But I will say this... that doesn't necessarily guarantee anyone will pay attention! I have seen a lot of code get to prod where ops immediately starts complaining things won't shut down. Launch the app in dev, it is easily reproducable. How does this get by the devs? Because they use the "stop" button in VS which doesn't perform graceful shutdown 🙄

Copy link
Member

Choose a reason for hiding this comment

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

Yes, definitely good points to ponder. I'm also good with letting it throw.

Though, I've generally thought of the telemetry SDK and other profiling tools as similar to logging frameworks where "do no harm" is often the general mantra. Usually (hopefully) there are other signs that something is awry - like a sudden drop of data reported to your backend, even though seemingly your app is still running "just fine".

This conversation is definitely bigger than just exporter or processors - these questions would apply to instrumentation among other things as well. It's more of general design philosophy, maybe more appropriate for a spec-level kind of guidance/adoption?

Copy link
Member Author

Choose a reason for hiding this comment

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

A slightly different story from the Nt vs. Zw API.

I think given that none of us have strong opinion, and it seems @alanwest @CodeBlanch both have/had the intuition that it is nicer to swallow exception, we probably should go with the direction (to swallow exceptions) for now and make sure we handle this consistently across the repo?

Copy link
Member Author

Choose a reason for hiding this comment

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

If I got two 👍 I'll send a PR to swallow the exception for both the exporting processor and composite processor.

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.

3 participants