diff --git a/etc/script/notify.py b/etc/script/notify.py index e06c5fe8..bd240cbd 100755 --- a/etc/script/notify.py +++ b/etc/script/notify.py @@ -6,6 +6,9 @@ import urllib2 import smtplib from email.mime.text import MIMEText +reload(sys) +sys.setdefaultencoding('utf8') + notify_channel_funcs = { "email":"email", "sms":"sms", diff --git a/src/server/router/router_datadog.go b/src/server/router/router_datadog.go index 9c9f5565..996238c0 100644 --- a/src/server/router/router_datadog.go +++ b/src/server/router/router_datadog.go @@ -42,11 +42,11 @@ func (m *DatadogMetric) Clean() error { func (m *DatadogMetric) ToProm() (*prompb.TimeSeries, string, error) { pt := &prompb.TimeSeries{} - for _, point := range m.Points { + for i := 0; i < len(m.Points); i++ { pt.Samples = append(pt.Samples, prompb.Sample{ // use ms - Timestamp: int64(point[0]) * 1000, - Value: point[1], + Timestamp: int64(m.Points[i][0]) * 1000, + Value: m.Points[i][1], }) }