Defined Type: otelcol::component

Defined in:
manifests/component.pp

Summary

Define a component for the OpenTelemetry Collector Configuration

Overview

Generic Type for defining a component for the OpenTelemetry Collector Configuration

}

Examples:

Basic Usage

otelcol::component { 'receiver_name-receiver':':
  component_name => 'receiver_name',
  type           => 'receiver',

Parameters:

  • component_name (Otelcol::Component::Name)

    The name of the component

  • type (String)

    The type of the component

  • config (Hash) (defaults to: {})

    The configuration for the component

  • order (Integer[0,10999]) (defaults to: 0)

    The order of the component

  • pipelines (Array[String[1]]) (defaults to: [])

    The pipelines to add the component to



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'manifests/component.pp', line 22

define otelcol::component (
  Otelcol::Component::Name $component_name,
  String $type,
  Hash $config = {},
  Integer[0,10999] $order = 0,
  Array[String[1]] $pipelines = [],
) {
  # assert_private()
  $component = {
    $type => {
      $component_name => $config,
    },
  }
  concat::fragment { "otelcol-config-${type}-${component_name}" :
    target  => 'otelcol-config',
    order   => $order,
    content => stdlib::to_yaml($component),
  }

  $pipelines.each |String $pipeline| {
    $component = {
      'service' => {
        'pipelines' => {
          $pipeline => {
            $type => [$component_name],
          },
        },
      },
    }
    concat::fragment { "otelcol-config-${type}-${component_name}-${pipeline}" :
      target  => 'otelcol-config',
      order   => $order,
      content => stdlib::to_yaml($component),
    }
  }
}