Skip to content
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -254,41 +254,45 @@ private void initApplicationSpanIfNotInitialized() {
}

log.debug("Starting tracer application span.");
log.debug(databricksClusterName);
if (!isRunningOnDatabricks) {
String databricksClusterNameSpark = databricksClusterName + "creating a spark.app";
log.debug(databricksClusterNameSpark);
AgentTracer.SpanBuilder builder = buildSparkSpan("spark.application", null);

if (applicationStart != null) {
String ddTags =
Config.get().getGlobalTags().entrySet().stream()
.sorted(Map.Entry.comparingByKey())
.map(e -> e.getKey() + ":" + e.getValue())
.collect(Collectors.joining(","));

builder
.withStartTimestamp(applicationStart.time() * 1000)
.withTag("application_name", applicationStart.appName())
.withTag("djm.tags", ddTags)
.withTag("spark_user", applicationStart.sparkUser());

if (applicationStart.appAttemptId().isDefined()) {
builder.withTag("app_attempt_id", applicationStart.appAttemptId().get());
}
}

AgentTracer.SpanBuilder builder = buildSparkSpan("spark.application", null);

if (applicationStart != null) {
String ddTags =
Config.get().getGlobalTags().entrySet().stream()
.sorted(Map.Entry.comparingByKey())
.map(e -> e.getKey() + ":" + e.getValue())
.collect(Collectors.joining(","));

builder
.withStartTimestamp(applicationStart.time() * 1000)
.withTag("application_name", applicationStart.appName())
.withTag("djm.tags", ddTags)
.withTag("spark_user", applicationStart.sparkUser());
captureApplicationParameters(builder);

if (applicationStart.appAttemptId().isDefined()) {
builder.withTag("app_attempt_id", applicationStart.appAttemptId().get());
Optional<OpenlineageParentContext> openlineageParentContext =
OpenlineageParentContext.from(sparkConf);
// We know we're not in Databricks context
if (openlineageParentContext.isPresent()) {
captureOpenlineageContextIfPresent(builder, openlineageParentContext.get());
} else {
builder.asChildOf(predeterminedTraceIdContext);
}
}

captureApplicationParameters(builder);

Optional<OpenlineageParentContext> openlineageParentContext =
OpenlineageParentContext.from(sparkConf);
// We know we're not in Databricks context
if (openlineageParentContext.isPresent()) {
captureOpenlineageContextIfPresent(builder, openlineageParentContext.get());
} else {
builder.asChildOf(predeterminedTraceIdContext);
applicationSpan = builder.start();
setDataJobsSamplingPriority(applicationSpan);
applicationSpan.setMeasured(true);
}

applicationSpan = builder.start();
setDataJobsSamplingPriority(applicationSpan);
applicationSpan.setMeasured(true);
}

private void captureOpenlineageContextIfPresent(
Expand Down