Skip to content
This repository has been archived by the owner on Oct 27, 2022. It is now read-only.

Trace exporter implemetation #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jiren
Copy link

@jiren jiren commented Apr 1, 2019

No description provided.

lib/opencensus/trace/exporters/converter.rb Outdated Show resolved Hide resolved
lib/opencensus/trace/exporters/ocagent.rb Outdated Show resolved Hide resolved
lib/opencensus/trace/exporters/ocagent.rb Outdated Show resolved Hide resolved
lib/opencensus/trace/exporters/sampler.rb Outdated Show resolved Hide resolved
lib/opencensus/trace/exporters/trace_enumerator_queue.rb Outdated Show resolved Hide resolved
lib/opencensus/trace/exporters/ocagent.rb Outdated Show resolved Hide resolved
rescue StandardError => err
warn "Unable to export to OCAgent service: #{err.class} #{err}"
ensure
Thread.pass
Copy link
Member

Choose a reason for hiding this comment

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

Why is this needed?

Copy link
Author

Choose a reason for hiding this comment

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

I have added rescue block just for logging purpose, issues like not able to established connection to agent service

Copy link
Author

Choose a reason for hiding this comment

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

ensure block to pass immediate execution if other threads running in process.


# Run exporter stream.
def background_export_run
client.export(@trace_req_queue.each_item).each {}
Copy link
Member

Choose a reason for hiding this comment

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

Why do you need to call .each{} on the result?

Copy link
Author

Choose a reason for hiding this comment

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

export is bidirectional grpc call which need to be kept alive for the entire life of process and export returning Enumerator instance with empty objects.

# Stop the trace export stream.
def stop
@stopped = true
@trace_req_queue&.push TraceEnumeratorQueue::SENTINEL
Copy link
Member

Choose a reason for hiding this comment

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

What happens when background_export_run reaches the sentinel?

Copy link
Author

Choose a reason for hiding this comment

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

When it reached the sentinel, it will break the export grpc bidirectional call and export thread execution will complete

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants