Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
telegraf-nftables
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
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
Due to inactivity, this project is scheduled to be deleted on 2035-04-24.
Why is this scheduled?
Show more breadcrumbs
vqgroup
telegraf-nftables
Commits
54c9ba76
Commit
54c9ba76
authored
8 years ago
by
Cameron Sparr
Browse files
Options
Downloads
Patches
Plain Diff
Update documentation for Gauge & Counters
parent
b18d375d
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
CONTRIBUTING.md
+10
-3
10 additions, 3 deletions
CONTRIBUTING.md
accumulator.go
+8
-4
8 additions, 4 deletions
accumulator.go
with
19 additions
and
7 deletions
CHANGELOG.md
+
1
−
0
View file @
54c9ba76
...
...
@@ -4,6 +4,7 @@
### Features
-
[
#1694
](
https://github.com/influxdata/telegraf/pull/1694
)
: Adding Gauge and Counter metric types.
-
[
#1606
](
https://github.com/influxdata/telegraf/pull/1606
)
: Remove carraige returns from exec plugin output on Windows
-
[
#1674
](
https://github.com/influxdata/telegraf/issues/1674
)
: elasticsearch input: configurable timeout.
-
[
#1607
](
https://github.com/influxdata/telegraf/pull/1607
)
: Massage metric names in Instrumental output plugin
...
...
This diff is collapsed.
Click to expand it.
CONTRIBUTING.md
+
10
−
3
View file @
54c9ba76
...
...
@@ -32,7 +32,7 @@ Assuming you can already build the project, run these in the telegraf directory:
1.
`go get github.com/sparrc/gdm`
1.
`gdm restore`
1.
`gdm save`
1.
`
GOOS=linux
gdm save`
## Input Plugins
...
...
@@ -84,9 +84,9 @@ func (s *Simple) SampleConfig() string {
func
(
s
*
Simple
)
Gather
(
acc
telegraf
.
Accumulator
)
error
{
if
s
.
Ok
{
acc
.
Add
(
"state"
,
"pretty good"
,
nil
)
acc
.
Add
Fields
(
"state"
,
map
[
string
]
interface
{}{
"value"
:
"pretty good"
}
,
nil
)
}
else
{
acc
.
Add
(
"state"
,
"not great"
,
nil
)
acc
.
Add
Fields
(
"state"
,
map
[
string
]
interface
{}{
"value"
:
"not great"
}
,
nil
)
}
return
nil
...
...
@@ -97,6 +97,13 @@ func init() {
}
```
## Adding Typed Metrics
In addition the the
`AddFields`
function, the accumulator also supports an
`AddGauge`
and
`AddCounter`
function. These functions are for adding _typed_
metrics. Metric types are ignored for the InfluxDB output, but can be used
for other outputs, such as
[
prometheus
](
https://prometheus.io/docs/concepts/metric_types/
)
.
## Input Plugins Accepting Arbitrary Data Formats
Some input plugins (such as
...
...
This diff is collapsed.
Click to expand it.
accumulator.go
+
8
−
4
View file @
54c9ba76
...
...
@@ -2,7 +2,13 @@ package telegraf
import
"time"
// Accumulator is an interface for "accumulating" metrics from input plugin(s).
// The metrics are sent down a channel shared between all input plugins and then
// flushed on the configured flush_interval.
type
Accumulator
interface
{
// AddFields adds a metric to the accumulator with the given measurement
// name, fields, and tags (and timestamp). If a timestamp is not provided,
// then the accumulator sets it to "now".
// Create a point with a value, decorating it with tags
// NOTE: tags is expected to be owned by the caller, don't mutate
// it after passing to Add.
...
...
@@ -11,15 +17,13 @@ type Accumulator interface {
tags
map
[
string
]
string
,
t
...
time
.
Time
)
// AddGauge is the same as AddFields, but will add the metric as a "Gauge"
// type
// AddGauge is the same as AddFields, but will add the metric as a "Gauge" type
AddGauge
(
measurement
string
,
fields
map
[
string
]
interface
{},
tags
map
[
string
]
string
,
t
...
time
.
Time
)
// AddCounter is the same as AddFields, but will add the metric as a "Counter"
// type
// AddCounter is the same as AddFields, but will add the metric as a "Counter" type
AddCounter
(
measurement
string
,
fields
map
[
string
]
interface
{},
tags
map
[
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