apiVersion: v1
kind: ConfigMap
metadata:
  name: collector-config
data:
  collector.yaml: |
    clusterName: k8s-cluster
    enableEvents: false
    enableDiscovery: true
    flushInterval: 30s

    sinks:
    - proxyAddress: wavefront-proxy.wavefront-collector.svc.cluster.local:2878
      filters:
        # Optimized metrics collection to omit peripheral metrics.
        metricDenyList:
        - 'kubernetes.sys_container.*'
        - 'kubernetes.collector.runtime.*'
        - 'kubernetes.*.network.rx_rate'
        - 'kubernetes.*.network.rx_errors_rate'
        - 'kubernetes.*.network.tx_rate'
        - 'kubernetes.*.network.tx_errors_rate'
        - 'kubernetes.*.memory.page_faults'
        - 'kubernetes.*.memory.page_faults_rate'
        - 'kubernetes.*.memory.major_page_faults'
        - 'kubernetes.*.memory.major_page_faults_rate'
        - 'kubernetes.*.filesystem.inodes'
        - 'kubernetes.*.filesystem.inodes_free'
        - 'kubernetes.*.ephemeral_storage.request'
        - 'kubernetes.*.ephemeral_storage.limit'
        # Filter out generated labels
        tagExclude:
        - 'label?controller?revision*'
        - 'label?pod?template*'
        - 'annotation_kubectl_kubernetes_io_last_applied_configuration'

    sources:
      kubernetes_source:
        url: 'https://kubernetes.default.svc'
        kubeletPort: 10250
        kubeletHttps: true
        useServiceAccount: true
        insecure: true
        prefix: 'kubernetes.'

        filters:
          metricDenyList:
          - 'kubernetes.sys_container.*'

      internal_stats_source:
        prefix: 'kubernetes.'

      kubernetes_state_source:
        prefix: 'kubernetes.'

    # discovery rules for auto-discovery of pods and services
    discovery:
      enable_runtime_plugins: true
