role: Aggregator
image:
  repository: "{{ .ImageRepo }}"
  tag: "{{ .ImageTag }}"
resources: {{ .Resources }}
service:
  enabled: false
extraVolumes:
- name: tidb-tls
  secret:
    secretName: db-{{ .TiDBGroup }}-tidb-cluster-secret
    items:
    - key: ca.crt
      path: ca.crt
    - key: tls.crt
      path: tls.crt
    - key: tls.key
      path: tls.key
extraVolumeMounts:
- name: tidb-tls
  mountPath: /etc/vector/tidb-tls
customConfig:
  sources:
    topsql:
      type: topsql
      tidb_group: "{{ .TiDBGroup }}"
      top_n: 10
      tls:
        ca_path: "/etc/vector/tidb-tls/ca.crt"
        crt_path: "/etc/vector/tidb-tls/tls.crt"
        key_path: "/etc/vector/tidb-tls/tls.key"
        verify_hostname: false
        verify_certificate: false
  transforms:
    topsql_add_meta:
      type: remap
      inputs:
      - topsql
      source: |
        .tags.vm_account_id = "{{ .VMAccountID }}"
        .tags.vm_project_id = "{{ .VMProjectID }}"
        .tags.cluster_id = "{{ .ClusterID }}"
        .tags.tidb_cluster_id = "{{ .ClusterID }}"
  sinks:
    topsql_vm:
      type: prometheus_remote_write
      healthcheck:
        enabled: false
      inputs:
      - topsql_add_meta
      endpoint: "{{ .RemoteWriteURL }}"
      batch:
        max_events: 1000
        max_bytes: 1048576 # 1MiB
        timeout_secs: 1
      buffer:
        type: disk
        max_size: 536870912 # 512MiB
        when_full: drop_newest
