DataDog / datadog-agent

Main repository for Datadog Agent
https://docs.datadoghq.com/
Apache License 2.0
2.87k stars 1.21k forks source link

Cluster directory check metrics missing env tag from DD_ENV #12761

Closed mnahkies closed 2 years ago

mnahkies commented 2 years ago

Output of the info page (if this is a bug)

  Metadata
  ========
    agent_version: 7.35.2
    cloud_provider: GCP
    config_apm_dd_url: 
    config_dd_url: 
    config_logs_dd_url: 
    config_logs_socks5_proxy_address: 
    config_no_proxy: []
    config_process_dd_url: 
    config_proxy_http: 
    config_proxy_https: 
    config_site: 
    feature_apm_enabled: false
    feature_cspm_enabled: false
    feature_cws_enabled: false
    feature_logs_enabled: false
    feature_networks_enabled: false
    feature_networks_http_enabled: false
    feature_networks_https_enabled: false
    feature_otlp_enabled: false
    feature_process_enabled: false
    feature_processes_container_enabled: true
    flavor: agent
    hostname_source: gce
    install_method_installer_version: datadog-2.33.4
    install_method_tool: helm
    install_method_tool_version: Helm

Describe what happened: I've configured the directory integration as a cluster check to monitor some directories. To achieve this I've mounted the directories to the agents, and passed the config to the cluster agent.

This is working fine, but the env tag is coming through as N/A despite the DD_ENV variable being configured on both the agent and clusterAgent.

I tried to work around this by adding it to the instances in the directory.yaml config like so:

cluster_check: true
init_config:
  service: my-service

instances:
  - directory: "/mnt/my-dir/"
    name: my-dir
    recursive: true
    tags:
      - env: stage

However this then came through as map_env: stage rather than env: stage

Describe what you expected: I expected the DD_ENV configuration to be respected and applied to all metrics emitted by that deployment.

Running agent configcheck I see:

=== directory check ===
Configuration provider: cluster-checks
Configuration source: file:/etc/datadog-agent/conf.d/directory.yaml
Instance ID: directory:my-dir:b100ca2a7e6d491a
directory: /mnt/my-dir/
empty_default_hostname: true
name: my-dir
recursive: true
tags:
- cluster_name:thing-stage
- kube_cluster_name:thing-stage
~

Additional environment details (Operating System, Cloud provider, etc):

vickenty commented 2 years ago

Hi @mnahkies,

This issue queue is primarily to track items related to the Agent core code. For your issue, please contact our support.

Thank you.