summaryrefslogtreecommitdiff
path: root/src/daq
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2016-10-13 22:41:35 +0200
committerChristian Pointner <equinox@spreadspace.org>2016-10-15 03:21:47 +0200
commitf0252da9b974930cf5a097de08eee1ca25226ef4 (patch)
tree94c70955ea4fe9f85311a79304b189de4daf3713 /src/daq
parentupdated changelog for release (diff)
added s5stats
Diffstat (limited to 'src/daq')
-rw-r--r--src/daq/s5proxy/src/s5proxy/stats.go86
1 files changed, 86 insertions, 0 deletions
diff --git a/src/daq/s5proxy/src/s5proxy/stats.go b/src/daq/s5proxy/src/s5proxy/stats.go
new file mode 100644
index 0000000..4a9c775
--- /dev/null
+++ b/src/daq/s5proxy/src/s5proxy/stats.go
@@ -0,0 +1,86 @@
+//
+// sfive
+//
+// sfive - spreadspace streaming statistics suite is a generic
+// statistic collection tool for streaming server infrastuctures.
+// The system collects and stores meta data like number of views
+// and throughput from a number of streaming servers and stores
+// it in a global data store.
+// The data acquisition is designed to be generic and extensible in
+// order to support different streaming software.
+// sfive also contains tools and applications to filter and visualize
+// live and recorded data.
+//
+//
+// Copyright (C) 2014-2016 Christian Pointner <equinox@spreadspace.org>
+// Markus Grüneis <gimpf@gimpf.org>
+//
+// This file is part of sfive.
+//
+// sfive is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 3
+// as published by the Free Software Foundation.
+//
+// sfive is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with sfive. If not, see <http://www.gnu.org/licenses/>.
+//
+
+package main
+
+import (
+ "encoding/json"
+ "os"
+ "time"
+)
+
+// TODO: this is basically a copy from src/hub....
+
+type StreamId struct {
+ ContentId string `json:"content-id"`
+ Format string `json:"format"`
+ Quality string `json:"quality"`
+}
+
+type ClientData struct {
+ Ip string `json:"ip"`
+ UserAgent string `json:"user-agent"`
+ BytesSent uint `json:"bytes-sent"`
+}
+
+type SourceData struct {
+ ClientCount uint `json:"client-count"`
+ BytesReceived uint `json:"bytes-received"`
+ BytesSent uint `json:"bytes-sent"`
+ Clients []ClientData `json:"clients,omitempty"`
+}
+
+type DataUpdate struct {
+ Version uint `json:"version"`
+ Hostname string `json:"hostname"`
+ StreamId StreamId `json:"streamer-id"`
+ Tags []string `json:"tags,omitempty"`
+ StartTime time.Time `json:"start-time"`
+ Duration int64 `json:"duration-ms"`
+ Data SourceData `json:"data"`
+}
+
+type Stats struct {
+ conf *Config
+}
+
+func NewStats(conf *Config) (s *Stats, err error) {
+ s = &Stats{conf: conf}
+ return
+}
+
+func (s *Stats) Run() (err error) {
+ update := DataUpdate{Version: 1, Hostname: "hugo"}
+ update.Tags = append(update.Tags, "hello", "world")
+ err = json.NewEncoder(os.Stdout).Encode(update)
+ return
+}