0.3.0: mailchimp & memcached

This commit is contained in:
Cameron Sparr 2015-12-14 17:17:59 -06:00
parent 9fce094b36
commit e3b314cacb
3 changed files with 37 additions and 32 deletions

View File

@ -173,7 +173,7 @@ func (l *Lustre2) GetLustreProcStats(fileglob string, wanted_fields []*mapping,
} }
} }
} }
acc.AddFields("lustre2", fields) acc.AddFields("lustre2", fields, tags)
} }
return nil return nil
} }

View File

@ -75,35 +75,38 @@ func gatherReport(acc plugins.Accumulator, report Report, now time.Time) {
tags := make(map[string]string) tags := make(map[string]string)
tags["id"] = report.ID tags["id"] = report.ID
tags["campaign_title"] = report.CampaignTitle tags["campaign_title"] = report.CampaignTitle
acc.Add("emails_sent", report.EmailsSent, tags, now) fields := map[string]interface{}{
acc.Add("abuse_reports", report.AbuseReports, tags, now) "emails_sent": report.EmailsSent,
acc.Add("unsubscribed", report.Unsubscribed, tags, now) "abuse_reports": report.AbuseReports,
acc.Add("hard_bounces", report.Bounces.HardBounces, tags, now) "unsubscribed": report.Unsubscribed,
acc.Add("soft_bounces", report.Bounces.SoftBounces, tags, now) "hard_bounces": report.Bounces.HardBounces,
acc.Add("syntax_errors", report.Bounces.SyntaxErrors, tags, now) "soft_bounces": report.Bounces.SoftBounces,
acc.Add("forwards_count", report.Forwards.ForwardsCount, tags, now) "syntax_errors": report.Bounces.SyntaxErrors,
acc.Add("forwards_opens", report.Forwards.ForwardsOpens, tags, now) "forwards_count": report.Forwards.ForwardsCount,
acc.Add("opens_total", report.Opens.OpensTotal, tags, now) "forwards_opens": report.Forwards.ForwardsOpens,
acc.Add("unique_opens", report.Opens.UniqueOpens, tags, now) "opens_total": report.Opens.OpensTotal,
acc.Add("open_rate", report.Opens.OpenRate, tags, now) "unique_opens": report.Opens.UniqueOpens,
acc.Add("clicks_total", report.Clicks.ClicksTotal, tags, now) "open_rate": report.Opens.OpenRate,
acc.Add("unique_clicks", report.Clicks.UniqueClicks, tags, now) "clicks_total": report.Clicks.ClicksTotal,
acc.Add("unique_subscriber_clicks", report.Clicks.UniqueSubscriberClicks, tags, now) "unique_clicks": report.Clicks.UniqueClicks,
acc.Add("click_rate", report.Clicks.ClickRate, tags, now) "unique_subscriber_clicks": report.Clicks.UniqueSubscriberClicks,
acc.Add("facebook_recipient_likes", report.FacebookLikes.RecipientLikes, tags, now) "click_rate": report.Clicks.ClickRate,
acc.Add("facebook_unique_likes", report.FacebookLikes.UniqueLikes, tags, now) "facebook_recipient_likes": report.FacebookLikes.RecipientLikes,
acc.Add("facebook_likes", report.FacebookLikes.FacebookLikes, tags, now) "facebook_unique_likes": report.FacebookLikes.UniqueLikes,
acc.Add("industry_type", report.IndustryStats.Type, tags, now) "facebook_likes": report.FacebookLikes.FacebookLikes,
acc.Add("industry_open_rate", report.IndustryStats.OpenRate, tags, now) "industry_type": report.IndustryStats.Type,
acc.Add("industry_click_rate", report.IndustryStats.ClickRate, tags, now) "industry_open_rate": report.IndustryStats.OpenRate,
acc.Add("industry_bounce_rate", report.IndustryStats.BounceRate, tags, now) "industry_click_rate": report.IndustryStats.ClickRate,
acc.Add("industry_unopen_rate", report.IndustryStats.UnopenRate, tags, now) "industry_bounce_rate": report.IndustryStats.BounceRate,
acc.Add("industry_unsub_rate", report.IndustryStats.UnsubRate, tags, now) "industry_unopen_rate": report.IndustryStats.UnopenRate,
acc.Add("industry_abuse_rate", report.IndustryStats.AbuseRate, tags, now) "industry_unsub_rate": report.IndustryStats.UnsubRate,
acc.Add("list_stats_sub_rate", report.ListStats.SubRate, tags, now) "industry_abuse_rate": report.IndustryStats.AbuseRate,
acc.Add("list_stats_unsub_rate", report.ListStats.UnsubRate, tags, now) "list_stats_sub_rate": report.ListStats.SubRate,
acc.Add("list_stats_open_rate", report.ListStats.OpenRate, tags, now) "list_stats_unsub_rate": report.ListStats.UnsubRate,
acc.Add("list_stats_click_rate", report.ListStats.ClickRate, tags, now) "list_stats_open_rate": report.ListStats.OpenRate,
"list_stats_click_rate": report.ListStats.ClickRate,
}
acc.AddFields("mailchimp", fields, tags, now)
} }
func init() { func init() {

View File

@ -137,16 +137,18 @@ func (m *Memcached) gatherServer(
tags := map[string]string{"server": address} tags := map[string]string{"server": address}
// Process values // Process values
fields := make(map[string]interface{})
for _, key := range sendMetrics { for _, key := range sendMetrics {
if value, ok := values[key]; ok { if value, ok := values[key]; ok {
// Mostly it is the number // Mostly it is the number
if iValue, errParse := strconv.ParseInt(value, 10, 64); errParse != nil { if iValue, errParse := strconv.ParseInt(value, 10, 64); errParse != nil {
acc.Add(key, value, tags) fields[key] = iValue
} else { } else {
acc.Add(key, iValue, tags) fields[key] = value
} }
} }
} }
acc.AddFields("memcached", fields, tags)
return nil return nil
} }