| 1 |
import uuid |
| 2 |
|
| 3 |
from azure.kusto.data._telemetry import Span |
| 4 |
|
| 5 |
from .descriptors import DescriptorBase |
| 6 |
from .ingestion_properties import IngestionProperties |
| 7 |
|
| 8 |
|
| 9 |
class IngestTracingAttributes: |
| 10 |
""" |
| 11 |
Additional ADX attributes for telemetry spans |
| 12 |
""" |
| 13 |
|
| 14 |
_BLOB_QUEUE_NAME = "blob_queue_name" |
| 15 |
_SOURCE_ID = "source_id" |
| 16 |
|
| 17 |
@classmethod |
| 18 |
def set_ingest_descriptor_attributes(cls, descriptor: DescriptorBase, ingestion_properties: IngestionProperties) -> None: |
| 19 |
Span.add_attributes(tracing_attributes={**ingestion_properties.get_tracing_attributes(), **descriptor.get_tracing_attributes()}) |
| 20 |
|
| 21 |
@classmethod |
| 22 |
def create_enqueue_request_attributes(cls, queue_name: str, source_id: uuid.UUID) -> dict: |
| 23 |
enqueue_request_attributes = {cls._BLOB_QUEUE_NAME: queue_name, cls._SOURCE_ID: str(source_id)} |
| 24 |
return enqueue_request_attributes |