Skip to content

[SPARK-47579][CORE][PART4] Migrate logInfo with variables to structured logging framework#46724

Closed
zeotuan wants to merge 14 commits into
apache:masterfrom
zeotuan:coreInfo3
Closed

[SPARK-47579][CORE][PART4] Migrate logInfo with variables to structured logging framework#46724
zeotuan wants to merge 14 commits into
apache:masterfrom
zeotuan:coreInfo3

Conversation

@zeotuan

@zeotuan zeotuan commented May 23, 2024

Copy link
Copy Markdown
Contributor

The PR aims to migrate logInfo in Core module with variables to structured logging framework.

Why are the changes needed?

To enhance Apache Spark's logging system by implementing structured logging.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

  • Pass GA.

Was this patch authored or co-authored using generative AI tooling?

No.

@github-actions github-actions Bot added the CORE label May 23, 2024
@zeotuan zeotuan marked this pull request as ready for review May 24, 2024 04:07
@zeotuan

zeotuan commented May 25, 2024

Copy link
Copy Markdown
Contributor Author

@gengliangwang Please help review this. I will merge this after #46739

@gengliangwang

gengliangwang commented May 25, 2024

Copy link
Copy Markdown
Member

@zeotuan I wasn't aware of this PR when I worked on #46739, since you were not responding to the jira comment.

Please resolve the merge conflicts and I will review and merge this one.

@gengliangwang gengliangwang changed the title [SPARK-47579][CORE][PART3] Migrate logInfo with variables to structured logging framework [SPARK-47579][CORE][PART4] Migrate logInfo with variables to structured logging framework May 25, 2024
@zeotuan

zeotuan commented May 27, 2024

Copy link
Copy Markdown
Contributor Author

@gengliangwang Hi please help review

Utils.deleteRecursively(sessionBasedRoot)
}
logInfo(s"Session evicted: ${state.sessionUUID}")
logInfo(log"Session evicted: ${LogMDC(UUID, state.sessionUUID)}")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

SESSION_ID

s"Starting executor with user classpath (userClassPathFirst = $userClassPathFirst): " +
urls.mkString("'", ",", "'")
log"Starting executor with user classpath" +
log" (userClassPathFirst = ${LogMDC(CLASS_PATH, userClassPathFirst)}): " +

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

userClassPathFirst is a boolean

}
logInfo(s"Created or updated repl class loader $classLoader for $sessionUUID.")
logInfo(log"Created or updated repl class loader ${LogMDC(CLASS_LOADER, classLoader)}" +
log" for ${LogMDC(UUID, sessionUUID)}.")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

SESSION_ID

.timeTakenMs { committer.commitJob(jobContext, ret.toImmutableArraySeq) }
logInfo(s"Write Job ${jobContext.getJobID} committed. Elapsed time: $duration ms.")
logInfo(log"Write Job ${MDC(JOB_ID, jobContext.getJobID)} committed." +
log" Elapsed time: ${MDC(TOTAL_TIME, duration)} ms.")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

DURATION, or we can just merge DURATION and TOTAL_TIME

@gengliangwang

Copy link
Copy Markdown
Member

LGTM except for a few minor comments. Thanks for the work!

case object WORKER extends LogKey
case object WORKER_HOST extends LogKey
case object WORKER_ID extends LogKey
case object WORKER_MEMORY extends LogKey

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is not used.

case object TOPIC_PARTITION_OFFSET_RANGE extends LogKey
case object TOTAL extends LogKey
case object TOTAL_EFFECTIVE_TIME extends LogKey
case object TOTAL_RECORDS_READ extends LogKey

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is not used.

@gengliangwang

gengliangwang commented May 29, 2024

Copy link
Copy Markdown
Member

@zeotuan please fix the test failures and remove all the unused keys(I didn't go over all the new keys).
I will merge this comment is addressed.

Comment thread common/utils/src/main/scala/org/apache/spark/internal/LogKey.scala Outdated
@gengliangwang

Copy link
Copy Markdown
Member

Merging to master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants