def _get_truncatable_str_object()

in opentelemetry-exporter-gcp-trace/src/opentelemetry/exporter/cloud_trace/__init__.py [0:0]


def _get_truncatable_str_object(str_to_convert: str, max_length: int):
    """Truncate the string if it exceeds the length limit and record the
    truncated bytes count."""
    truncated, truncated_byte_count = _truncate_str(str_to_convert, max_length)

    return trace_types.TruncatableString(
        value=truncated, truncated_byte_count=truncated_byte_count
    )