Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gostatsd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ale
gostatsd
Commits
69e8200c
Commit
69e8200c
authored
12 years ago
by
Kamil Kisiel
Browse files
Options
Downloads
Patches
Plain Diff
Added package and metric object docs
parent
c94b38cb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
statsd/doc.go
+17
-0
17 additions, 0 deletions
statsd/doc.go
statsd/metrics.go
+9
-4
9 additions, 4 deletions
statsd/metrics.go
with
26 additions
and
4 deletions
statsd/doc.go
0 → 100644
+
17
−
0
View file @
69e8200c
/*
Package statsd implements functionality for creating servers compatible with the statsd protocol.
See https://github.com/b/statsd_spec for a description of the protocol.
The main components of the library are MetricReceiver and MetricAggregator,
which are responsible for receiving and aggregating the metrics respectively.
MetricAggregator receives Metric objects via its MetricChan and then aggregates
them based on their type. At every FlushInterval the metrics are flushed via
the aggregator's associated MetricSender object.
Currently the library implements just one type MetricSender, compatible with Graphite
(http://graphite.wikidot.org), but any object implementing the MetricSender
interface can be used with the library.
*/
package
statsd
This diff is collapsed.
Click to expand it.
statsd/metrics.go
+
9
−
4
View file @
69e8200c
...
...
@@ -5,9 +5,9 @@ import (
"fmt"
)
// MetricType is an enumeration of all the possible types of Metric
type
MetricType
float64
// Enumeration, see http://golang.org/doc/effective_go.html#constants
const
(
_
=
iota
ERROR
MetricType
=
1
<<
(
10
*
iota
)
...
...
@@ -28,16 +28,19 @@ func (m MetricType) String() string {
return
"unknown"
}
// Metric represents a single data collected datapoint
type
Metric
struct
{
Type
MetricType
Bucket
string
Value
float64
Type
MetricType
// The type of metric
Bucket
string
// The name of the bucket where the metric belongs
Value
float64
// The numeric value of the metric
}
func
(
m
Metric
)
String
()
string
{
return
fmt
.
Sprintf
(
"{%s, %s, %f}"
,
m
.
Type
,
m
.
Bucket
,
m
.
Value
)
}
// MetricMap is used for storing aggregated Metric values.
// The keys of the map are metric bucket names.
type
MetricMap
map
[
string
]
float64
func
(
m
MetricMap
)
String
()
string
{
...
...
@@ -48,6 +51,8 @@ func (m MetricMap) String() string {
return
buf
.
String
()
}
// MetricListMap is simlar to MetricMap but instead of storing a single aggregated
// Metric value it stores a list of all collected values.
type
MetricListMap
map
[
string
][]
float64
func
(
m
MetricListMap
)
String
()
string
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment