func makeCollectorConfigMap()

in pkg/testutils/collector/collector.go [267:386]


func makeCollectorConfigMap() *corev1.ConfigMap {
	return &corev1.ConfigMap{
		TypeMeta: metav1.TypeMeta{
			APIVersion: "v1",
			Kind:       "ConfigMap",
		},
		ObjectMeta: metav1.ObjectMeta{
			Name:      "collector-config",
			Namespace: "adx-mon",
		},
		Data: map[string]string{
			"config.toml": `
# We have to keep our scape targets very light due to the capacity
# constraints of kustainer

# Ingestor URL to send collected telemetry.
endpoint = 'https://ingestor.adx-mon.svc.cluster.local'

# Region is a location identifier
region = '$REGION'

# Skip TLS verification.
insecure-skip-verify = true

# Address to listen on for endpoints.
listen-addr = ':8080'

# Maximum number of connections to accept.
max-connections = 100

# Maximum number of samples to send in a single batch.
max-batch-size = 10000

# Storage directory for the WAL.
storage-dir = '/mnt/data'

# Regexes of metrics to drop from all sources.
drop-metrics = []

keep-metrics = ['^adxmon.*']

# Disable metrics forwarding to endpoints.
disable-metrics-forwarding = false

# Key/value pairs of labels to add to all metrics and logs.
[add-labels]
  host = '$(HOSTNAME)'
  cluster = '$CLUSTER'

# Defines a prometheus scrape endpoint.
[prometheus-scrape]

  # Database to store metrics in.
  database = 'Metrics'

  default-drop-metrics = false

  # Defines a static scrape target.
  static-scrape-target = [
    # Scrape our own metrics
    { host-regex = '.*', url = 'http://$(HOSTNAME):3100/metrics', namespace = 'adx-mon', pod = 'collector', container = 'collector' },
  ]

  # Scrape interval in seconds.
  scrape-interval = 30

  # Scrape timeout in seconds.
  scrape-timeout = 25

  # Disable metrics forwarding to endpoints.
  disable-metrics-forwarding = false

  # Regexes of metrics to keep from scraping source.
  keep-metrics = ['^adxmon.*', '^sample.*']

  # Regexes of metrics to drop from scraping source.
  drop-metrics = ['^go.*', '^process.*', '^promhttp.*']

# Defines a prometheus remote write endpoint.
[[prometheus-remote-write]]

  # Database to store metrics in.
  database = 'Metrics'

  # The path to listen on for prometheus remote write requests.  Defaults to /receive.
  path = '/receive'

  # Regexes of metrics to drop.
  drop-metrics = []

  # Disable metrics forwarding to endpoints.
  disable-metrics-forwarding = false

  # Key/value pairs of labels to add to this source.
  [prometheus-remote-write.add-labels]

# Defines an OpenTelemetry log endpoint.
[otel-log]
  # Attributes lifted from the Body and added to Attributes.
  lift-attributes = ['kusto.database', 'kusto.table']

[[host-log]]
  parsers = ['json']

  journal-target = [
    # matches are optional and are parsed like MATCHES in journalctl.
    # If different fields are matched, only entries matching all terms are included.
    # If the same fields are matched, entries matching any term are included.
    # + can be added between to include a disjunction of terms.
    # See examples under man 1 journalctl
    { matches = [ '_SYSTEMD_UNIT=kubelet.service' ], database = 'Logs', table = 'Kubelet' }
  ]

  kernel-target = [
    { database = 'Logs', table = 'Kernel', priority = 'warning' }
  ]
`,
		},
	}
}