Skip to content

prometheusreceiver: Append.*CTZeroSample methods don't covert milliseconds to seconds #39912

Closed
@ridwanmsharif

Description

@ridwanmsharif

Component(s)

receiver/prometheus

What happened?

Description

When being called Append.*CTZeroSample is called with ctMs in milliseconds.

This inturn calls addCreationTimestamp in milliseconds. But that assumes and sets mg.created as though it is called with seconds.

This causes the resulting metrics to have wildly incorrect start times when it is set here:

point.SetStartTimestamp(timestampFromFloat64(mg.created))

since no conversion is done.

This was introduced in this PR: #36660

And this bug was present ever since.

Steps to Reproduce

scrape metrics that have the _created metrics and see if the start time is set appropriately when converted to OTLP

Steps to fix

I'll be sending a PR that makes sure that when mg.created is set, it is set in seconds as expected here: https://github.com/prometheus/OpenMetrics/blob/main/specification/OpenMetrics.md#counter

Collector version

0.120.0 to latest

Environment information

Environment

OS: (e.g., "Ubuntu 20.04")
Compiler(if manually compiled): (e.g., "go 14.2")

OpenTelemetry Collector configuration

Log output

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions