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

processor_content_modifier: add support for Metrics processing #9531

Merged
merged 3 commits into from
Oct 28, 2024

Conversation

edsiper
Copy link
Member

@edsiper edsiper commented Oct 26, 2024

The following PR extends Content Modifier processor allowing to operate on metrics generated originally by OpenTelemetry. The following contexts are available for metrics:

  • otel_resource_attributes
  • otel_scope_name
  • otel_scope_version

usage example:

service:
  log_level: info

pipeline:
  inputs:
    - name: opentelemetry
      processors:
        metrics:
          - name: content_modifier
            context: otel_scope_name
            action: upsert
            value: "fluent-bit-scope"

          - name: content_modifier
            context: otel_scope_attributes
            action: upsert
            key: scope_attr_processor
            value: "attributes fluent-bit"

          - name: content_modifier
            context: otel_scope_name
            action: upsert
            value: "new-scope-name"

          - name: content_modifier
            context: otel_resource_attributes
            action: insert
            key: "added_by"
            value: "fluent-bit"

          - name: content_modifier
            context: otel_resource_attributes
            action: insert
            key: "http.url"
            value: https://fluentbit.io/blog/?this=that

          - name: content_modifier
            context: otel_resource_attributes
            action: upsert
            key: "added_by"
            value: "fluent-bit v3.2"

          - name: content_modifier
            context: otel_resource_attributes
            action: delete
            key: "service.name"

          - name: content_modifier
            context: otel_resource_attributes
            action: rename
            key: "telemetry.sdk.language"
            value: "my-sdk"

          - name: content_modifier
            context: otel_resource_attributes
            action: hash
            key: "host.hostname"

          - name: content_modifier
            context: otel_resource_attributes
            action: extract
            key: "http.url"
            pattern: ^(?<http_protocol>https?):\/\/(?<http_domain>[^\/\?]+)(?<http_path>\/[^?]*)?(?:\?(?<http_query_params>.*))?

          - name: content_modifier
            context: otel_resource_attributes
            action: insert
            key: "is_it_sunny"
            value: "true"

          - name: content_modifier
            context: otel_resource_attributes
            action: convert
            key: is_it_sunny
            converted_type: boolean

  outputs:
    - name: stdout
      match: "*"

Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.

The following patch, extends the processor capabilities to operate
on top of metrics, specifically on resource and scope metadata such as
attributes, name, version, etc.

Signed-off-by: Eduardo Silva <[email protected]>
@edsiper edsiper force-pushed the content_modifier_for_metrics branch from 5bb47ac to 4da46cc Compare October 28, 2024 03:10
@edsiper edsiper changed the title WIP: processor_content_modifier: add support for Metrics processing processor_content_modifier: add support for Metrics processing Oct 28, 2024
@edsiper edsiper merged commit e7c3e93 into master Oct 28, 2024
52 checks passed
@edsiper edsiper deleted the content_modifier_for_metrics branch October 28, 2024 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant