Skip to content

Commit 4b97547

Browse files
committed
Trace snowflake copying step
1 parent 85a4533 commit 4b97547

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

airbyte-integrations/connectors/destination-snowflake/src/main/java/io/airbyte/integrations/destination/snowflake/SnowflakeInternalStagingConsumerFactory.java

+8-7
Original file line numberDiff line numberDiff line change
@@ -180,19 +180,20 @@ private OnCloseFunction onCloseFunction(final JdbcDatabase database,
180180
if (!hasFailed) {
181181
final List<String> queryList = new ArrayList<>();
182182
LOGGER.info("Finalizing tables in destination started for {} streams", writeConfigs.size());
183+
183184
for (final WriteConfig writeConfig : writeConfigs) {
184185
final String schemaName = writeConfig.getOutputSchemaName();
186+
final String streamName = writeConfig.getStreamName();
185187
final String srcTableName = writeConfig.getTmpTableName();
186188
final String dstTableName = writeConfig.getOutputTableName();
187-
LOGGER.info("Finalizing stream {}. schema {}, tmp table {}, final table {}", writeConfig.getStreamName(), schemaName, srcTableName,
188-
dstTableName);
189-
190189
final String path = namingResolver.getStagingPath(schemaName, dstTableName, CURRENT_SYNC_PATH);
191-
LOGGER.info("Uploading data from stage: stream {}. schema {}, tmp table {}, stage path {}", writeConfig.getStreamName(), schemaName,
192-
srcTableName,
193-
path);
190+
LOGGER.info("Finalizing stream {}. schema {}, tmp table {}, final table {}, stage path {}",
191+
streamName, schemaName, srcTableName, dstTableName, path);
192+
194193
try {
195-
sqlOperations.copyIntoTmpTableFromStage(database, path, srcTableName, schemaName);
194+
AirbyteSentry.executeWithTracing("CopyIntoTmpTableFromStage",
195+
() -> sqlOperations.copyIntoTmpTableFromStage(database, path, srcTableName, schemaName),
196+
Map.of("schema", schemaName, "stream", streamName, "tmpTable", srcTableName, "finalTable", dstTableName));
196197
} catch (final Exception e) {
197198
sqlOperations.cleanUpStage(database, path);
198199
LOGGER.info("Cleaning stage path {}", path);

0 commit comments

Comments
 (0)