Skip to content

Add decoder processor to public api #2703

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .generated-info
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"spec_repo_commit": "04d09cb",
"generated": "2025-07-23 09:22:38.369"
"spec_repo_commit": "4727afe",
"generated": "2025-07-23 15:37:01.942"
}
67 changes: 67 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5547,6 +5547,72 @@ components:
type: string
x-enum-varnames:
- DATE_REMAPPER
LogsDecoderProcessor:
description: 'The decoder processor decodes any source attribute containing
a

base64/base16-encoded UTF-8/ASCII string back to its original value, storing
the

result in a target attribute.'
properties:
binary_to_text_encoding:
$ref: '#/components/schemas/LogsDecoderProcessorBinaryToTextEncoding'
input_representation:
$ref: '#/components/schemas/LogsDecoderProcessorInputRepresentation'
is_enabled:
default: false
description: Whether the processor is enabled.
type: boolean
name:
description: Name of the processor.
type: string
source:
description: Name of the log attribute with the encoded data.
example: encoded.field
type: string
target:
description: Name of the log attribute that contains the decoded data.
example: decoded.field
type: string
type:
$ref: '#/components/schemas/LogsDecoderProcessorType'
required:
- source
- target
- binary_to_text_encoding
- input_representation
- type
type: object
LogsDecoderProcessorBinaryToTextEncoding:
description: The encoding used to represent the binary data.
enum:
- base64
- base16
example: base64
type: string
x-enum-varnames:
- BASE64
- BASE16
LogsDecoderProcessorInputRepresentation:
description: The original representation of input string.
enum:
- utf_8
- integer
example: utf_8
type: string
x-enum-varnames:
- UTF_8
- INTEGER
LogsDecoderProcessorType:
default: decoder-processor
description: Type of logs decoder processor.
enum:
- decoder-processor
example: decoder-processor
type: string
x-enum-varnames:
- DECODER_PROCESSOR
LogsExclusion:
description: Represents the index exclusion filter object from configuration
API.
Expand Down Expand Up @@ -6215,6 +6281,7 @@ components:
- $ref: '#/components/schemas/LogsTraceRemapper'
- $ref: '#/components/schemas/LogsSpanRemapper'
- $ref: '#/components/schemas/LogsArrayProcessor'
- $ref: '#/components/schemas/LogsDecoderProcessor'
LogsQueryCompute:
description: Define computation for a log query.
properties:
Expand Down
28 changes: 28 additions & 0 deletions docs/datadog_api_client.v1.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1719,6 +1719,34 @@ datadog\_api\_client.v1.model.logs\_date\_remapper\_type module
:members:
:show-inheritance:

datadog\_api\_client.v1.model.logs\_decoder\_processor module
-------------------------------------------------------------

.. automodule:: datadog_api_client.v1.model.logs_decoder_processor
:members:
:show-inheritance:

datadog\_api\_client.v1.model.logs\_decoder\_processor\_binary\_to\_text\_encoding module
-----------------------------------------------------------------------------------------

.. automodule:: datadog_api_client.v1.model.logs_decoder_processor_binary_to_text_encoding
:members:
:show-inheritance:

datadog\_api\_client.v1.model.logs\_decoder\_processor\_input\_representation module
------------------------------------------------------------------------------------

.. automodule:: datadog_api_client.v1.model.logs_decoder_processor_input_representation
:members:
:show-inheritance:

datadog\_api\_client.v1.model.logs\_decoder\_processor\_type module
-------------------------------------------------------------------

.. automodule:: datadog_api_client.v1.model.logs_decoder_processor_type
:members:
:show-inheritance:

datadog\_api\_client.v1.model.logs\_exclusion module
----------------------------------------------------

Expand Down
42 changes: 42 additions & 0 deletions examples/v1/logs-pipelines/CreateLogsPipeline_3336967838.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"""
Create a pipeline with Decoder Processor returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.logs_pipelines_api import LogsPipelinesApi
from datadog_api_client.v1.model.logs_decoder_processor import LogsDecoderProcessor
from datadog_api_client.v1.model.logs_decoder_processor_binary_to_text_encoding import (
LogsDecoderProcessorBinaryToTextEncoding,
)
from datadog_api_client.v1.model.logs_decoder_processor_input_representation import (
LogsDecoderProcessorInputRepresentation,
)
from datadog_api_client.v1.model.logs_decoder_processor_type import LogsDecoderProcessorType
from datadog_api_client.v1.model.logs_filter import LogsFilter
from datadog_api_client.v1.model.logs_pipeline import LogsPipeline

body = LogsPipeline(
filter=LogsFilter(
query="source:python",
),
name="testDecoderProcessor",
processors=[
LogsDecoderProcessor(
type=LogsDecoderProcessorType.DECODER_PROCESSOR,
is_enabled=True,
name="test_decoder",
source="encoded.field",
target="decoded.field",
binary_to_text_encoding=LogsDecoderProcessorBinaryToTextEncoding.BASE16,
input_representation=LogsDecoderProcessorInputRepresentation.UTF_8,
),
],
tags=[],
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = LogsPipelinesApi(api_client)
response = api_instance.create_logs_pipeline(body=body)

print(response)
104 changes: 104 additions & 0 deletions src/datadog_api_client/v1/model/logs_decoder_processor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations

from typing import Union, TYPE_CHECKING

from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
unset,
UnsetType,
)


if TYPE_CHECKING:
from datadog_api_client.v1.model.logs_decoder_processor_binary_to_text_encoding import (
LogsDecoderProcessorBinaryToTextEncoding,
)
from datadog_api_client.v1.model.logs_decoder_processor_input_representation import (
LogsDecoderProcessorInputRepresentation,
)
from datadog_api_client.v1.model.logs_decoder_processor_type import LogsDecoderProcessorType


class LogsDecoderProcessor(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v1.model.logs_decoder_processor_binary_to_text_encoding import (
LogsDecoderProcessorBinaryToTextEncoding,
)
from datadog_api_client.v1.model.logs_decoder_processor_input_representation import (
LogsDecoderProcessorInputRepresentation,
)
from datadog_api_client.v1.model.logs_decoder_processor_type import LogsDecoderProcessorType

return {
"binary_to_text_encoding": (LogsDecoderProcessorBinaryToTextEncoding,),
"input_representation": (LogsDecoderProcessorInputRepresentation,),
"is_enabled": (bool,),
"name": (str,),
"source": (str,),
"target": (str,),
"type": (LogsDecoderProcessorType,),
}

attribute_map = {
"binary_to_text_encoding": "binary_to_text_encoding",
"input_representation": "input_representation",
"is_enabled": "is_enabled",
"name": "name",
"source": "source",
"target": "target",
"type": "type",
}

def __init__(
self_,
binary_to_text_encoding: LogsDecoderProcessorBinaryToTextEncoding,
input_representation: LogsDecoderProcessorInputRepresentation,
source: str,
target: str,
type: LogsDecoderProcessorType,
is_enabled: Union[bool, UnsetType] = unset,
name: Union[str, UnsetType] = unset,
**kwargs,
):
"""
The decoder processor decodes any source attribute containing a
base64/base16-encoded UTF-8/ASCII string back to its original value, storing the
result in a target attribute.

:param binary_to_text_encoding: The encoding used to represent the binary data.
:type binary_to_text_encoding: LogsDecoderProcessorBinaryToTextEncoding

:param input_representation: The original representation of input string.
:type input_representation: LogsDecoderProcessorInputRepresentation

:param is_enabled: Whether the processor is enabled.
:type is_enabled: bool, optional

:param name: Name of the processor.
:type name: str, optional

:param source: Name of the log attribute with the encoded data.
:type source: str

:param target: Name of the log attribute that contains the decoded data.
:type target: str

:param type: Type of logs decoder processor.
:type type: LogsDecoderProcessorType
"""
if is_enabled is not unset:
kwargs["is_enabled"] = is_enabled
if name is not unset:
kwargs["name"] = name
super().__init__(kwargs)

self_.binary_to_text_encoding = binary_to_text_encoding
self_.input_representation = input_representation
self_.source = source
self_.target = target
self_.type = type
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations


from datadog_api_client.model_utils import (
ModelSimple,
cached_property,
)

from typing import ClassVar


class LogsDecoderProcessorBinaryToTextEncoding(ModelSimple):
"""
The encoding used to represent the binary data.

:param value: Must be one of ["base64", "base16"].
:type value: str
"""

allowed_values = {
"base64",
"base16",
}
BASE64: ClassVar["LogsDecoderProcessorBinaryToTextEncoding"]
BASE16: ClassVar["LogsDecoderProcessorBinaryToTextEncoding"]

@cached_property
def openapi_types(_):
return {
"value": (str,),
}


LogsDecoderProcessorBinaryToTextEncoding.BASE64 = LogsDecoderProcessorBinaryToTextEncoding("base64")
LogsDecoderProcessorBinaryToTextEncoding.BASE16 = LogsDecoderProcessorBinaryToTextEncoding("base16")
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations


from datadog_api_client.model_utils import (
ModelSimple,
cached_property,
)

from typing import ClassVar


class LogsDecoderProcessorInputRepresentation(ModelSimple):
"""
The original representation of input string.

:param value: Must be one of ["utf_8", "integer"].
:type value: str
"""

allowed_values = {
"utf_8",
"integer",
}
UTF_8: ClassVar["LogsDecoderProcessorInputRepresentation"]
INTEGER: ClassVar["LogsDecoderProcessorInputRepresentation"]

@cached_property
def openapi_types(_):
return {
"value": (str,),
}


LogsDecoderProcessorInputRepresentation.UTF_8 = LogsDecoderProcessorInputRepresentation("utf_8")
LogsDecoderProcessorInputRepresentation.INTEGER = LogsDecoderProcessorInputRepresentation("integer")
35 changes: 35 additions & 0 deletions src/datadog_api_client/v1/model/logs_decoder_processor_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations


from datadog_api_client.model_utils import (
ModelSimple,
cached_property,
)

from typing import ClassVar


class LogsDecoderProcessorType(ModelSimple):
"""
Type of logs decoder processor.

:param value: If omitted defaults to "decoder-processor". Must be one of ["decoder-processor"].
:type value: str
"""

allowed_values = {
"decoder-processor",
}
DECODER_PROCESSOR: ClassVar["LogsDecoderProcessorType"]

@cached_property
def openapi_types(_):
return {
"value": (str,),
}


LogsDecoderProcessorType.DECODER_PROCESSOR = LogsDecoderProcessorType("decoder-processor")
Loading
Loading