Skip to content

Commit

Permalink
[Delta] Update Coordinated Commits Usage Logs (delta-io#3774)
Browse files Browse the repository at this point in the history
<!--
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://github.com/delta-io/delta/blob/master/CONTRIBUTING.md
2. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP]
Your PR title ...'.
  3. Be sure to keep the PR description updated to reflect all changes.
  4. Please write your PR title to summarize what this PR proposes.
5. If possible, provide a concise example to reproduce the issue for a
faster review.
6. If applicable, include the corresponding issue number in the PR title
and link it in the body.
-->

#### Which Delta project/connector is this regarding?
<!--
Please add the component selected below to the beginning of the pull
request title
For example: [Spark] Title of my pull request
-->

- [x] Spark
- [ ] Standalone
- [ ] Flink
- [ ] Kernel
- [ ] Other (fill in here)

## Description

<!--
- Describe what this PR changes.
- Describe why we need the change.
 
If this PR resolves an issue be sure to include "Resolves #XXX" to
correctly link and close the issue upon merge.
-->

1. Renames the full error message with 
- `"exceptionString" -> exceptionString(e)` to record the full error
message;
- `"exceptionClass" -> e.getClass.getName` to retain the error class
information.
2. Adds field `registeredCommitCoordinators`.
3. Removes nested JSONizing. 

## How was this patch tested?

<!--
If tests were added, say they were added here. Please make sure to test
the changes thoroughly including negative and positive cases if
possible.
If the changes were tested in any way other than 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 the changes were not tested, please explain why.
-->

Existed UTs.

## Does this PR introduce _any_ user-facing changes?

<!--
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 Delta Lake versions or within the unreleased
branches such as master.
If no, write 'No'.
-->

No.
  • Loading branch information
yumingxuanguo-db authored Oct 16, 2024
1 parent cb7e27f commit e3ec677
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import scala.collection.mutable

import org.apache.spark.sql.delta.actions._
import org.apache.spark.sql.delta.actions.Action.logSchema
import org.apache.spark.sql.delta.coordinatedcommits.{CommitCoordinatorClient, CoordinatedCommitsUsageLogs, CoordinatedCommitsUtils, TableCommitCoordinatorClient}
import org.apache.spark.sql.delta.coordinatedcommits.{CommitCoordinatorClient, CommitCoordinatorProvider, CoordinatedCommitsUsageLogs, CoordinatedCommitsUtils, TableCommitCoordinatorClient}
import org.apache.spark.sql.delta.logging.DeltaLogKeys
import org.apache.spark.sql.delta.metering.DeltaLogging
import org.apache.spark.sql.delta.schema.SchemaUtils
Expand Down Expand Up @@ -322,6 +322,8 @@ class Snapshot(
CoordinatedCommitsUsageLogs.COMMIT_COORDINATOR_MISSING_IMPLEMENTATION_WRITE,
data = Map(
"commitCoordinatorName" -> coordinatorName.get,
"registeredCommitCoordinators" ->
CommitCoordinatorProvider.getRegisteredCoordinatorNames.mkString(", "),
"readVersion" -> version.toString
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ object CoordinatedCommitsUsageLogs {
val FS_COMMIT_COORDINATOR_LISTING_UNEXPECTED_GAPS =
s"$PREFIX.listDeltaAndCheckpointFiles.unexpectedGapsInResults"

// Usage log emitted when a requested Commit Coordinator implementation is missing
// Usage log emitted when a requested Commit Coordinator implementation is missing.
val COMMIT_COORDINATOR_MISSING_IMPLEMENTATION =
s"$PREFIX.commitCoordinator.missingImplementation"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,12 @@ object CoordinatedCommitsUtils extends DeltaLogging {
response
} catch {
case NonFatal(e) =>
recordEvent(Map("exception" -> Utils.exceptionString(e)))
recordEvent(
Map(
"exceptionClass" -> e.getClass.getName,
"exceptionString" -> Utils.exceptionString(e)
)
)
throw e
}
}
Expand Down Expand Up @@ -168,7 +173,7 @@ object CoordinatedCommitsUtils extends DeltaLogging {
"commitCoordinatorName" -> commitCoordinatorStr,
"registeredCommitCoordinators" ->
CommitCoordinatorProvider.getRegisteredCoordinatorNames.mkString(", "),
"commitCoordinatorConf" -> JsonUtils.toJson(coordinatorConf),
"commitCoordinatorConf" -> coordinatorConf,
"failIfImplUnavailable" -> failIfImplUnavailable.toString
)
)
Expand Down

0 comments on commit e3ec677

Please sign in to comment.