Description
Component(s)
pkg/translator/azure, pkg/translator/azurelogs
What happened?
Description
The resultSignature
field in Azure logs is expected to be a string in the codebase:
- https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/pkg/translator/azurelogs/resourcelogs_to_logs.go#L65
- https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/pkg/translator/azure/resourcelogs_to_logs.go#L60
However, this field can vary in type depending on the Azure service emitting the logs. For instance, in Azure AI Search, the resultSignature
field is an integer as stated in the Azure documentation:
https://learn.microsoft.com/en-us/azure/search/monitor-azure-cognitive-search-data-reference#resource-log-schema
This discrepancy causes errors in processing logs from services where resultSignature
is not a string.
Steps to Reproduce
- Configure an Azure service that sends an integer for the
resultSignature
field (e.g., Azure AI Search). - Set up the service's diagnostic settings to forward logs to an Azure Event Hub.
- Configure an OpenTelemetry Collector with a receiver for Azure Event Hub.
- Send a log event where the
resultSignature
field is an integer.
Expected Result
Logs from Azure services should be processed without errors, regardless of the type of the resultSignature
field.
Actual Result
An error is generated when processing logs with a resultSignature
field that is not a string.
Collector version
0.114.0
Environment information
Environment
OS: "Ubuntu 20.04"
OpenTelemetry Collector configuration
receivers:
azureeventhub:
connection: <REDACTED>
format: azure
otlp:
protocols:
http:
endpoint: 0.0.0.0:4318
grpc:
endpoint: 0.0.0.0:4317
processors:
batch: {}
exporters:
otlphttp:
endpoint: <scrubbed_endpoint>
headers:
Authorization: "<REDACTED>"
service:
pipelines:
logs:
receivers: [azureeventhub]
processors: [batch]
exporters: [otlphttp]
telemetry:
logs:
level: "DEBUG"
encoding: "json"
metrics:
level: normal
address: 0.0.0.0:8888
extensions: [health_check]
Log output
{"level":"error","ts":1732127778.2987723,"caller":"[email protected]/eventhubhandler.go:157","msg":"error decoding message","exporter_id":"aci-93f27a-ci-aitechsbx-dit-01","kind":"receiver","name":"azureeventhub","data_type":"logs","error":"failed to unmarshal logs: azure.azureRecords.Records: []azure.azureLogRecord: azure.azureLogRecord.ResultSignature: ReadString: expects \" or n, but found 2, error found in #10 byte of ...|nature\": 200, \"durat|..., bigger context ...|gs\", \"resultType\": \"Success\", \"resultSignature\": 200, \"durationMS\": 43, \"properties\": {\r\n \"Descript|...","stacktrace":"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/azureeventhubreceiver.(*eventhubHandler).newMessageHandler\n\tgithub.com/open-telemetry/opentelemetry-collector-contrib/receiver/[email protected]/eventhubhandler.go:157\ngithub.com/Azure/azure-event-hubs-go/v3.(*receiver).handleMessage\n\tgithub.com/Azure/azure-event-hubs-go/[email protected]/receiver.go:267\ngithub.com/Azure/azure-event-hubs-go/v3.(*receiver).handleMessages\n\tgithub.com/Azure/azure-event-hubs-go/[email protected]/receiver.go:244"}
Additional context
No response