Skip to content
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

[pkg/translator/azure] Unable to decode "malformed" data in Azure Resource Logs #28648

Closed
cparkins opened this issue Oct 26, 2023 · 2 comments
Closed

Comments

@cparkins
Copy link
Contributor

cparkins commented Oct 26, 2023

Component(s)

pkg/translator/azure, receiver/azureeventhub

What happened?

Description

We recently configured an Azure Event Hub Receiver to capture logs from an Azure API Management instance and noticed that the log data was lacking almost all of the data passed in.

Steps to Reproduce

Attempt to convert the following JSON event to OTel:

{
    "records": [
        {
            "DeploymentVersion": "0.40.16708.0",
            "Level": 4,
            "isRequestSuccess": true,
            "time": "2023-10-26T14:22:43.3416357Z",
            "operationName": "Microsoft.ApiManagement/GatewayLogs",
            "category": "GatewayLogs",
            "durationMs": 243,
            "callerIpAddress": "13.14.15.16",
            "correlationId": "REDACTED",
            "location": "East US",
            "properties": {
                "method": "GET",
                "url": "REDACTED",
                "backendResponseCode": 200,
                "responseCode": 200,
                "responseSize": 102945,
                "cache": "none",
                "backendTime": 54,
                "requestSize": 632,
                "apiId": "demo-api",
                "operationId": "GetSessions",
                "apimSubscriptionId": "master",
                "clientTime": 190,
                "clientProtocol": "HTTP/1.1",
                "backendProtocol": "HTTP/1.1",
                "apiRevision": "1",
                "clientTlsVersion": "1.2",
                "backendMethod": "GET",
                "backendUrl": "https://api.azurewebsites.net/sessions"
            },
            "resourceId": "/RESOURCE_ID",
            "resultType": "Succeeded",
            "truncated": 0
        }
    ]
}

Expected Result

Data is successfully Converted with all properties as accurate as possible.

Actual Result

Data is partially Converted, with very little data present (Essentially the timestamp and a few other details, no properties). See JSON Output below:
{"resourceLogs":[{"resource":{"attributes":[{"key":"azure.resource.id","value":{"stringValue":"/RESOURCE_ID"}}]},"scopeLogs":[{"scope":{"name":"otelcol/azureresourcelogs","version":"0.88.0-dev"},"logRecords":[{"timeUnixNano":"1698343020000000000","body":{},"attributes":[{"key":"cloud.provider","value":{"stringValue":"azure"}},{"key":"azure.category","value":{"stringValue":""}},{"key":"azure.operation.name","value":{"stringValue":""}}],"traceId":"","spanId":""},{"timeUnixNano":"1698343080000000000","body":{},"attributes":[{"key":"azure.category","value":{"stringValue":""}},{"key":"azure.operation.name","value":{"stringValue":""}},{"key":"cloud.provider","value":{"stringValue":"azure"}}],"traceId":"","spanId":""}

Collector version

v0.88.0

Environment information

Environment

OS: Mac OS
Compiler(if manually compiled): go 1.20.5 darwin/arm64

OpenTelemetry Collector configuration

receivers:
  azureeventhub:
    connection: "REDACTED"

service:
  telemetry:
    logs:
      level: "debug"

  pipelines:
    logs:
      receivers: [azureeventhub]
      processors: []
      exporters: [logging]

Log output

No error output seen.

Additional context

This appears to be an issue when the underlying JSON data can not be parsed correctly.

@cparkins cparkins added bug Something isn't working needs triage New item requiring triage labels Oct 26, 2023
@github-actions
Copy link
Contributor

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@cparkins cparkins changed the title [pkg/translator/azure] Unable to parse "malformed" data in Azure Resource Logs [pkg/translator/azure] Unable to decode "malformed" data in Azure Resource Logs Oct 26, 2023
@crobert-1 crobert-1 removed the needs triage New item requiring triage label Oct 26, 2023
MovieStoreGuy pushed a commit that referenced this issue Oct 27, 2023
…tely (#28650)

**Description:** <Describe what has changed.>
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
When decoding from Azure Resource Log format to OTel if a numeric field
is represented without quotes the data will not be decoded and will fail
silently.

**Link to tracking Issue:** <Issue number if applicable>
#28648 

**Testing:** <Describe what testing was performed and which tests were
added.>
Invalid data captured from Azure Diagnostic Setting and used to create a
unit test. Then data was reprocessed with the Event Hubs Receiver.

**Documentation:** <Describe the documentation added.>
None required as this was a bug within the code.
sigilioso pushed a commit to carlossscastro/opentelemetry-collector-contrib that referenced this issue Oct 27, 2023
…tely (open-telemetry#28650)

**Description:** <Describe what has changed.>
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
When decoding from Azure Resource Log format to OTel if a numeric field
is represented without quotes the data will not be decoded and will fail
silently.

**Link to tracking Issue:** <Issue number if applicable>
open-telemetry#28648 

**Testing:** <Describe what testing was performed and which tests were
added.>
Invalid data captured from Azure Diagnostic Setting and used to create a
unit test. Then data was reprocessed with the Event Hubs Receiver.

**Documentation:** <Describe the documentation added.>
None required as this was a bug within the code.
@crobert-1
Copy link
Member

Fixed by #28650

jmsnll pushed a commit to jmsnll/opentelemetry-collector-contrib that referenced this issue Nov 12, 2023
…tely (open-telemetry#28650)

**Description:** <Describe what has changed.>
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
When decoding from Azure Resource Log format to OTel if a numeric field
is represented without quotes the data will not be decoded and will fail
silently.

**Link to tracking Issue:** <Issue number if applicable>
open-telemetry#28648 

**Testing:** <Describe what testing was performed and which tests were
added.>
Invalid data captured from Azure Diagnostic Setting and used to create a
unit test. Then data was reprocessed with the Event Hubs Receiver.

**Documentation:** <Describe the documentation added.>
None required as this was a bug within the code.
RoryCrispin pushed a commit to ClickHouse/opentelemetry-collector-contrib that referenced this issue Nov 24, 2023
…tely (open-telemetry#28650)

**Description:** <Describe what has changed.>
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
When decoding from Azure Resource Log format to OTel if a numeric field
is represented without quotes the data will not be decoded and will fail
silently.

**Link to tracking Issue:** <Issue number if applicable>
open-telemetry#28648 

**Testing:** <Describe what testing was performed and which tests were
added.>
Invalid data captured from Azure Diagnostic Setting and used to create a
unit test. Then data was reprocessed with the Event Hubs Receiver.

**Documentation:** <Describe the documentation added.>
None required as this was a bug within the code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants