DataDog / heroku-buildpack-datadog

Heroku Buildpack to run the Datadog Agent in a Dyno
https://www.datadoghq.com/
Apache License 2.0
69 stars 94 forks source link

Setting `DD_USE_HEROKU_POSTGRES` does not result in Database Monitoring #335

Closed nertzy closed 1 year ago

nertzy commented 1 year ago

I have set the new DD_USE_HEROKU_POSTGRES variable on my deployment.

When I run agent-wrapper status via heroku ps:exec, I see:

    postgres (13.4.0)
    -----------------
      Instance ID: postgres:[REDACTED] [OK]
      Configuration Source: file:/app/.apt/etc/datadog-agent/conf.d/postgres.d/conf.yaml
      Total Runs: 45
      Metric Samples: Last Run: 105, Total: 4,725
      Events: Last Run: 0, Total: 0
      Service Checks: Last Run: 1, Total: 45
      Average Execution Time : 15ms
      Last Execution Date : 2023-05-08 21:59:08 UTC (1683583148000)
      Last Successful Execution Date : 2023-05-08 21:59:08 UTC (1683583148000)
      metadata:
        resolved_hostname: [REDACTED].web.1
        version.major: 15
        version.minor: 2
        version.patch: 0
        version.raw: 15.2 (Ubuntu 15.2-1.pgdg20.04+1)
        version.scheme: semver

Those timestamps are current. Everything looks good like it should be running.

But when I go to APM > Database Monitoring in the Datadog interface, nothing shows up.

Here is the generated /app/.apt/etc/datadog-agent/conf.d/postgres.d/conf.yaml file:

init_config:

instances:

  - host: ec2-[REDACTED].compute-1.amazonaws.com
    username: datadog
    password: [REDACTED]
    port: 5432
    dbname: [REDACTED]
    ssl: True
    disable_generic_tags: false

I noticed that the instance does not contain dbm: true. Is this why nothing is showing up for me? Is there a way to enable this?

nertzy commented 1 year ago

I was able to confirm that this was the problem, by throwing a quick workaround into my datadog/prerun.sh file:

echo -e "    dbm: true" >> "$POSTGRES_CONF/conf.yaml"