You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "panbingkun (via GitHub)" <gi...@apache.org> on 2024/06/14 03:29:17 UTC
[PR] [SPARK-47597][FOLLOWUP] Streaming: Migrate logInfo with variables to structured logging framework [spark]
panbingkun opened a new pull request, #46982:
URL: https://github.com/apache/spark/pull/46982
<!--
Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, please read our contributor guidelines: https://spark.apache.org/contributing.html
2. Ensure you have added or run the appropriate tests for your PR: https://spark.apache.org/developer-tools.html
3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][SPARK-XXXX] Your PR title ...'.
4. Be sure to keep the PR description updated to reflect all changes.
5. Please write your PR title to summarize what this PR proposes.
6. If possible, provide a concise example to reproduce the issue for a faster review.
7. If you want to add a new configuration, please read the guideline first for naming configurations in
'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
8. If you want to add or modify an error type or message, please read the guideline first in
'common/utils/src/main/resources/error/README.md'.
-->
### What changes were proposed in this pull request?
<!--
Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue.
If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
2. If you fix some SQL features, you can provide some references of other DBMSes.
3. If there is design documentation, please add the link.
4. If there is a discussion in the mailing list, please add the link.
-->
### Why are the changes needed?
<!--
Please clarify why the changes are needed. For instance,
1. If you propose a new API, clarify the use case for a new API.
2. If you fix a bug, you can clarify why it is a bug.
-->
### Does this PR introduce _any_ user-facing change?
<!--
Note that it means *any* user-facing change including all aspects such as the documentation fix.
If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
If no, write 'No'.
-->
### How was this patch tested?
<!--
If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
If tests were not added, please describe why they were not added and/or why it was difficult to add.
If benchmark tests were added, please run the benchmarks in GitHub Actions for the consistent environment, and the instructions could accord to: https://spark.apache.org/developer-tools.html#github-workflow-benchmarks.
-->
### Was this patch authored or co-authored using generative AI tooling?
<!--
If generative AI tooling has been used in the process of authoring this patch, please include the
phrase: 'Generated-by: ' followed by the name of the tool and its version.
If no, write 'No'.
Please refer to the [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html) for details.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-47597][FOLLOWUP] Streaming: Migrate logInfo with variables to structured logging framework [spark]
Posted by "panbingkun (via GitHub)" <gi...@apache.org>.
panbingkun commented on PR #46982:
URL: https://github.com/apache/spark/pull/46982#issuecomment-2169217823
> @panbingkun Thanks for the work. There is another pending PR created before this one: #46980 Let's hold this one until #46980 is merged.
Oh, okay, let's hold it first and turn it into a draft state first.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-47597][FOLLOWUP] Streaming: Migrate logInfo with variables to structured logging framework [spark]
Posted by "panbingkun (via GitHub)" <gi...@apache.org>.
panbingkun commented on code in PR #46982:
URL: https://github.com/apache/spark/pull/46982#discussion_r1639489537
##########
streaming/src/main/scala/org/apache/spark/streaming/rdd/WriteAheadLogBackedBlockRDD.scala:
##########
@@ -156,8 +157,8 @@ class WriteAheadLogBackedBlockRDD[T: ClassTag](
s"Could not read data from write ahead log record ${partition.walRecordHandle}, " +
s"read returned null")
}
- logInfo(s"Read partition data of $this from write ahead log, record handle " +
- partition.walRecordHandle)
+ logInfo(log"Read partition data of ${MDC(LogKeys.RDD, this)} from write ahead log, " +
Review Comment:
I'm not sure if it's appropriate to call it `LogKeys.RDD`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-47597][FOLLOWUP] Streaming: Migrate logInfo with variables to structured logging framework [spark]
Posted by "panbingkun (via GitHub)" <gi...@apache.org>.
panbingkun commented on code in PR #46982:
URL: https://github.com/apache/spark/pull/46982#discussion_r1639492908
##########
core/src/main/scala/org/apache/spark/deploy/master/ui/MasterWebUI.scala:
##########
@@ -79,7 +79,7 @@ class MasterWebUI(
} else {
val removedWorkers = masterEndpointRef.askSync[Integer](
DecommissionWorkersOnHosts(hostnames))
- logInfo(log"Decommissioning of hosts ${MDC(HOST_NAMES, hostnames)}" +
+ logInfo(log"Decommissioning of hosts ${MDC(HOSTS, hostnames)}" +
Review Comment:
Let's call it `HOSTS` and remove `HOST_NAMES` from `LogKeys` at the same time.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-47597][FOLLOWUP] Streaming: Migrate logInfo with variables to structured logging framework [spark]
Posted by "gengliangwang (via GitHub)" <gi...@apache.org>.
gengliangwang commented on PR #46982:
URL: https://github.com/apache/spark/pull/46982#issuecomment-2169171782
@panbingkun Thanks for the work. There is another pending PR created before this one: https://github.com/apache/spark/pull/46980
Let's hold this one until https://github.com/apache/spark/pull/46980 is merged.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-47597][FOLLOWUP] Streaming: Migrate logInfo with variables to structured logging framework [spark]
Posted by "panbingkun (via GitHub)" <gi...@apache.org>.
panbingkun commented on PR #46982:
URL: https://github.com/apache/spark/pull/46982#issuecomment-2167525646
In addition, I found that other modules have similar issues. In another PR https://github.com/apache/spark/pull/46986, I did similar actions, some were omitted, and some were added but did not comply with the new structured log specifications.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-47597][FOLLOWUP] Streaming: Migrate logInfo with variables to structured logging framework [spark]
Posted by "panbingkun (via GitHub)" <gi...@apache.org>.
panbingkun commented on code in PR #46982:
URL: https://github.com/apache/spark/pull/46982#discussion_r1639519313
##########
streaming/src/main/scala/org/apache/spark/streaming/scheduler/ExecutorAllocationManager.scala:
##########
@@ -89,11 +91,14 @@ private[streaming] class ExecutorAllocationManager(
* batch statistics.
*/
private def manageAllocation(): Unit = synchronized {
- logInfo(s"Managing executor allocation with ratios = [$scalingUpRatio, $scalingDownRatio]")
+ logInfo(log"Managing executor allocation with ratios = [" +
+ log"${MDC(LogKeys.SCALING_UP_RATIO, scalingUpRatio)}, " +
+ log"${MDC(LogKeys.SCALING_DOWN_RATIO, scalingDownRatio)}]")
if (batchProcTimeCount > 0) {
val averageBatchProcTime = batchProcTimeSum / batchProcTimeCount
val ratio = averageBatchProcTime.toDouble / batchDurationMs
- logInfo(s"Average: $averageBatchProcTime, ratio = $ratio" )
Review Comment:
Remove redundant `whitespaces`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-47597][FOLLOWUP] Streaming: Migrate logInfo with variables to structured logging framework [spark]
Posted by "panbingkun (via GitHub)" <gi...@apache.org>.
panbingkun commented on code in PR #46982:
URL: https://github.com/apache/spark/pull/46982#discussion_r1639507017
##########
streaming/src/main/scala/org/apache/spark/streaming/scheduler/ExecutorAllocationManager.scala:
##########
@@ -75,8 +75,10 @@ private[streaming] class ExecutorAllocationManager(
def start(): Unit = {
timer.start()
- logInfo(s"ExecutorAllocationManager started with " +
- s"ratios = [$scalingUpRatio, $scalingDownRatio] and interval = $scalingIntervalSecs sec")
+ logInfo(log"ExecutorAllocationManager started with " +
+ log"ratios = [${MDC(LogKeys.SCALING_UP_RATIO, scalingUpRatio)}, " +
+ log"${MDC(LogKeys.SCALING_DOWN_RATIO, scalingDownRatio)}] and " +
+ log"interval = ${MDC(LogKeys.SCALING_INTERVAL, scalingIntervalSecs * 1000)} ms")
Review Comment:
interval -> Unified time unit as `ms`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-47597][FOLLOWUP] Streaming: Migrate logInfo with variables to structured logging framework [spark]
Posted by "panbingkun (via GitHub)" <gi...@apache.org>.
panbingkun commented on code in PR #46982:
URL: https://github.com/apache/spark/pull/46982#discussion_r1639528257
##########
streaming/src/main/scala/org/apache/spark/streaming/scheduler/ReceiverTracker.scala:
##########
@@ -232,7 +232,7 @@ class ReceiverTracker(ssc: StreamingContext, skipReceiverLaunch: Boolean = false
// Signal the receivers to delete old block data
if (WriteAheadLogUtils.enableReceiverLog(ssc.conf)) {
- logInfo(s"Cleanup old received batch data: $cleanupThreshTime")
+ logInfo(log"Cleanup old received batch data: ${MDC(CLEANUP_THRESH_TIME, cleanupThreshTime)}")
Review Comment:
`Time` itself is displayed in `ms`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-47597][FOLLOWUP] Streaming: Migrate logInfo with variables to structured logging framework [spark]
Posted by "panbingkun (via GitHub)" <gi...@apache.org>.
panbingkun commented on PR #46982:
URL: https://github.com/apache/spark/pull/46982#issuecomment-2167625012
cc @gengliangwang
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-47597][FOLLOWUP] Streaming: Migrate logInfo with variables to structured logging framework [spark]
Posted by "panbingkun (via GitHub)" <gi...@apache.org>.
panbingkun commented on code in PR #46982:
URL: https://github.com/apache/spark/pull/46982#discussion_r1639531929
##########
streaming/src/main/scala/org/apache/spark/streaming/dstream/DStream.scala:
##########
@@ -201,7 +200,8 @@ abstract class DStream[T: ClassTag] (
// Set the checkpoint interval to be slideDuration or 10 seconds, which ever is larger
if (mustCheckpoint && checkpointDuration == null) {
checkpointDuration = slideDuration * math.ceil(Seconds(10) / slideDuration).toInt
- logInfo(s"Checkpoint interval automatically set to $checkpointDuration")
+ logInfo(log"Checkpoint interval automatically set to " +
Review Comment:
`Duration` itself is displayed in `ms`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-47597][FOLLOWUP] Streaming: Migrate logInfo with variables to structured logging framework [spark]
Posted by "panbingkun (via GitHub)" <gi...@apache.org>.
panbingkun commented on code in PR #46982:
URL: https://github.com/apache/spark/pull/46982#discussion_r1639492134
##########
core/src/main/scala/org/apache/spark/executor/Executor.scala:
##########
@@ -83,7 +83,7 @@ private[spark] class Executor(
extends Logging {
logInfo(log"Starting executor ID ${LogMDC(LogKeys.EXECUTOR_ID, executorId)}" +
- log" on host ${LogMDC(HOST_NAME, executorHostname)}")
+ log" on host ${LogMDC(HOST, executorHostname)}")
Review Comment:
Let's call it `HOST` and remove `HOST_NAME` from `LogKeys` at the same time.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-47597][FOLLOWUP] Streaming: Migrate logInfo with variables to structured logging framework [spark]
Posted by "panbingkun (via GitHub)" <gi...@apache.org>.
panbingkun commented on code in PR #46982:
URL: https://github.com/apache/spark/pull/46982#discussion_r1639502539
##########
streaming/src/main/scala/org/apache/spark/streaming/util/FileBasedWriteAheadLog.scala:
##########
@@ -170,8 +170,9 @@ private[streaming] class FileBasedWriteAheadLog(
pastLogs --= expiredLogs
expiredLogs
}
- logInfo(s"Attempting to clear ${oldLogFiles.size} old log files in $logDirectory " +
- s"older than $threshTime: ${oldLogFiles.map { _.path }.mkString("\n")}")
+ logInfo(log"Attempting to clear ${MDC(NUM_FILES, oldLogFiles.size)} old log files in " +
+ log"${MDC(PATH, logDirectory)} older than ${MDC(THRESH_TIME, threshTime)}: " +
Review Comment:
`threshTime` unit is `ms`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-47597][FOLLOWUP] Streaming: Migrate logInfo with variables to structured logging framework [spark]
Posted by "panbingkun (via GitHub)" <gi...@apache.org>.
panbingkun commented on code in PR #46982:
URL: https://github.com/apache/spark/pull/46982#discussion_r1639520666
##########
streaming/src/main/scala/org/apache/spark/streaming/scheduler/ExecutorAllocationManager.scala:
##########
@@ -142,9 +149,9 @@ private[streaming] class ExecutorAllocationManager(
} else {
client.killExecutor(execIdToRemove)
}
- logInfo(s"Requested to kill executor $execIdToRemove")
Review Comment:
Remove redundant `interpolation`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org