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

Python: fix module mappings for opentelemetry libs. #20705

Merged
merged 1 commit into from
Mar 24, 2024
Merged

Conversation

kaos
Copy link
Member

@kaos kaos commented Mar 22, 2024

No description provided.

@kaos kaos added the category:internal CI, fixes for not-yet-released features, etc. label Mar 22, 2024
@kaos kaos requested a review from benjyw March 22, 2024 13:42
Comment on lines -162 to -164
"opentelemetry-exporter-otlp": ("opentelemetry.exporter",),
"opentelemetry-exporter-otlp-proto-grpc": ("opentelemetry.exporter.otlp.proto.grpc",),
"opentelemetry-exporter-otlp-proto-http": ("opentelemetry.exporter.otlp.proto.http",),
Copy link
Member Author

Choose a reason for hiding this comment

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

removed these 3, as they map 1:1 with a simple s/-/./g (the first one was incorrect.. missing the final .otlp part)

Copy link
Contributor

Choose a reason for hiding this comment

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

Btw - the default replacement is s/-/_/g, so these break now. We should add these back.

pants.backend.python.dependency_inference.rules.UnownedDependencyError: Pants cannot infer owners for the following imports in the target <redacted>:

  * opentelemetry.exporter.otlp.proto.http.trace_exporter.OTLPSpanExporter (line: 6)
  * opentelemetry.sdk.resources.Resource (line: 11)
  * opentelemetry.sdk.resources.SERVICE_NAME (line: 11)
  * opentelemetry.sdk.trace.TracerProvider (line: 12)
  * opentelemetry.sdk.trace.export.BatchSpanProcessor (line: 14)
  * opentelemetry.sdk.trace.export.ConsoleSpanExporter (line: 15)
  * opentelemetry.sdk.trace.export.SpanExporter (line: 16)

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, good catch. Hopefully fixes in #20749

Copy link
Member Author

Choose a reason for hiding this comment

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

doh 🤦🏽

@@ -158,22 +158,18 @@ def two_groups_hyphens_two_replacements_with_suffix(
"opencv-python-headless": ("cv2",),
"opensearch-py": ("opensearchpy",),
# opentelemetry
"opentelemetry-api": ("opentelemetry",),
Copy link
Member Author

Choose a reason for hiding this comment

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

This one is bogus. opentelemetry is a namespace. The list of modules attributed to opentelemetry-sdk actually belongs to opentelemetry-api, according to the docs linked to from #20551 (so was a mistake to begin with.)

Copy link
Contributor

Choose a reason for hiding this comment

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

My bad, messed that up

"opentelemetry-exporter-otlp-proto-grpc": ("opentelemetry.exporter.otlp.proto.grpc",),
"opentelemetry-exporter-otlp-proto-http": ("opentelemetry.exporter.otlp.proto.http",),
"opentelemetry-instrumentation-kafka-python": ("opentelemetry.instrumentation.kafka",),
"opentelemetry-sdk": (
Copy link
Member Author

Choose a reason for hiding this comment

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

Also 1:1, so no need for a module mapping for it..

@kaos kaos added this to the 2.20.x milestone Mar 22, 2024
@kaos
Copy link
Member Author

kaos commented Mar 22, 2024

Given that these where introduced in 2.20.0a0, I think we'd like to pick them so the correct mappings can be included in the stable release..

@huonw huonw merged commit 8667c82 into main Mar 24, 2024
24 checks passed
@huonw huonw deleted the kaos/module-mappings branch March 24, 2024 01:18
@WorkerPants
Copy link
Member

I tried to automatically cherry-pick this change back to each relevant milestone, so that it is available in those older releases of Pants.

✔️ 2.20.x

Successfully opened #20713.


Thanks again for your contributions!

🤖 Beep Boop here's my run link

huonw pushed a commit that referenced this pull request Mar 25, 2024
huonw added a commit that referenced this pull request Apr 4, 2024
Several of mappings for opentelemetry packages were added/adjusted in
#20551 and then adjusted more in #20705, but the second adjustment was
based on the default fallback mapping replacing `-` with `.`, but it
actually replaces them with `_`. This restores explicit mappings for the
following (where I've downloaded the wheels and verified their
contents):

- `opentelemetry-exporter-otlp`
- `opentelemetry-exporter-otlp-proto-grpc`
- `opentelemetry-exporter-otlp-proto-http`
- `opentelemetry-sdk`

These were originally added in #16337, released in 2.14.0, so this would
be a notable regression if we released 2.20.0 without them.

Noticed in
#20705 (comment)
WorkerPants pushed a commit that referenced this pull request Apr 4, 2024
Several of mappings for opentelemetry packages were added/adjusted in
#20551 and then adjusted more in #20705, but the second adjustment was
based on the default fallback mapping replacing `-` with `.`, but it
actually replaces them with `_`. This restores explicit mappings for the
following (where I've downloaded the wheels and verified their
contents):

- `opentelemetry-exporter-otlp`
- `opentelemetry-exporter-otlp-proto-grpc`
- `opentelemetry-exporter-otlp-proto-http`
- `opentelemetry-sdk`

These were originally added in #16337, released in 2.14.0, so this would
be a notable regression if we released 2.20.0 without them.

Noticed in
#20705 (comment)
huonw added a commit that referenced this pull request Apr 4, 2024
…20753)

Several of mappings for opentelemetry packages were added/adjusted in
#20551 and then adjusted more in #20705, but the second adjustment was
based on the default fallback mapping replacing `-` with `.`, but it
actually replaces them with `_`. This restores explicit mappings for the
following (where I've downloaded the wheels and verified their
contents):

- `opentelemetry-exporter-otlp`
- `opentelemetry-exporter-otlp-proto-grpc`
- `opentelemetry-exporter-otlp-proto-http`
- `opentelemetry-sdk`

These were originally added in #16337, released in 2.14.0, so this would
be a notable regression if we released 2.20.0 without them.

Noticed in
#20705 (comment)

Co-authored-by: Huon Wilson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:internal CI, fixes for not-yet-released features, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants