Browse Source

normalize variable names

pull/372/head
aler9 5 years ago
parent
commit
37d752ba61
  1. 16
      internal/metrics/metrics.go
  2. 4
      internal/sourcertmp/source.go
  3. 4
      internal/sourcertsp/source.go
  4. 16
      internal/stats/stats.go

16
internal/metrics/metrics.go

@ -80,10 +80,10 @@ func (m *Metrics) onMetrics(w http.ResponseWriter, req *http.Request) { @@ -80,10 +80,10 @@ func (m *Metrics) onMetrics(w http.ResponseWriter, req *http.Request) {
countClients := atomic.LoadInt64(m.stats.CountClients)
countPublishers := atomic.LoadInt64(m.stats.CountPublishers)
countReaders := atomic.LoadInt64(m.stats.CountReaders)
countSourcesRtsp := atomic.LoadInt64(m.stats.CountSourcesRtsp)
countSourcesRtspRunning := atomic.LoadInt64(m.stats.CountSourcesRtspRunning)
countSourcesRtmp := atomic.LoadInt64(m.stats.CountSourcesRtmp)
countSourcesRtmpRunning := atomic.LoadInt64(m.stats.CountSourcesRtmpRunning)
countSourcesRTSP := atomic.LoadInt64(m.stats.CountSourcesRTSP)
countSourcesRTSPRunning := atomic.LoadInt64(m.stats.CountSourcesRTSPRunning)
countSourcesRTMP := atomic.LoadInt64(m.stats.CountSourcesRTMP)
countSourcesRTMPRunning := atomic.LoadInt64(m.stats.CountSourcesRTMPRunning)
out := ""
out += formatMetric("rtsp_clients{state=\"idle\"}",
@ -93,13 +93,13 @@ func (m *Metrics) onMetrics(w http.ResponseWriter, req *http.Request) { @@ -93,13 +93,13 @@ func (m *Metrics) onMetrics(w http.ResponseWriter, req *http.Request) {
out += formatMetric("rtsp_clients{state=\"reading\"}",
countReaders, nowUnix)
out += formatMetric("rtsp_sources{type=\"rtsp\",state=\"idle\"}",
countSourcesRtsp-countSourcesRtspRunning, nowUnix)
countSourcesRTSP-countSourcesRTSPRunning, nowUnix)
out += formatMetric("rtsp_sources{type=\"rtsp\",state=\"running\"}",
countSourcesRtspRunning, nowUnix)
countSourcesRTSPRunning, nowUnix)
out += formatMetric("rtsp_sources{type=\"rtmp\",state=\"idle\"}",
countSourcesRtmp-countSourcesRtmpRunning, nowUnix)
countSourcesRTMP-countSourcesRTMPRunning, nowUnix)
out += formatMetric("rtsp_sources{type=\"rtmp\",state=\"running\"}",
countSourcesRtmpRunning, nowUnix)
countSourcesRTMPRunning, nowUnix)
w.WriteHeader(http.StatusOK)
io.WriteString(w, out)

4
internal/sourcertmp/source.go

@ -61,7 +61,7 @@ func New(ur string, @@ -61,7 +61,7 @@ func New(ur string,
terminate: make(chan struct{}),
}
atomic.AddInt64(s.stats.CountSourcesRtmp, +1)
atomic.AddInt64(s.stats.CountSourcesRTMP, +1)
s.log(logger.Info, "started")
s.wg.Add(1)
@ -71,7 +71,7 @@ func New(ur string, @@ -71,7 +71,7 @@ func New(ur string,
// Close closes a Source.
func (s *Source) Close() {
atomic.AddInt64(s.stats.CountSourcesRtmpRunning, -1)
atomic.AddInt64(s.stats.CountSourcesRTMPRunning, -1)
s.log(logger.Info, "stopped")
close(s.terminate)
}

4
internal/sourcertsp/source.go

@ -72,7 +72,7 @@ func New( @@ -72,7 +72,7 @@ func New(
terminate: make(chan struct{}),
}
atomic.AddInt64(s.stats.CountSourcesRtsp, +1)
atomic.AddInt64(s.stats.CountSourcesRTSP, +1)
s.log(logger.Info, "started")
s.wg.Add(1)
@ -82,7 +82,7 @@ func New( @@ -82,7 +82,7 @@ func New(
// Close closes a Source.
func (s *Source) Close() {
atomic.AddInt64(s.stats.CountSourcesRtsp, -1)
atomic.AddInt64(s.stats.CountSourcesRTSP, -1)
s.log(logger.Info, "stopped")
close(s.terminate)
}

16
internal/stats/stats.go

@ -12,10 +12,10 @@ type Stats struct { @@ -12,10 +12,10 @@ type Stats struct {
CountClients *int64
CountPublishers *int64
CountReaders *int64
CountSourcesRtsp *int64
CountSourcesRtspRunning *int64
CountSourcesRtmp *int64
CountSourcesRtmpRunning *int64
CountSourcesRTSP *int64
CountSourcesRTSPRunning *int64
CountSourcesRTMP *int64
CountSourcesRTMPRunning *int64
}
// New allocates a Stats.
@ -24,10 +24,10 @@ func New() *Stats { @@ -24,10 +24,10 @@ func New() *Stats {
CountClients: ptrInt64(),
CountPublishers: ptrInt64(),
CountReaders: ptrInt64(),
CountSourcesRtsp: ptrInt64(),
CountSourcesRtspRunning: ptrInt64(),
CountSourcesRtmp: ptrInt64(),
CountSourcesRtmpRunning: ptrInt64(),
CountSourcesRTSP: ptrInt64(),
CountSourcesRTSPRunning: ptrInt64(),
CountSourcesRTMP: ptrInt64(),
CountSourcesRTMPRunning: ptrInt64(),
}
}

Loading…
Cancel
Save