Skip to content

Commit 5d11892

Browse files
Send clientname and clientkey with every registerblobs request for metering views (#922)
send clientname and clientkey with every registerblobs request, to be used for emitting iceberg metering info
1 parent 52ac348 commit 5d11892

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

src/main/java/net/snowflake/ingest/streaming/internal/InternalStage.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ private Optional<String> putRemote(String fullFilePath, byte[] data, int retryCo
181181
fileTransferMetadataCopy,
182182
inStream,
183183
proxyProperties,
184-
clientPrefix,
185184
clientName,
185+
clientPrefix,
186186
fullFilePath));
187187
} else {
188188
SnowflakeFileTransferAgent.uploadWithoutConnection(

src/main/java/net/snowflake/ingest/streaming/internal/RegisterBlobRequest.java

+14-1
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,29 @@ class RegisterBlobRequest implements IStreamingIngestRequest {
2020
@JsonProperty("blobs")
2121
private List<BlobMetadata> blobs;
2222

23+
@JsonProperty("client_name")
24+
private String clientName;
25+
26+
@JsonProperty("client_key")
27+
private String clientKey;
28+
2329
@JsonInclude(JsonInclude.Include.NON_NULL)
2430
@JsonProperty("is_iceberg")
2531
private boolean enableIcebergStreaming;
2632

2733
RegisterBlobRequest(
28-
String requestId, String role, List<BlobMetadata> blobs, boolean enableIcebergStreaming) {
34+
String requestId,
35+
String role,
36+
List<BlobMetadata> blobs,
37+
boolean enableIcebergStreaming,
38+
String clientName,
39+
String clientKey) {
2940
this.requestId = requestId;
3041
this.role = role;
3142
this.blobs = blobs;
3243
this.enableIcebergStreaming = enableIcebergStreaming;
44+
this.clientName = clientName;
45+
this.clientKey = clientKey;
3346
}
3447

3548
String getRequestId() {

src/main/java/net/snowflake/ingest/streaming/internal/SnowflakeStreamingIngestClientInternal.java

+6-2
Original file line numberDiff line numberDiff line change
@@ -585,9 +585,11 @@ List<List<BlobMetadata>> partitionBlobListForRegistrationRequest(List<BlobMetada
585585
*/
586586
void registerBlobs(List<BlobMetadata> blobs, final int executionCount) {
587587
logger.logInfo(
588-
"Register blob request preparing for blob={}, client={}, executionCount={}",
588+
"Register blob request preparing for blob={}, clientName={}, clientKey={},"
589+
+ " executionCount={}",
589590
blobs.stream().map(BlobMetadata::getPath).collect(Collectors.toList()),
590591
this.name,
592+
this.storageManager.getClientPrefix(),
591593
executionCount);
592594

593595
RegisterBlobResponse response = null;
@@ -597,7 +599,9 @@ void registerBlobs(List<BlobMetadata> blobs, final int executionCount) {
597599
this.storageManager.getClientPrefix() + "_" + counter.getAndIncrement(),
598600
this.role,
599601
blobs,
600-
this.parameterProvider.isEnableIcebergStreaming());
602+
this.parameterProvider.isEnableIcebergStreaming(),
603+
this.getName(),
604+
this.storageManager.getClientPrefix());
601605
response = snowflakeServiceClient.registerBlob(request, executionCount);
602606
} catch (IOException | IngestResponseException e) {
603607
throw new SFException(e, ErrorCode.REGISTER_BLOB_FAILURE, e.getMessage());

0 commit comments

Comments
 (0)