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

Add test for transform processor interaction with sumologic extension/exporter #748

Open
jspaleta opened this issue Oct 5, 2022 · 0 comments

Comments

@jspaleta
Copy link
Contributor

jspaleta commented Oct 5, 2022

Apologies if there is already a test for this scenario and I just didn't see it on source code review.

Context

The Sumologic dashboard apps will be providing otelcol config snippets that include
process transformer config to override the sumologic extension metadata. We need to test to make sure the transform processor overrides are honored by the sumologic exporter and work as expected.

Test Scenario

otel-col is configured with a sumologic extension like:

extensions:
  sumologic:
    collector_name: default_collector_name
    collector_category: default/collector/category
    install_token: XXXXXXXXXXXXXXXXXXXX    
    api_base_url: https://open-collectors.sumologic.com
    collector_fields:
      environment : "dev"
      component : "unknown"

The apache app will add configuration like:

receivers:
  apache:
    endpoint: "http://localhost/server-status?auto"
  filelog/apache:
    include:
    - /var/log/apache2/*.log
    start_at: beginning

exporters:
  logging/apache:
    logLevel: debug
  sumologic/apache:
    auth:
      authenticator: sumologic
    compress_encoding: ""
    source_category: "anema/apache/metric"
    source_name: "anema Otel native apache"
    source_host: "anemaOtelApache"
    sending_queue:
      enabled: true
    metric_format: otlp
    log_format: otlp


extensions:
# Note: sumologic extension is special.
# avoid including the extension as part of apps
# for collector metadata and fields use transform processor       
# sumologic:

processors:
# Note: use transform processor instead of customizing sumologic extension 
  transform/apache/collector_metadata:
    metrics:
      queries:
        # set custom collector_name using _sourceName resource attribute 
        - set(resource.attributes["_sourceName"], "anema_hosted_collector_otel_apache")
        # set custom collector_category using _sourceCategory resource attribute 
        - set(resource.attributes["_sourceCategory"], "anema/apache/metric")
        # set custom collector_host using _sourceHost resource attribute 
        #- set(resource.attributes["_sourceHost"], "apache-host")
    logs:
      queries:
        # set custom collector_name using _sourceName resource attribute 
        - set(resource.attributes["_sourceName"], "anema_hosted_collector_otel_apache")
        # set custom collector_category using _sourceCategory resource attribute 
        - set(resource.attributes["_sourceCategory"], "anema/apache/metric")
        # set custom collector_host using _sourceHost resource attribute 
        #- set(resource.attributes["_sourceHost"], "apache-host")

# use transform processor to override collector_fields        
  transform/apache/collector_fields:
    # Work in progress, need to build transform override queries for collector_fields
    #collector_fields:
    #  environment : "otel_dev"
    #  webserver_farm : "ec2_2_otel"
    #  webserver_system : "apache"
    #  component : "webserver"
    metrics:
      queries:
    logs:
      queries:

service:
  # DO NOT define extensions attribute as part of an app config, this attribute can not be merged, take from common config.
  #extensions: [sumologic]
  pipelines:
    metrics/apache:
      receivers: [apache]
      exporters: [sumologic/apache]
      processors: [transform/apache/collector_metadata, transform/apache/collector_fields]
    logs/apache:
      receivers: [filelog/apache]
      exporters: [sumologic/apache, logging/apache]
      processors: [transform/apache/collector_metadata, transform/apache/collector_fields]  

Requested Test

Build a test to ensure that the transform processor overrides for resource attributes that corresponds to the sumologic extension collector metadata and collector fields are honored by the sumologic exporter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant