Skip to content

Commit

Permalink
fix NSFS prometheus write bytes
Browse files Browse the repository at this point in the history
Signed-off-by: Utkarsh Srivastava <[email protected]>
  • Loading branch information
tangledbytes committed Nov 16, 2023
1 parent dd99e7b commit eee13b1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/sdk/namespace_fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -1443,7 +1443,8 @@ class NamespaceFS {
stats: this.stats,
namespace_resource_id: this.namespace_resource_id,
md5_enabled,
offset
offset,
bucket: params.bucket
});
chunk_fs.on('error', err1 => dbg.error('namespace_fs._upload_stream: error occured on stream ChunkFS: ', err1));
await stream_utils.pipeline([source_stream, chunk_fs]);
Expand Down
7 changes: 5 additions & 2 deletions src/util/chunk_fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ class ChunkFS extends stream.Transform {
* md5_enabled: boolean,
* stats: import('../sdk/endpoint_stats_collector').EndpointStatsCollector,
* offset?: number,
* bucket?: string,
* }} params
*/
constructor({ target_file, fs_context, namespace_resource_id, md5_enabled, stats, offset }) {
constructor({ target_file, fs_context, namespace_resource_id, md5_enabled, stats, offset, bucket }) {
super();
this.q_buffers = [];
this.q_size = 0;
Expand All @@ -40,6 +41,7 @@ class ChunkFS extends stream.Transform {
this._total_num_buffers = 0;
const platform_iov_max = nb_native().fs.PLATFORM_IOV_MAX;
this.iov_max = platform_iov_max ? Math.min(platform_iov_max, config.NSFS_DEFAULT_IOV_MAX) : config.NSFS_DEFAULT_IOV_MAX;
this.bucket = bucket;
}

async _transform(chunk, encoding, callback) {
Expand All @@ -48,7 +50,8 @@ class ChunkFS extends stream.Transform {
this.stats?.update_nsfs_write_stats({
namespace_resource_id: this.namespace_resource_id,
size: chunk.length,
count: this.count
count: this.count,
bucket_name: this.bucket,
});
this.count = 0;
while (chunk && chunk.length) {
Expand Down

0 comments on commit eee13b1

Please sign in to comment.