@@ -52,6 +52,7 @@ import {
5252 ATTR_SERVER_ADDRESS ,
5353 ATTR_SERVER_PORT ,
5454 ATTR_EXCEPTION_MESSAGE ,
55+ ATTR_DB_OPERATION_BATCH_SIZE ,
5556} from '@opentelemetry/semantic-conventions' ;
5657import { RedisResponseCustomAttributeFunction } from '../../src/types' ;
5758import { hrTimeToMilliseconds , suppressTracing } from '@opentelemetry/core' ;
@@ -622,6 +623,28 @@ describe('redis v4-v5', () => {
622623 } ) ;
623624 } ) ;
624625
626+ describe ( 'extra coverage batch size and URL sanitization' , ( ) => {
627+ const stableCfg = { semconvStability : SemconvStability . STABLE } ;
628+
629+ afterEach ( ( ) => {
630+ instrumentation . setConfig ( { } ) ;
631+ } ) ;
632+
633+ it ( 'should set ATTR_DB_OPERATION_BATCH_SIZE when multi has 3 commands' , async ( ) => {
634+ instrumentation . setConfig ( stableCfg ) ;
635+ const multi = client . multi ( ) ;
636+ multi . set ( 'covKey1' , 'v1' ) ;
637+ multi . get ( 'covKey1' ) ;
638+ multi . set ( 'covKey2' , 'v2' ) ;
639+ await multi . exec ( ) ;
640+
641+ const spanWithBatch = getTestSpans ( ) . find (
642+ s => s . attributes [ ATTR_DB_OPERATION_BATCH_SIZE ] === 3
643+ ) ;
644+ assert . ok ( spanWithBatch , 'No span had batch size 3' ) ;
645+ } ) ;
646+ } ) ;
647+
625648 describe ( 'config' , ( ) => {
626649 describe ( 'dbStatementSerializer' , ( ) => {
627650 it ( 'custom dbStatementSerializer' , async ( ) => {
0 commit comments