Skip to content
Merged
Changes from 15 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
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public synchronized void onApplicationStart(SparkListenerApplicationStart applic
}

private void initApplicationSpanIfNotInitialized() {
if (applicationSpan != null) {
if (applicationSpan != null || isRunningOnDatabricks) {
return;
}

Expand Down Expand Up @@ -336,6 +336,13 @@ public synchronized void finishApplication(
}
initApplicationSpanIfNotInitialized();

if (applicationSpan == null) {
// On Databricks or streaming environments, the application span is not created.
// Flush any remaining traces and return.
tracer.flush();
return;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looking more closely at this code - it seems like we already try to handle Databricks jobs up above by checking for applicationSpan == null && jobCount > 0 and returning before we ever initialize the application span. Would it make sense to unify our updated logic into there?

This might also explain why we weren't seeing this issue previously - most customers don't start all purpose clusters and run nothing on them before they spin down

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was thinking about adding in the check in initApplicationSpanIfNotInitialized() because it's used in multiple methods (they have guards currently) but on the off chance it's used again in the future, adding the check in initApplicationSpanIfNotInitialized would prevent a DBX cluster having a spark span if the new code doesn't have a guard.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For posterity, we discussed in person and we agreed that in that case we would prefer updating all callers to reflect the check being moved into initApplicationSpanIfNotInitialized. For now, though, we follow the existing pattern and update the check where it is called in finishApplication.


if (throwable != null) {
applicationSpan.addThrowable(throwable);
} else if (exitCode != 0) {
Expand Down