github.com/puellanivis/breton@v0.2.16/lib/net/dash/metrics.go (about) 1 package dash 2 3 import ( 4 "github.com/puellanivis/breton/lib/metrics" 5 ) 6 7 const ( 8 urlLabel = metrics.Label("manifest_url") 9 typeLabel = metrics.Label("mime_type") 10 ) 11 12 var ( 13 labels = metrics.WithLabels(urlLabel, typeLabel) 14 ) 15 16 type metricsPack struct { 17 timing *metrics.SummaryValue 18 bandwidth *metrics.SummaryValue 19 } 20 21 var baseMetrics = &metricsPack{ 22 timing: metrics.Summary("dash_segment_timing_seconds", "tracks how long it takes to receive segments", labels, metrics.CommonObjectives()), 23 bandwidth: metrics.Summary("dash_segment_bandwidth_bps", "tracks the bits per second of dash segments received", labels, metrics.CommonObjectives()), 24 } 25 26 func (m *metricsPack) WithLabels(labels ...metrics.Labeler) *metricsPack { 27 return &metricsPack{ 28 timing: m.timing.WithLabels(labels...), 29 bandwidth: m.bandwidth.WithLabels(labels...), 30 } 31 }