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

sdk/trace: fix grammar errors #4996

Merged
merged 4 commits into from
Mar 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 19 additions & 18 deletions sdk/trace/simple_span_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ var _ SpanProcessor = (*simpleSpanProcessor)(nil)
// send completed spans to the exporter immediately.
//
// This SpanProcessor is not recommended for production use. The synchronous
// nature of this SpanProcessor make it good for testing, debugging, or
// showing examples of other feature, but it will be slow and have a high
// computation resource usage overhead. The BatchSpanProcessor is recommended
// for production use instead.
// nature of this SpanProcessor makes it good for testing, debugging, or showing
// examples of other features, but it will be slow and have a high computation
// resource usage overhead. The BatchSpanProcessor is recommended for production
// use instead.
func NewSimpleSpanProcessor(exporter SpanExporter) SpanProcessor {
ssp := &simpleSpanProcessor{
exporter: exporter,
Expand Down Expand Up @@ -69,10 +69,10 @@ func (ssp *simpleSpanProcessor) Shutdown(ctx context.Context) error {
//
// A closure is used to keep reference to the exporter and then the
// field is zeroed. This ensures the simpleSpanProcessor is shut down
// before the exporter. This order is important as it avoids a
// potential deadlock. If the exporter shut down operation generates a
// span, that span would need to be exported. Meaning, OnEnd would be
// called and try acquiring the lock that is held here.
// before the exporter. This order is important as it avoids a potential
// deadlock. If the exporter shut down operation generates a span, that
// span would need to be exported. Meaning, OnEnd would be called and
// try acquiring the lock that is held here.
ssp.exporterMu.Lock()
done, shutdown := stopFunc(ssp.exporter)
ssp.exporter = nil
Expand All @@ -84,15 +84,15 @@ func (ssp *simpleSpanProcessor) Shutdown(ctx context.Context) error {
select {
case err = <-done:
case <-ctx.Done():
// It is possible for the exporter to have immediately shut down
// and the context to be done simultaneously. In that case this
// outer select statement will randomly choose a case. This will
// result in a different returned error for similar scenarios.
// Instead, double check if the exporter shut down at the same
// time and return that error if so. This will ensure consistency
// as well as ensure the caller knows the exporter shut down
// successfully (they can already determine if the deadline is
// expired given they passed the context).
// It is possible for the exporter to have immediately shut down and
// the context to be done simultaneously. In that case this outer
// select statement will randomly choose a case. This will result in
// a different returned error for similar scenarios. Instead, double
// check if the exporter shut down at the same time and return that
// error if so. This will ensure consistency as well as ensure
// the caller knows the exporter shut down successfully (they can
// already determine if the deadline is expired given they passed
// the context).
select {
case err = <-done:
default:
Expand All @@ -108,7 +108,8 @@ func (ssp *simpleSpanProcessor) ForceFlush(context.Context) error {
return nil
}

// MarshalLog is the marshaling function used by the logging system to represent this Span Processor.
// MarshalLog is the marshaling function used by the logging system to represent
// this Span Processor.
func (ssp *simpleSpanProcessor) MarshalLog() interface{} {
return struct {
Type string
Expand Down