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

exporter(stackdriver): fix ExportSpans when ctx is not nil #294

Merged
merged 7 commits into from
Nov 14, 2019

Conversation

clsung
Copy link
Contributor

@clsung clsung commented Nov 6, 2019

  • problem: if ctx is not, calling cancel() will panic
  • nil Context already handled in newContextWithTimeout
  • add with test

if ctx == nil {
ctx, cancel = newContextWithTimeout(e.o.Context, e.o.Timeout)
}
ctx, cancel = newContextWithTimeout(ctx, e.o.Timeout)
Copy link
Contributor

Choose a reason for hiding this comment

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

There are ctx == nil checks all over this code, could you clarify the intention? Testing for a nil context anywhere has a funny smell. I would like to see all the nil context checks removed.

Also, should you add a test for the case where context reaches the timeout and is canceled?

Copy link
Contributor Author

@clsung clsung Nov 7, 2019

Choose a reason for hiding this comment

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

I think as long as ctx is not nil, the cancel() will always be nil. However for batch processing we need a timeout function hence we need a ctx with timeout. I'll check it with timeout tests.

@lizthegrey
Copy link
Member

Paging @ymotongpoo for review (p.s. we should add him to CODEOWNERS for this directory)

- problem: if ctx is not, calling cancel() will panic
- nil Context already handled in newContextWithTimeout
- add with test
- rename blackbox tests package to stackdriver_test
- remove context is nil checking, add to initialization
- add tests for timeout
@rghetia rghetia merged commit a228baf into open-telemetry:master Nov 14, 2019
@clsung clsung deleted the test_exporter_stackdriver branch November 14, 2019 23:02
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.

None yet

4 participants