Skip to content

Introducing HTTP Headers to the OTLP Source for Metrics #24619

@sorrowcode

Description

@sorrowcode

A note for the community

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Use Cases

Problem:
OTLP metrics source have no possibility to receive headers at the moment. This is currently implemented for logs. In order to streamline the OTLP solution this would be a great feature to make the product more comfortable to use. This header could be used for tenant separation in order to restrict access to vector as a shared component.

Attempted Solutions

No response

Proposal

This could be used similar to the following example implemented for the logs:

transforms:
  "split_with_headers":
    type: remap
    inputs:
      - "otlp.logs"
    source: |
      result = []
      for_each(array!(.resourceLogs)) -> |resource_log_index, resource_log| {
        for_each(array!(resource_log.scopeLogs)) -> |scope_log_index, scope_log| {
          for_each(array!(scope_log.logRecords)) -> |log_record_index, log_record| {
            event = {
              "resourceLogs": [
                resource_log
              ]
            }
            event.resourceLogs[0].scopeLogs = [
              scope_log
            ]
            event.resourceLogs[0].scopeLogs[0].logRecords = [
              log_record
            ]
            event."SomeHeader" = ."SomeHeader"
            result = push(result, event)
          }
        }
      }
      . = result

References

Version

v0.53.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions