@@ -53,6 +53,11 @@ export const publish = async ({
5353
5454 logger . log ( `Publishing ${ measurements . length } measurements. Total unpublished: ${ totalCount } . Batch size: ${ maxMeasurements } .` )
5555
56+ // Calculate batch size in bytes
57+ const batchSizeBytes = Buffer . byteLength (
58+ measurements . map ( m => JSON . stringify ( m ) ) . join ( '\n' )
59+ )
60+
5661 // Share measurements
5762 const start = new Date ( )
5863 const file = new File (
@@ -126,7 +131,9 @@ export const publish = async ({
126131
127132 logger . log ( 'Done!' )
128133
134+ // Enhanced telemetry recording with separate batch metrics
129135 recordTelemetry ( 'publish' , point => {
136+ // Existing metrics
130137 point . intField ( 'round_index' , roundIndex )
131138 point . intField ( 'measurements' , measurements . length )
132139 point . floatField ( 'load' , totalCount / maxMeasurements )
@@ -136,6 +143,16 @@ export const publish = async ({
136143 )
137144 point . intField ( 'add_measurements_duration_ms' , ieAddMeasurementsDuration )
138145 } )
146+
147+ // Separate batch metrics recording for better organization
148+ recordTelemetry ( 'batch_metrics' , point => {
149+ point . intField ( 'batch_size_bytes' , batchSizeBytes )
150+ point . floatField ( 'avg_measurement_size_bytes' , batchSizeBytes / measurements . length )
151+ point . intField ( 'measurement_count' , measurements . length )
152+ point . tag ( 'cid' , cid . toString ( ) )
153+ point . tag ( 'round_index' , roundIndex . toString ( ) )
154+ point . timestamp ( new Date ( ) )
155+ } )
139156}
140157
141158const commitMeasurements = async ( { cid, ieContract, logger, stuckTransactionsCanceller } ) => {
0 commit comments