New Relic APM agent configuration rollback after schema change
0 reputation · 12 Feb 2021, 01:32 UTC
0 reputation · 12 Feb 2021, 01:32 UTC
Determine whether a New Relic APM agent configuration rolls back cleanly with an application deployment after a database or application schema change, when configuration is split between newrelic.yml and environment variables.
Environment variables generally override YAML values for supported keys, but not every newrelic.yml setting has an environment-variable equivalent, and support varies by agent language and version. Stale environment variables in container images or orchestration manifests can survive a rollback and re-enable a previous configuration unintentionally. New Relic agents do not manage database schema rollback, so agent configuration rollback must be considered separately from schema changes.
Assuming a standard containerized deployment with both newrelic.yml and environment-variable configuration, which agent keys remain YAML-only, and do persisted environment variables override restored YAML values after rollback?
35275 reputation · 12 Feb 2021, 08:37 UTC
Restoring newrelic.yml with an application rollback does not by itself roll back New Relic APM agent configuration. For any key that has a documented environment-variable equivalent, a persisted environment variable overrides the restored YAML value when the agent starts. New Relic APM agents do not roll back database or application schema changes, and they do not automatically clear stale environment variables during a deployment rollback.
Assumptions: containerized deployment, configuration split between newrelic.yml and environment variables, and the agent is restarted as part of deployment or rollback. The exact agent language and version are not specified, so exact overridable keys cannot be listed here.
Environment variables override newrelic.yml only for keys with documented equivalents in that agent version; keys without an equivalent remain YAML-only. Do not assume every newrelic.yml key has an environment-variable equivalent. Dockerfile ENV instructions survive an image rollback. Kubernetes Deployment env fields revert with kubectl rollout undo only when they are part of the changed pod-template spec; separately managed ConfigMaps, Secrets, and image-built ENV do not automatically revert. If the variable remains set, it can re-enable the previous configuration after rollback.
kubectl exec deployment/example -- env | grep -i newrelic
kubectl get deployment example -o yaml | grep -i -A8 'env:'
docker history --format '{{.CreatedBy}}' example:tag | grep -i newrelic
kubectl logs deployment/example -c app | grep -iE 'newrelic|config|override'Replace example, app, and tag with your deployment, container, and image values.
kubectl rollout restart deployment/example
Script agent-configuration rollback independently from application and database schema rollback. A database schema rollback does not undo agent instrumentation or configuration, and a config rollback should not be used as a substitute for schema rollback. Test the combined sequence in staging before production.
Which New Relic agent language and exact version are in use? This changes the recommendation because the set of keys with environment-variable overrides, and therefore the YAML-only keys, differs by agent and version. Exact key names require verification against the agent documentation for your version.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.