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

OTLP Logs drop Resource and Scope attributes #8205

Closed
braydonk opened this issue Nov 20, 2023 · 8 comments
Closed

OTLP Logs drop Resource and Scope attributes #8205

braydonk opened this issue Nov 20, 2023 · 8 comments
Labels
opentelemetry Fluent Bit + OpenTelemetry integration status: waiting-for-triage

Comments

@braydonk
Copy link
Contributor

braydonk commented Nov 20, 2023

Bug Report

Describe the bug
When you send OTLP logs into Fluent Bit and then send them back out, any Resource or Scope attributes are lost. This is because out_opentelemetry sending logs just initializes and empty resource and scope, thus meaning any data sent in are ignored.

To Reproduce

  • Rubular link if applicable:
  • Example log message if applicable:
    When this OTLP goes in:
{
  "resourceLogs": [
    {
      "resource": {
        "attributes": [
          {
            "key": "host.name",
            "value": {
              "stringValue": "debian-dev-machine"
            }
          },
          {
            "key": "os.type",
            "value": {
              "stringValue": "linux"
            }
          }
        ]
      },
      "scopeLogs": [
        {
          "scope": {},
          "logRecords": [
            {
              "observedTimeUnixNano": "1700497457844514864",
              "body": {
                "stringValue": "here"
              },
              "attributes": [
                {
                  "key": "log.file.name",
                  "value": {
                    "stringValue": "a.txt"
                  }
                }
              ],
              "traceId": "",
              "spanId": ""
            },
            ...
          ]
        }
      ],
      "schemaUrl": "https://opentelemetry.io/schemas/1.6.1"
    }
  ]
}

I passed it into this Fluent Bit config:

[SERVICE]
    Log_level debug
    Flush 1

[INPUT]
    Name opentelemetry
    Listen 127.0.0.1
    Port 6969

[OUTPUT]
    Name     opentelemetry
    Match    *
    Host     127.0.0.1
    Port     4318
    Logs_uri /v1/logs

Then sent it to another local OTel collector and dumped the result to a file.
This is the OTLP that came out:

{
  "resourceLogs": [
    {
      "resource": {},
      "scopeLogs": [
        {
          "scope": {},
          "logRecords": [
            {
              "timeUnixNano": "1700497457945114315",
              "body": {
                "kvlistValue": {
                  "values": [
                    {
                      "key": "message",
                      "value": {
                        "stringValue": "here"
                      }
                    }
                  ]
                }
              },
              "attributes": [
                {
                  "key": "log.file.name",
                  "value": {
                    "stringValue": "a.txt"
                  }
                }
              ],
              "traceId": "",
              "spanId": ""
            },
            ...
          ]
        }
      ]
    }
  ]
}
  • Steps to reproduce the problem:
    The config I mentioned above, and what I did to reproduce was used an otel collector to read logs from a file and export otlphttp to Fluent Bit, then Fluent Bit output to another otel collector that receives the OTLP and dumps the result to a file.

Expected behavior
The data I passed in with OTLP should, at minimum, be the same when it comes out if there is no processing done.

Screenshots

Your Environment

  • Version used: built from master
  • Configuration: See above
  • Environment name and version (e.g. Kubernetes? What version?): normal Debian VM
  • Server type and version: Debian bullseye VM
  • Operating System and version: Debian 11
  • Filters and plugins: See above config

Additional context

This makes Fluent Bit basically unusable for any OTLP-focused pipelines. Losing resource attributes is a particularly big problem, especially because Fluent Bit doesn't appear to provide any way to decorate Resource with attributes to begin with. (That is worth a separate issue probably). I haven't tried traces, but when I tried metrics this wasn't a problem; the data I passed in was what I got out (although all my metric names were prefixed with underscore, which is also definitely a bug, see issue #8083

@braydonk braydonk changed the title OTLP Logs drop Resource, Scope, and Log attributes OTLP Logs drop Resource and Scope attributes Nov 20, 2023
@braydonk
Copy link
Contributor Author

This is the problematic section:

scope_log.log_records = logs;
scope_log.n_log_records = log_count;
scope_logs[0] = &scope_log;
resource_log.scope_logs = scope_logs;
resource_log.n_scope_logs = 1;
resource_logs[0] = &resource_log;

@lecaros lecaros added the opentelemetry Fluent Bit + OpenTelemetry integration label Dec 22, 2023
@nokute78
Copy link
Collaborator

There are two issues to fix this issue.

  1. in_opentelemetry ignores resource and scope
  2. out_opentelemetry creates blank resource and scope

I sent a patch to fix issue 1 storing resouce and scope as metadata.
#8294

Copy link
Contributor

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days. Maintainers can add the exempt-stale label.

@github-actions github-actions bot added the Stale label Apr 21, 2024
@braydonk
Copy link
Contributor Author

braydonk commented Apr 21, 2024 via email

@github-actions github-actions bot removed the Stale label May 1, 2024
@yoyoraso
Copy link

Hi, any updates on this, work arounds , anything. I have same problem, I use k6 to generate logs and sent it to fluentbit incase of http it works as expected and I see full logs but in case of opentelemetry some logs info are missing.

@edsiper
Copy link
Member

edsiper commented Jun 4, 2024

OTel logs compat issues are solved with this:

This will be part of v3.1 release (~June 24)

@edsiper edsiper added this to the Fluent Bit v3.1.0 milestone Jun 4, 2024
@scila1996
Copy link

+1. Same issue

@edsiper Expecting for 3.1 soon

@edsiper
Copy link
Member

edsiper commented Jun 13, 2024

Closing this ticket since #8898 and other enhancements are already merged.

@edsiper edsiper closed this as completed Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
opentelemetry Fluent Bit + OpenTelemetry integration status: waiting-for-triage
Projects
None yet
Development

No branches or pull requests

6 participants