handle python2 encoding
This commit is contained in:
parent
a56d6b568b
commit
e9ce679649
|
@ -6,6 +6,9 @@ import urllib2
|
||||||
import smtplib
|
import smtplib
|
||||||
from email.mime.text import MIMEText
|
from email.mime.text import MIMEText
|
||||||
|
|
||||||
|
reload(sys)
|
||||||
|
sys.setdefaultencoding('utf8')
|
||||||
|
|
||||||
notify_channel_funcs = {
|
notify_channel_funcs = {
|
||||||
"email":"email",
|
"email":"email",
|
||||||
"sms":"sms",
|
"sms":"sms",
|
||||||
|
|
|
@ -42,11 +42,11 @@ func (m *DatadogMetric) Clean() error {
|
||||||
|
|
||||||
func (m *DatadogMetric) ToProm() (*prompb.TimeSeries, string, error) {
|
func (m *DatadogMetric) ToProm() (*prompb.TimeSeries, string, error) {
|
||||||
pt := &prompb.TimeSeries{}
|
pt := &prompb.TimeSeries{}
|
||||||
for _, point := range m.Points {
|
for i := 0; i < len(m.Points); i++ {
|
||||||
pt.Samples = append(pt.Samples, prompb.Sample{
|
pt.Samples = append(pt.Samples, prompb.Sample{
|
||||||
// use ms
|
// use ms
|
||||||
Timestamp: int64(point[0]) * 1000,
|
Timestamp: int64(m.Points[i][0]) * 1000,
|
||||||
Value: point[1],
|
Value: m.Points[i][1],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue