# This file was auto-generated by Fern from our API Definition.

import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ..core.serialization import FieldMetadata
from .otlp_attribute import OtlpAttribute
from .otlp_body_value import OtlpBodyValue


class OtlpLogRecord(UniversalBaseModel):
    """
    OTLP log record.

    The body field (message content) is limited to MAX_MESSAGE_LENGTH (64KB).
    Messages exceeding this limit are truncated with a "[TRUNCATED]" indicator.
    Attributes are limited to MAX_ATTRIBUTES_PER_LOG (32) per log record.
    """

    attributes: typing.Optional[typing.List[OtlpAttribute]] = None
    body: typing.Optional[OtlpBodyValue] = None
    severity_number: typing_extensions.Annotated[
        typing.Optional[int], FieldMetadata(alias="severityNumber"), pydantic.Field(alias="severityNumber")
    ] = None
    severity_text: typing_extensions.Annotated[
        typing.Optional[str], FieldMetadata(alias="severityText"), pydantic.Field(alias="severityText")
    ] = None
    span_id: typing_extensions.Annotated[
        typing.Optional[str], FieldMetadata(alias="spanId"), pydantic.Field(alias="spanId")
    ] = None
    time_unix_nano: typing_extensions.Annotated[
        typing.Optional[str], FieldMetadata(alias="timeUnixNano"), pydantic.Field(alias="timeUnixNano")
    ] = None
    trace_id: typing_extensions.Annotated[
        typing.Optional[str], FieldMetadata(alias="traceId"), pydantic.Field(alias="traceId")
    ] = None

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
