Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Sets the current time as the advertised time in the returned metric when using grpc.
  • Loading branch information
jcooklin committed Aug 2, 2016
1 parent 8f40854 commit 04122e6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
4 changes: 2 additions & 2 deletions grpc/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ func ToMetric(co core.Metric) *Metric {
Nsec: int64(co.Timestamp().Nanosecond()),
},
LastAdvertisedTime: &Time{
Sec: co.LastAdvertisedTime().Unix(),
Nsec: int64(co.Timestamp().Nanosecond()),
Sec: time.Now().Unix(),
Nsec: int64(time.Now().Nanosecond()),
},
}
if co.Config() != nil {
Expand Down
24 changes: 22 additions & 2 deletions scheduler/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,17 @@ func (p *processJob) Run() {
p.AddErrors(fmt.Errorf("unsupported metric type. {%v}", m))
}
}
enc.Encode(metrics)
err := enc.Encode(metrics)
if err != nil {
log.WithFields(log.Fields{
"_module": "scheduler-job",
"block": "run",
"job-type": "processor",
"plugin-name": p.name,
"plugin-version": p.version,
"error": err,
}).Error("encoding error")
}
_, content, errs := p.processor.ProcessMetrics(p.contentType, buf.Bytes(), p.name, p.version, p.config, p.taskID)
if errs != nil {
for _, e := range errs {
Expand Down Expand Up @@ -467,7 +477,17 @@ func (p *publisherJob) Run() {
panic(fmt.Sprintf("unsupported type %T", mt))
}
}
enc.Encode(metrics)
err := enc.Encode(metrics)
if err != nil {
log.WithFields(log.Fields{
"_module": "scheduler-job",
"block": "run",
"job-type": "publisher",
"plugin-name": p.name,
"plugin-version": p.version,
"error": err,
}).Error("encoding error")
}
errs := p.publisher.PublishMetrics(p.contentType, buf.Bytes(), p.name, p.version, p.config, p.taskID)
if errs != nil {
for _, e := range errs {
Expand Down

0 comments on commit 04122e6

Please sign in to comment.