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
cf568487
Commit
cf568487
authored
9 years ago
by
Wu Taizeng
Committed by
Cameron Sparr
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix some inputs panic will lead to the telegraf exit
closes #585 closes #584
parent
47ea2d5f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
agent.go
+16
-0
16 additions, 0 deletions
agent.go
with
17 additions
and
0 deletions
CHANGELOG.md
+
1
−
0
View file @
cf568487
...
@@ -40,6 +40,7 @@ specifying a docker endpoint to get metrics from.
...
@@ -40,6 +40,7 @@ specifying a docker endpoint to get metrics from.
-
[
#440
](
https://github.com/influxdata/telegraf/issues/440
)
: Don't query filtered devices for disk stats.
-
[
#440
](
https://github.com/influxdata/telegraf/issues/440
)
: Don't query filtered devices for disk stats.
-
[
#463
](
https://github.com/influxdata/telegraf/issues/463
)
: Docker plugin not working on AWS Linux
-
[
#463
](
https://github.com/influxdata/telegraf/issues/463
)
: Docker plugin not working on AWS Linux
-
[
#568
](
https://github.com/influxdata/telegraf/issues/568
)
: Multiple output race condition.
-
[
#568
](
https://github.com/influxdata/telegraf/issues/568
)
: Multiple output race condition.
-
[
#585
](
https://github.com/influxdata/telegraf/pull/585
)
: Log stack trace and continue on Telegraf panic. Thanks @wutaizeng!
## v0.10.0 [2016-01-12]
## v0.10.0 [2016-01-12]
...
...
This diff is collapsed.
Click to expand it.
agent.go
+
16
−
0
View file @
cf568487
...
@@ -7,6 +7,7 @@ import (
...
@@ -7,6 +7,7 @@ import (
"math/big"
"math/big"
"math/rand"
"math/rand"
"os"
"os"
"runtime"
"sync"
"sync"
"time"
"time"
...
@@ -87,6 +88,18 @@ func (a *Agent) Close() error {
...
@@ -87,6 +88,18 @@ func (a *Agent) Close() error {
return
err
return
err
}
}
func
panicRecover
(
input
*
models
.
RunningInput
)
{
if
err
:=
recover
();
err
!=
nil
{
trace
:=
make
([]
byte
,
2048
)
runtime
.
Stack
(
trace
,
true
)
log
.
Printf
(
"FATAL: Input [%s] panicked: %s, Stack:
\n
%s
\n
"
,
input
.
Name
,
err
,
trace
)
log
.
Println
(
"PLEASE REPORT THIS PANIC ON GITHUB with "
+
"stack trace, configuration, and OS information: "
+
"https://github.com/influxdata/telegraf/issues/new"
)
}
}
// gatherParallel runs the inputs that are using the same reporting interval
// gatherParallel runs the inputs that are using the same reporting interval
// as the telegraf agent.
// as the telegraf agent.
func
(
a
*
Agent
)
gatherParallel
(
pointChan
chan
*
client
.
Point
)
error
{
func
(
a
*
Agent
)
gatherParallel
(
pointChan
chan
*
client
.
Point
)
error
{
...
@@ -103,6 +116,7 @@ func (a *Agent) gatherParallel(pointChan chan *client.Point) error {
...
@@ -103,6 +116,7 @@ func (a *Agent) gatherParallel(pointChan chan *client.Point) error {
wg
.
Add
(
1
)
wg
.
Add
(
1
)
counter
++
counter
++
go
func
(
input
*
models
.
RunningInput
)
{
go
func
(
input
*
models
.
RunningInput
)
{
defer
panicRecover
(
input
)
defer
wg
.
Done
()
defer
wg
.
Done
()
acc
:=
NewAccumulator
(
input
.
Config
,
pointChan
)
acc
:=
NewAccumulator
(
input
.
Config
,
pointChan
)
...
@@ -148,6 +162,8 @@ func (a *Agent) gatherSeparate(
...
@@ -148,6 +162,8 @@ func (a *Agent) gatherSeparate(
input
*
models
.
RunningInput
,
input
*
models
.
RunningInput
,
pointChan
chan
*
client
.
Point
,
pointChan
chan
*
client
.
Point
,
)
error
{
)
error
{
defer
panicRecover
(
input
)
ticker
:=
time
.
NewTicker
(
input
.
Config
.
Interval
)
ticker
:=
time
.
NewTicker
(
input
.
Config
.
Interval
)
for
{
for
{
...
...
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