Skip to content

DataKit metrics

· Version-1.10.0


This Input used to collect Datakit exported metrics, such as runtime/CPU/memory and various other metrics of each modules.

Configuration

After Datakit startup, it will expose a lot of Prometheus metrics, and the input dk can scrap these metrics.

Collector Configuration

Go to the conf.d/host directory under the DataKit installation directory, copy dk.conf.sample and name it dk.conf. Examples are as follows:

[[inputs.dk]]

  # See https://docs.guance.com/datakit/datakit-metrics/#metrics for all metrics exported by Datakit.
  metric_name_filter = [
    ### Collect all metrics(these may collect 300+ metrics of Datakit)
    ### if you want to collect all, make this rule the first in the list.
    # ".*",

    "datakit_http.*",       # HTTP API
    "datakit_goroutine.*",  # Goroutine

    ### runtime related
    "datakit_cpu_.*",
    "datakit_.*_alloc_bytes", # Memory
    "datakit_open_files",
    "datakit_uptime_seconds",
    "datakit_data_overuse",
    "datakit_process_.*",

    ### election
    "datakit_election_status",

    ### Dataway related
    #"datakit_io_dataway_.*",
    #"datakit_io_http_retry_total",

    ### Filter
    #"datakit_filter_.*",

    ### dialtesting
    #"datakit_dialtesting_.*",

    ### Input feed
    #".*_feed_.*",
  ]

  # keep empty to collect all types(count/gauge/summary/...)
  metric_types = []

  # collect frequency
  interval = "30s"

[inputs.dk.tags]
   # tag1 = "val-1"
   # tag2 = "val-2"

After configuration, restart DataKit.

Can be turned on by ConfigMap Injection Collector Configuration or Config ENV_DATAKIT_INPUTS .

Can also be turned on by environment variables, (needs to be added as the default collector in ENV_DEFAULT_ENABLED_INPUTS):

  • ENV_INPUT_DK_ENABLE_ALL_METRICS

    Collect all metrics, any string

    Type: Boolean

    input.conf: -

    Example: true

    Default: -

  • ENV_INPUT_DK_ADD_METRICS

    Additional metrics, Available metrics list here

    Type: List

    input.conf: -

    Example: ["datakit_io_.*", "datakit_pipeline_.*"]

    Default: -

  • ENV_INPUT_DK_ONLY_METRICS

    Only enable metrics

    Type: List

    input.conf: -

    Example: ["datakit_io_.*", "datakit_pipeline_.*"]

    Default: -

Metric

Datakit exported Prometheus metrics, see here for full metric list.

Feedback

Is this page helpful? ×