Skip to content

warning: Invalid type NoneType for attribute 'http.port' value #430

Closed

Description

@mplemay

When logging request information, the http.port should only be set if url.port is not None.


Currently, if the http.port is None, opentelemetry produces the following warning:

Invalid type NoneType for attribute 'http.port' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types

based on this line of code:
https://github.com/open-telemetry/opentelemetry-python/blob/29aad2efa30a35757ea78d90e4d3fd517bc00468/opentelemetry-api/src/opentelemetry/attributes/__init__.py#L100

See pydantic/logfire#749 for more details.

Activity

  1. moved this to Needs Triage 🔍 in Kiotaon Dec 30, 2024
  2. Kludex commented on Dec 30, 2024

    @Kludex

    I'm not sure the cases on which http.port is not set, but yeah, if there's a chance 'http.port' is None, then it should only be set in the OTel attributes when is not None.

  3. andrueastman commented on Jan 2, 2025

    @andrueastman
    Contributor

    Thanks for raising this Matt LeMay (@mplemay)

    Any chance you'd be willing to submit a PR to fix this?

  4. moved this from Needs Triage 🔍 to New📃 in Kiotaon Jan 2, 2025
  5. added
    type:bug
    status:waiting-for-author-feedback
    help wanted
    on Jan 2, 2025
  6. mplemay commented on Jan 2, 2025

    @mplemay
    ContributorAuthor

    Any chance you'd be willing to submit a PR to fix this?

    The above PR should fix this issue.

  7. added and removed
    status:waiting-for-author-feedback
    on Jan 2, 2025
  8. moved this from New📃 to Done ✔️ in Kiotaon Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Attention 👋WIPhelp wantedtype:bug

    Type

    No type

    Projects

    • Status
      Done ✔️

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions