Skip to content

[chore] Migrate to github.com/prometheus/otlptranslator#39827

Merged
songy23 merged 6 commits into
open-telemetry:mainfrom
ArthurSens:switch-translator-libraries-2
Jul 18, 2025
Merged

[chore] Migrate to github.com/prometheus/otlptranslator#39827
songy23 merged 6 commits into
open-telemetry:mainfrom
ArthurSens:switch-translator-libraries-2

Conversation

@ArthurSens
Copy link
Copy Markdown
Member

Description

This is an alternative for #39753, where we don't migrate the constants to the new library, but keep them closer to where they are used.

I apologize for pinging so many people in this PR, but I tried to migrate all components at once just to see how big/challenging it is to do the whole migration.

Pinging @aknuds1 and @ywwg as my fellow maintainer of prometheus/otlptranslators :)

I see that we're still lacking a few things, like BuildCompliantUnit with and without UTF-8 allowed. We also need to think about what to do with the Prometheus receiver (pinging fellow code owner @krajorama), which uses the old library to do the reverse conversion.

Link to tracking issue

Related to #39822

Copy link
Copy Markdown
Contributor

@aknuds1 aknuds1 left a comment

Choose a reason for hiding this comment

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

This is an alternative for #39753, where we don't migrate the constants to the new library, but keep them closer to where they are used.

Can you please explain why #39753 would depend on constants being moved to otlptranslator? I fail to see this being the case.

@ArthurSens
Copy link
Copy Markdown
Member Author

Can you please explain why #39753 would depend on constants being moved to otlptranslator? I fail to see this being the case.

It's not a requirement, it's an idea to avoid code duplication in the OTel collector. If we don't move it to otlptranslator, do you have any other suggestions?

@aknuds1
Copy link
Copy Markdown
Contributor

aknuds1 commented May 3, 2025

It's not a requirement, it's an idea to avoid code duplication in the OTel collector.

In that case, please explain how this PR is supposed to differ from #39753, because it's entirely unclear to me. #39753 doesn't do anything about constants.

@github-actions
Copy link
Copy Markdown
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions Bot added the Stale label May 18, 2025
@dashpole dashpole removed the Stale label May 28, 2025
@github-actions
Copy link
Copy Markdown
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions Bot added the Stale label Jun 12, 2025
@dashpole
Copy link
Copy Markdown
Contributor

@ArthurSens Do you need help picking this up?

@github-actions github-actions Bot removed the Stale label Jun 13, 2025
@ArthurSens ArthurSens requested a review from a team as a code owner July 11, 2025 11:45
@ArthurSens ArthurSens changed the title Migrate to github.com/prometheus/otlptranslator [chore] Migrate to github.com/prometheus/otlptranslator Jul 11, 2025
@ArthurSens
Copy link
Copy Markdown
Member Author

urgh, make crosslink is panicking for me 😕

@ArthurSens ArthurSens force-pushed the switch-translator-libraries-2 branch from 20c88d5 to 3fcf6d1 Compare July 15, 2025 18:11
Copy link
Copy Markdown
Contributor

@ywwg ywwg left a comment

Choose a reason for hiding this comment

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

looking great! My main worry is the overhead of creating all the new metricNamer objects -- are there places where it can be built once for many metrics? And do we have benchmarks we can run to see if it's actually a problem?

Comment thread exporter/prometheusexporter/collector.go Outdated
Comment thread pkg/translator/prometheusremotewrite/metrics_to_prw.go Outdated
Copy link
Copy Markdown
Contributor

@ywwg ywwg left a comment

Choose a reason for hiding this comment

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

looks great! Just one small nit

}

func newCollector(config *Config, logger *zap.Logger) *collector {
labelNamer := otlptranslator.LabelNamer{}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks like this one can also be inline in the return struct

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

it can't because we're using it to clean up the namespace 😬

@atoulme
Copy link
Copy Markdown
Contributor

atoulme commented Jul 16, 2025

@dashpole since you offered help earlier, would you please review and approve if the changes look ok?

@dashpole
Copy link
Copy Markdown
Contributor

great work!

Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
@ArthurSens ArthurSens force-pushed the switch-translator-libraries-2 branch from 30b7445 to ddf5413 Compare July 17, 2025 18:12
@ArthurSens ArthurSens added ready to merge Code review completed; ready to merge by maintainers and removed waiting-for-code-owners ready to merge Code review completed; ready to merge by maintainers labels Jul 17, 2025
Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
@ArthurSens ArthurSens added the ready to merge Code review completed; ready to merge by maintainers label Jul 17, 2025
@songy23 songy23 merged commit e6a4e78 into open-telemetry:main Jul 18, 2025
186 checks passed
@github-actions github-actions Bot added this to the next release milestone Jul 18, 2025
@ArthurSens ArthurSens deleted the switch-translator-libraries-2 branch July 18, 2025 13:50
Dylan-M pushed a commit to Dylan-M/opentelemetry-collector-contrib that referenced this pull request Aug 5, 2025
#### Description

Bumps the Prometheus library to the
commit(prometheus/prometheus@0502f2d)
that updates otlptranslator to the same version we need in
open-telemetry#39827

Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
Dylan-M pushed a commit to Dylan-M/opentelemetry-collector-contrib that referenced this pull request Aug 5, 2025
…ry#39827)

#### Description
This is an alternative for open-telemetry#39753, where we don't migrate the constants
to the new library, but keep them closer to where they are used.

I apologize for pinging so many people in this PR, but I tried to
migrate all components at once just to see how big/challenging it is to
do the whole migration.

Pinging @aknuds1 and @ywwg as my fellow maintainer of
prometheus/otlptranslators :)

I see that we're still lacking a few things, like BuildCompliantUnit
with and without UTF-8 allowed. We also need to think about what to do
with the Prometheus receiver (pinging fellow code owner @krajorama),
which uses the old library to do the reverse conversion.

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Related to
open-telemetry#39822

---------

Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
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.

8 participants