|
| 1 | +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. |
| 2 | +# This product includes software developed at Datadog (https://www.datadoghq.com/). |
| 3 | +# Copyright 2019-Present Datadog, Inc. |
| 4 | +from __future__ import annotations |
| 5 | + |
| 6 | +from typing import List, Union, TYPE_CHECKING |
| 7 | + |
| 8 | +from datadog_api_client.model_utils import ( |
| 9 | + ModelNormal, |
| 10 | + cached_property, |
| 11 | + unset, |
| 12 | + UnsetType, |
| 13 | +) |
| 14 | + |
| 15 | + |
| 16 | +if TYPE_CHECKING: |
| 17 | + from datadog_api_client.v1.model.logs_span_remapper_type import LogsSpanRemapperType |
| 18 | + |
| 19 | + |
| 20 | +class LogsSpanRemapper(ModelNormal): |
| 21 | + @cached_property |
| 22 | + def openapi_types(_): |
| 23 | + from datadog_api_client.v1.model.logs_span_remapper_type import LogsSpanRemapperType |
| 24 | + |
| 25 | + return { |
| 26 | + "is_enabled": (bool,), |
| 27 | + "name": (str,), |
| 28 | + "sources": ([str],), |
| 29 | + "type": (LogsSpanRemapperType,), |
| 30 | + } |
| 31 | + |
| 32 | + attribute_map = { |
| 33 | + "is_enabled": "is_enabled", |
| 34 | + "name": "name", |
| 35 | + "sources": "sources", |
| 36 | + "type": "type", |
| 37 | + } |
| 38 | + |
| 39 | + def __init__( |
| 40 | + self_, |
| 41 | + type: LogsSpanRemapperType, |
| 42 | + is_enabled: Union[bool, UnsetType] = unset, |
| 43 | + name: Union[str, UnsetType] = unset, |
| 44 | + sources: Union[List[str], UnsetType] = unset, |
| 45 | + **kwargs, |
| 46 | + ): |
| 47 | + """ |
| 48 | + There are two ways to define correlation between application spans and logs: |
| 49 | +
|
| 50 | + #. |
| 51 | + Follow the documentation on `how to inject a span ID in the application logs <https://docs.datadoghq.com/tracing/connect_logs_and_traces>`_. |
| 52 | + Log integrations automatically handle all remaining setup steps by default. |
| 53 | +
|
| 54 | + #. |
| 55 | + Use the span remapper processor to define a log attribute as its associated span ID. |
| 56 | +
|
| 57 | + :param is_enabled: Whether or not the processor is enabled. |
| 58 | + :type is_enabled: bool, optional |
| 59 | +
|
| 60 | + :param name: Name of the processor. |
| 61 | + :type name: str, optional |
| 62 | +
|
| 63 | + :param sources: Array of source attributes. |
| 64 | + :type sources: [str], optional |
| 65 | +
|
| 66 | + :param type: Type of logs span remapper. |
| 67 | + :type type: LogsSpanRemapperType |
| 68 | + """ |
| 69 | + if is_enabled is not unset: |
| 70 | + kwargs["is_enabled"] = is_enabled |
| 71 | + if name is not unset: |
| 72 | + kwargs["name"] = name |
| 73 | + if sources is not unset: |
| 74 | + kwargs["sources"] = sources |
| 75 | + super().__init__(kwargs) |
| 76 | + |
| 77 | + self_.type = type |
0 commit comments