Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OTLP: Convert start timestamps to Prom created timestamps #9131

Merged
merged 4 commits into from
Sep 2, 2024

Conversation

aknuds1
Copy link
Contributor

@aknuds1 aknuds1 commented Aug 29, 2024

What this PR does

In the OTLP endpoint, support converting OTel data point start timestamps to Mimir zero samples 1 millisecond before the sample itself, iff the following are true:

  • The OTel start timestamp is greater than zero and equal to the data point timestamp

Includes grafana/mimir-prometheus#684.

Which issue(s) this PR fixes or relates to

Checklist

  • Tests updated.
  • Documentation added.
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX].
  • about-versioning.md updated with experimental features.

@aknuds1 aknuds1 added area/opentelemetry enhancement New feature or request labels Aug 29, 2024
@aknuds1 aknuds1 force-pushed the arve/otlp-starttime branch 4 times, most recently from afc98c1 to cb93c3e Compare August 29, 2024 16:05
@aknuds1 aknuds1 changed the title WIP: OTLP: Convert start timestamps to Prom created timestamps OTLP: Convert start timestamps to Prom created timestamps Aug 29, 2024
aknuds1 and others added 3 commits August 30, 2024 17:29
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: Jesus Vazquez <jesus.vazquez@grafana.com>
@jesusvazquez
Copy link
Member

This PR includes the latest changes from Mimir Prometheus so I'm waiting on #9148 before moving forward.

Comment on lines +84 to +85
- Enable conversion of OTel start timestamps to Prometheus zero samples to mark series start
- `-distributor.otel-created-timestamp-zero-ingestion-enabled`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In OTel it is called StartTimeUnixNano, should we call this flag -distributor.otel-starttimeunixnano-zero-ingestion-enabled?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a point of reference, the OTel SDK calls it StartTimestamp. Do you gain anything from including the unixnano suffix? Technically, Prometheus created timestamps are in milliseconds, but there's no point in including that kind of detail when referring to them, is there?

I guess it might make sense to refer to "start timestamps" in this flag rather than "created timestamps", since you're converting the former. My original thinking, OTOH, was to refer to support for created timestamps via zero samples (since zero samples are a way to represent created timestamps) in the OTLP endpoint.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a point of reference, the OTel SDK calls it StartTimestamp. Do you gain anything from including the unixnano suffix?

No, you have a good point to not add unixnano!

I guess it might make sense to refer to "start timestamps" in this flag rather than "created timestamps", since you're converting the former. My original thinking, OTOH, was to refer to support for created timestamps via zero samples (since zero samples are a way to represent created timestamps) in the OTLP endpoint.

I don't have a strong preference, I was just thinking that people coming from OTel might not understand this flag. Quite unfortunate that OpenMetrics and OTel are using different names here :/

Copy link
Contributor Author

@aknuds1 aknuds1 Sep 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I guess you've got a point. Maybe e.g. -otel-start-time-zero-ingestion-enabled (same as yours, without "unixnano")?

# Conflicts:
#	go.mod
#	go.sum
#	pkg/distributor/otel.go
#	vendor/github.com/prometheus/prometheus/storage/remote/write_handler.go
#	vendor/modules.txt
Comment on lines 283 to 285
// client_golang v1.20.0 has some bugs https://github.com/prometheus/client_golang/issues/1605, https://github.com/prometheus/client_golang/issues/1607
// Stick to v1.19.1 until they are fixed.
replace github.com/prometheus/client_golang => github.com/prometheus/client_golang v1.19.1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taking a look at them right now!

Copy link
Member

@jesusvazquez jesusvazquez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@aknuds1 aknuds1 marked this pull request as ready for review September 2, 2024 13:05
Copy link
Contributor

@krajorama krajorama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@krajorama krajorama merged commit b58a08b into main Sep 2, 2024
29 checks passed
@krajorama krajorama deleted the arve/otlp-starttime branch September 2, 2024 13:07
grafanabot pushed a commit that referenced this pull request Sep 2, 2024
* OTLP: Convert start timestamps to Mimir created timestamps

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* bump to latest mimir-prometheus

Signed-off-by: Jesus Vazquez <jesus.vazquez@grafana.com>

* make use of annotations

---------

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: Jesus Vazquez <jesus.vazquez@grafana.com>
Co-authored-by: Jesus Vazquez <jesus.vazquez@grafana.com>
Co-authored-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
(cherry picked from commit b58a08b)
krajorama pushed a commit that referenced this pull request Sep 2, 2024
)

* OTLP: Convert start timestamps to Mimir created timestamps

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* bump to latest mimir-prometheus

Signed-off-by: Jesus Vazquez <jesus.vazquez@grafana.com>

* make use of annotations

---------

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: Jesus Vazquez <jesus.vazquez@grafana.com>
Co-authored-by: Jesus Vazquez <jesus.vazquez@grafana.com>
Co-authored-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
(cherry picked from commit b58a08b)

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
krajorama added a commit that referenced this pull request Sep 3, 2024
krajorama added a commit that referenced this pull request Sep 3, 2024
@grafanabot
Copy link
Contributor

The backport to r306 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new branch
git switch --create backport-9131-to-r306 origin/r306
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x b58a08b17fbe7a53d59ca48995e57e38b893417e
# Push it to GitHub
git push --set-upstream origin backport-9131-to-r306
git switch main
# Remove the local backport branch
git branch -D backport-9131-to-r306

Then, create a pull request where the base branch is r306 and the compare/head branch is backport-9131-to-r306.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants