-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Particle Webhook Plugin #3477
Conversation
A Webhook Plugin for the Partricle.io platform
defer r.Body.Close() | ||
e := newEvent() | ||
if err := json.NewDecoder(r.Body).Decode(e); err != nil { | ||
log.Println(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use rb.acc.AddError(
here, which will log the message with a message about which plugin generated it and increment the error counter for the internal plugin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, sounds good.
pTime, err := e.Time() | ||
if err != nil { | ||
pTime = time.Now() | ||
log.Printf("error parsing particle event time: %s. Using telegraf host time instead: %s", e.PublishedAt, pTime) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would probably use AddError here too, unless you think it is better to not increment the gather error count.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error here can probably just be removed. It's not really an error, probably, so much as a "didn't work, but we can go on".
A Webhook Plugin for the Partricle.io platform
Required for all PRs: