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

prom-to-sd: Prefer proto in content type #739

Merged
merged 2 commits into from
Jul 17, 2024

Conversation

linxiulei
Copy link
Contributor

Also add support for multiple response formats (text/proto)

@linxiulei linxiulei force-pushed the pb branch 2 times, most recently from a998b5f to 8fcca67 Compare July 15, 2024 15:08
@CatherineF-dev
Copy link
Contributor

cc @leonzz to have a review as well

@CatherineF-dev
Copy link
Contributor

/lgtm

@@ -375,6 +377,11 @@ func convertToDistributionValue(h *dto.Histogram) *v3.Distribution {
prevVal = b.GetCumulativeCount()
}

// +Inf Bucket is implicit so it needs to be added
if !infSeen && count > int64(prevVal) {
Copy link

Choose a reason for hiding this comment

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

looks like this is addressing a different issue, could you add some background in the PR description?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's not a different issue because the +inf bucket is omitted in protobuf encoding but text encoding handles that specially (see https://github.com/prometheus/common/blob/main/expfmt/text_create.go#L232 if interested). However, it makes sense to separate the changes with description, for which I split the changes into 2 commits to make it clear.

Copy link

Choose a reason for hiding this comment

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

Thanks! LGTM-)

Prometheus allows optional +Inf bucket and adds it in text encoding
(see https://github.com/prometheus/common/blob/main/expfmt/text_create.go#L232).
Google cloud monitoring requires +Inf explicitly if there are any data
point in +Inf bucket. So we need to add +Inf bucket in conversion when
needed.
Also add support for multiple response formats (text/proto)
@CatherineF-dev
Copy link
Contributor

Will merge. Have discussed offline that the release flow will be expected.

@CatherineF-dev CatherineF-dev merged commit 1324844 into GoogleCloudPlatform:master Jul 17, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants