Skip to content

Rename metrics.proto to io_prometheus_client_metrics.proto#45

Merged
bwplotka merged 1 commit intomasterfrom
beorn7/naming
Jun 7, 2021
Merged

Rename metrics.proto to io_prometheus_client_metrics.proto#45
bwplotka merged 1 commit intomasterfrom
beorn7/naming

Conversation

@beorn7
Copy link
Copy Markdown
Member

@beorn7 beorn7 commented Jun 3, 2021

This should solve naming collision problems, apparently caused by
having a very generically named file directly in the root directory of
the repository.

Fixes #44 (which also provides more context).

@newhook does this solve the problem you ran into?

@bwplotka @kakkoyun please review as this repo is only used by prometheus/client_golang. I believe in the way I changed things here, client_golang shouldn't notice any difference.

@beorn7 beorn7 requested review from bwplotka and kakkoyun June 3, 2021 17:22
This should solve naming collision problems, apparently caused by
having a very generically named file directly in the root directory of
the repository.

Fixes #44 (which also provides more context).

Signed-off-by: beorn7 <beorn@grafana.com>
@newhook
Copy link
Copy Markdown

newhook commented Jun 3, 2021

I believe it will solve the issue. Thanks!

Copy link
Copy Markdown
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

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

Thanks, it's weird some systems depends on it, but no harm on our side. Never heard about the requirements for proto file name... Lgtm!

@bwplotka bwplotka merged commit 1f48c5c into master Jun 7, 2021
@bwplotka bwplotka deleted the beorn7/naming branch June 7, 2021 18:04
@bwplotka
Copy link
Copy Markdown
Member

bwplotka commented Jun 7, 2021

So I talked to people and looks like this might be technically a "breaking change" if someone imports this file directly (it copies that manually, use bazel etc), I think we might want to at least note it in the CHANGELOG.

image

Source: https://bufbuild.slack.com/archives/CRZ680FUH/p1623089122150800

cc @kakkoyun @beorn7

@bufdev
Copy link
Copy Markdown
Contributor

bufdev commented Jun 7, 2021

If you're going to do this, it would be way nicer to do this as io/prometheus/client/client.proto - then, if people have github.com/prometheus/client_model vendored, they could do import "io/prometheus/client/client.proto";, which is just as unlikely to cause a collision. https://docs.buf.build/lint-rules#file_layout

@bufdev
Copy link
Copy Markdown
Contributor

bufdev commented Jun 7, 2021

io/prometheus/client/metrics.proto would be fine as well - the general point being that the file is within a directory structure that matches the package (a rule that exists partially for the issues being seen here).

@beorn7
Copy link
Copy Markdown
Member Author

beorn7 commented Jun 7, 2021

I understood the conversation linked in #44 such that the file name itself must be unique, too. But I'll do whatever the protobuf experts agree on.

WRT CHANGELOG and breaking changes: There is no CHANGELOG. This repo isn't really versioned, and it is supposed to be used only by prometheus/client_golang and prometheus/pushgateway. I would be surprised if there is a relevant number of people importing the metrics.proto file. (I would actually be genuinely interested in their use case.)

@bufdev
Copy link
Copy Markdown
Contributor

bufdev commented Jun 7, 2021

The filename doesn't need to be unique, the path to it does. So io/prometheus/client/metrics.proto is just as "unique" as io_prometheus_client_metrics.proto, and is better for a host of other reasons as well.

@bwplotka
Copy link
Copy Markdown
Member

bwplotka commented Jun 7, 2021

Oh, thanks @beorn7 I somehow thought we are in client_golang space 🙈

The filename doesn't need to be unique, the path to it does. So io/prometheus/client/metrics.proto is just as "unique" as io_prometheus_client_metrics.proto, and is better for a host of other reasons as well.

right, so we could just change the path we store it in?

@bufdev
Copy link
Copy Markdown
Contributor

bufdev commented Jun 7, 2021

Everyone will be a lot happier if we just mkdir -p io/prometheus/client && mv io_prometheus_client_metrics.proto io/prometheus/client/metrics.proto - at Buf, we actually have an internal issue concerning this exact repo on this problem, as the current setup causes issues with Envoy

@bufdev
Copy link
Copy Markdown
Contributor

bufdev commented Jun 7, 2021

WRT CHANGELOG and breaking changes: There is no CHANGELOG. This repo isn't really versioned, and it is supposed to be used only by prometheus/client_golang and prometheus/pushgateway. I would be surprised if there is a relevant number of people importing the metrics.proto file. (I would actually be genuinely interested in their use case.)

Envoy imports this file in a ton of places

@beorn7
Copy link
Copy Markdown
Member Author

beorn7 commented Jun 7, 2021

@bufdev I'm just following instructions of others here. Could you create a PR for this repo, which we can then feed to those that told me I have to pick a unique name? We can then see what arguments they present, or if it all turns out to be a misunderstanding.

Envoy imports this file in a ton of places

Could you give me a tl;dr version why? Is this for Prometheus instrumentation without using an instrumentation library?

@bufdev
Copy link
Copy Markdown
Contributor

bufdev commented Jun 7, 2021

I put up #46 to try to help with this.

I don't work on the envoy team, but they have a lot of uses of this - just do a simple grep of metrics.proto in https://github.com/envoyproxy/envoy

@beorn7
Copy link
Copy Markdown
Member Author

beorn7 commented Jun 7, 2021

Interesting… they mostly seem to embed Prometheus metrics in other proto messages for their gRPC stuff.

And thanks for #46.

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.

rename metrics.proto

4 participants