> ## Documentation Index
> Fetch the complete documentation index at: https://www.qovery.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Datadog on Qovery: service tags, log annotations and uninstalling the agent

> Find Qovery services by name in Datadog, fix Datadog autodiscovery annotations that break a deployment, and remove the Datadog agent from a cluster.

This page covers three questions that come up once the Datadog agent runs on a Qovery cluster. To install the agent, follow [Datadog](https://www.qovery.com/docs/configuration/integrations/observability/datadog.md) first.

## Services show up as app-z1234abcd in Datadog

In Datadog, `kube_service`, `container_name` and similar tags carry the Kubernetes names Qovery generates, such as `app-z1a2b3c4d`, not the names you gave your services. Dashboards are hard to read, and filtering by team or environment is not possible.

### Fix: add Unified Service Tagging labels

Attach the Datadog standard labels to your services with [Labels & Annotations](https://www.qovery.com/docs/configuration/organization/labels-annotations.md):

1. Go to **Organization Settings**, then **Labels & Annotations**, and add a label group with:

   | Label | Example value |
   | - | - |
   | `tags.datadoghq.com/service` | `checkout-api` |
   | `tags.datadoghq.com/env` | `production` |
   | `tags.datadoghq.com/version` | `1.4.2` |

   Add your own labels too, for example `team: payments`.
2. Assign the label group to the service.
3. Redeploy the service. Labels are applied at deployment.

Datadog then sets the `service`, `env` and `version` tags on the metrics, logs and traces of the service. See [Unified Service Tagging](https://www.qovery.com/docs/configuration/integrations/observability/datadog.md#unified-service-tagging).

Label groups apply to applications, cron jobs, lifecycle jobs and databases. For a Helm service, set the labels in the values of the chart.

### Alternative: turn environment variables into tags

The Datadog agent can also copy environment variables of a container into tags. This was the usual workaround before labels were available, and it still works. In the values of your Datadog Helm service:

```yaml theme={null}
agents:
  useConfigMap: true
  customAgentConfig:
    container_env_as_tags:
      SERVICE_DISPLAY_NAME: "service_name"
      TEAM: "team"
```

Create the `SERVICE_DISPLAY_NAME` and `TEAM` variables on your services, redeploy them, then redeploy the Datadog service. These tags are attached to containers, not to pods, so pod-level views in Datadog do not show them.

## Logs are missing or the deployment fails after adding a Datadog log annotation

You added a Datadog autodiscovery annotation to a service, for example:

```text theme={null}
ad.datadoghq.com/my-container.logs: [{"source": "nodejs", "service": "checkout-api"}]
```

and Datadog does not collect the logs as configured, or the service no longer deploys.

### Logs are missing or untagged

The Datadog agent reads the annotation after the pod starts. A mistake in it changes what the agent collects, not how the pod is scheduled or becomes ready. Check these points in the annotation group:

* **The key names the container.** The part between `ad.datadoghq.com/` and `.logs` must be the name of the container in the pod, not the name of the service in Qovery. Get it with `kubectl get pod <pod-name> -n <namespace> -o jsonpath='{.spec.containers[*].name}'`.
* **The value is valid JSON.** It must be a JSON array, with double quotes around every key and string. A trailing comma or single quotes make it invalid.
* **The scope is right.** Datadog reads autodiscovery annotations on pods. Set the scope of the annotation group to pods.

Then redeploy the service. See [Datadog Autodiscovery Annotations](https://www.qovery.com/docs/configuration/integrations/observability/datadog.md#datadog-autodiscovery-annotations).

### The deployment fails

The agent does not take part in the rollout, so look for the cause in the deployment itself. Open the deployment logs and the Kubernetes events of the service, and read the first error line. If it mentions the annotation, Kubernetes rejected its key: a key is an optional prefix, a `/`, and a name of at most 63 characters made of letters, digits, `-`, `_` and `.`.

## Uninstall the Datadog agent

How you remove the agent depends on how it was installed.

**Installed as a Qovery Helm service** (the method in the [Datadog guide](https://www.qovery.com/docs/configuration/integrations/observability/datadog.md)): stop the Datadog Helm service, then delete it (three-dot menu, **Remove helm**). Deleting a Helm service removes all the Kubernetes resources created by the chart. From the CLI: `qovery helm stop -n <datadog-service> --watch`, then `qovery helm delete -n <datadog-service> --watch`. These commands use the organization, project and environment selected with `qovery context set`; run it first, or add `--organization`, `--project` and `--environment`. See [Delete a Helm service](https://www.qovery.com/docs/configuration/helm.md#delete-service).

**Installed by hand with Helm or kubectl:** connect to the cluster (see [Connect to your cluster](https://www.qovery.com/docs/configuration/connect-to-cluster.md)) and remove it the same way:

```bash theme={null}
# Find the release and its namespace
helm list --all-namespaces | grep -i datadog

# Uninstall it
helm uninstall <release-name> -n <namespace>
```

If the release is gone but agent pods remain, and the namespace contains nothing else, delete the namespace:

```bash theme={null}
kubectl delete namespace <datadog-namespace>
```

After removing the agent, remove the Datadog labels and annotations you no longer need, and the `DD_*` variables of your services, then redeploy them.

## Still stuck?

Contact Qovery support from the Console: click the help button at the bottom right, then **Contact Support**. You can also post in your dedicated Slack channel. Include the Console URL of the service, the deployment ID or the time of the error, and the error line from the logs. See [Help and Support](https://www.qovery.com/docs/getting-started/useful-resources/help-and-support.md).


## Related topics

- [Datadog](https://www.qovery.com/docs/configuration/blueprints/helm-datadog.md)
- [Datadog Integration](https://www.qovery.com/docs/configuration/integrations/observability/datadog.md)
- [Troubleshooting](https://www.qovery.com/docs/getting-started/troubleshoot/overview.md)
- [Expose a Qovery Service on Your Tailnet with Tailscale](https://www.qovery.com/docs/getting-started/guides/advanced-tutorials/tailscale-expose-service.md)
- [qovery log](https://www.qovery.com/docs/cli/commands/log.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.