Skip to content

Commit

Permalink
Fix timestamps
Browse files Browse the repository at this point in the history
Signed-off-by: alexgreenbank <[email protected]>
  • Loading branch information
alexgreenbank committed Sep 3, 2024
1 parent 7f42dec commit a934e4a
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
package translator // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/datadogreceiver/internal/translator"

import (
"time"

"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1"
"go.opentelemetry.io/collector/pdata/pcommon"
"go.opentelemetry.io/collector/pdata/pmetric"
Expand Down Expand Up @@ -32,7 +34,7 @@ func (mt *MetricsTranslator) TranslateServices(services []ServiceCheck) pmetric.
dps.EnsureCapacity(1)

dp := dps.AppendEmpty()
dp.SetTimestamp(pcommon.Timestamp(ts * time.Second.Nanoseconds())) // OTel uses nanoseconds, while Datadog uses seconds
dp.SetTimestamp(pcommon.Timestamp(service.Timestamp * time.Second.Nanoseconds())) // OTel uses nanoseconds, while Datadog uses seconds
metricProperties.dpAttrs.CopyTo(dp.Attributes())
dp.SetIntValue(int64(service.Status))

Expand Down

0 comments on commit a934e4a

Please sign in to comment.