@@ -519,12 +519,12 @@ function normalizeBytes (opts) {
519519function normalizePositiveTime ( opts , logger ) {
520520 for ( const key of POSITIVE_TIME_OPTS ) {
521521 if ( key in opts ) {
522- let val = toSeconds ( String ( opts [ key ] ) )
522+ let val = secondsFromTimeStr ( String ( opts [ key ] ) )
523523 if ( val === null ) {
524524 const def = DEFAULTS [ key ]
525525 logger . warn ( 'invalid time value "%s" for "%s" config option: using default "%s"' ,
526526 opts [ key ] , key , def )
527- val = toSeconds ( def )
527+ val = secondsFromTimeStr ( def )
528528 }
529529 opts [ key ] = val
530530 }
@@ -533,7 +533,7 @@ function normalizePositiveTime (opts, logger) {
533533
534534function normalizeTime ( opts ) {
535535 for ( const key of TIME_OPTS ) {
536- if ( key in opts ) opts [ key ] = toSeconds ( String ( opts [ key ] ) , true )
536+ if ( key in opts ) opts [ key ] = secondsFromTimeStr ( String ( opts [ key ] ) , true )
537537 }
538538}
539539
@@ -613,7 +613,7 @@ function bytes (input) {
613613 }
614614}
615615
616- function toSeconds ( value , allowNegative ) {
616+ function secondsFromTimeStr ( value , allowNegative ) {
617617 let matches
618618 if ( allowNegative ) {
619619 matches = / ^ ( - ? \d + ) ( m | m s | s ) ? $ / . exec ( value )
@@ -747,7 +747,7 @@ function getBaseClientConfig (conf, agent) {
747747 cloudMetadataFetcher : ( new CloudMetadata ( cloudProvider , conf . logger , conf . serviceName ) )
748748 }
749749
750- if ( conf . errorMessageMaxLength !== undefined ) {
750+ if ( conf . errorMessageMaxLength !== undefined ) { O
751751 // As of v10 of the http client, truncation of error messages will default
752752 // to `truncateLongFieldsAt` if `truncateErrorMessagesAt` is not specified.
753753 clientConfig . truncateErrorMessagesAt = conf . errorMessageMaxLength
@@ -762,4 +762,7 @@ module.exports.INTAKE_STRING_MAX_SIZE = INTAKE_STRING_MAX_SIZE
762762module . exports . CAPTURE_ERROR_LOG_STACK_TRACES_NEVER = CAPTURE_ERROR_LOG_STACK_TRACES_NEVER
763763module . exports . CAPTURE_ERROR_LOG_STACK_TRACES_MESSAGES = CAPTURE_ERROR_LOG_STACK_TRACES_MESSAGES
764764module . exports . CAPTURE_ERROR_LOG_STACK_TRACES_ALWAYS = CAPTURE_ERROR_LOG_STACK_TRACES_ALWAYS
765+
766+ // The following are exported for tests.
765767module . exports . DEFAULTS = DEFAULTS
768+ module . exports . secondsFromTimeStr = secondsFromTimeStr
0 commit comments