Skip to content

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

@mplemay

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done ✔️

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions