Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add logging for DataChangeRecord and ChangeStreamQuery #31956

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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 @@ -85,6 +85,7 @@ public Optional<ProcessContinuation> run(

final String token = partition.getPartitionToken();
LOG.debug("[{}] Processing data record {}", token, record.getCommitTimestamp());
Copy link
Contributor

Choose a reason for hiding this comment

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

there is already debug log here. One can set --sdkHarnessLogLevelOverrides='{\"org.apache.beam.sdk.io.gcp.spanner.changestreams.action.DataChangeRecordAction\":\"DEBUG\"}'" to enable it. See https://beam.apache.org/releases/javadoc/current/org/apache/beam/sdk/options/SdkHarnessOptions.SdkHarnessLogLevelOverrides.html

LOG.info("[{}] Processing data record {}", token, record);

final Timestamp commitTimestamp = record.getCommitTimestamp();
final Instant commitInstant = new Instant(commitTimestamp.toSqlTimestamp().getTime());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@
import com.google.cloud.spanner.ResultSet;
import com.google.cloud.spanner.Statement;
import org.apache.beam.sdk.io.gcp.spanner.changestreams.model.InitialPartition;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Responsible for making change stream queries for a given partition. The result will be given back
* as a {@link ResultSet}, which can be consumed until the stream is finished.
*/
public class ChangeStreamDao {

private static final Logger LOG = LoggerFactory.getLogger(ChangeStreamDao.class);
private final String changeStreamName;
private final DatabaseClient databaseClient;
private final RpcPriority rpcPriority;
Expand Down Expand Up @@ -127,6 +129,7 @@ public ChangeStreamResultSet changeStreamQuery(
.to(heartbeatMillis)
.build();
}
LOG.info("Change Stream Statement: [{}] ", statement.toString());
Copy link
Contributor

Choose a reason for hiding this comment

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

in general refrain logging PII (statements can contain PII). If needed could use debug log

final ResultSet resultSet =
databaseClient
.singleUse()
Expand Down
Loading