ParseDuration parses the configured duration and returns a time.Duration of 0 if the duration is invalid.
()
| 678 | // ParseDuration parses the configured duration and returns a time.Duration of 0 |
| 679 | // if the duration is invalid. |
| 680 | func (m *Metrics) ParseDuration() (time.Duration, error) { |
| 681 | duration, err := time.ParseDuration(fmt.Sprint(m.Period)) |
| 682 | if err != nil { |
| 683 | return 0, err |
| 684 | } |
| 685 | return duration, nil |
| 686 | } |
| 687 | |
| 688 | // Duration returns the configured duration or the default duration if no value |
| 689 | // is configured or the configured value is invalid. |
no outgoing calls