Skip to content

Introduce AutoMonitor for simpler enablement of Application Signals #309

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 64 commits into from
May 9, 2025

Conversation

the-mann
Copy link
Contributor

@the-mann the-mann commented May 9, 2025

duplicate of: #297

Description of changes: Introduce Auto Monitor for Application Signals on K8s which provides an easier onboarding experience. When enabled, the Operator can auto-instrument K8s workloads that are associated with K8s services as they come up automatically without requiring explicit opt-in via workload specific annotations.

The operator now accepts a new arg auto-monitor-config that has the following structure:

{
  "monitorAllServices": false,
  "languages": [],
  "restartPods": false,
  "customSelector": {
    "java": {
      "namespaces": [], "deployments": [], "daemonsets": [], "statefulsets": []
    },
    "python": {
      "namespaces": [], "deployments": [], "daemonsets": [], "statefulsets": []
    },
    "dotnet": {
      "namespaces": [], "deployments": [], "daemonsets": [], "statefulsets": []
    },
    "nodejs": {
      "namespaces": [], "deployments": [], "daemonsets": [], "statefulsets": []
    }
  },
  "exclude": {
    "java": {
      "namespaces": [], "deployments": [], "daemonsets": [], "statefulsets": []
    },
    "python": {
      "namespaces": [], "deployments": [], "daemonsets": [], "statefulsets": []
    },
    "dotnet": {
      "namespaces": [], "deployments": [], "daemonsets": [], "statefulsets": []
    },
    "nodejs": {
      "namespaces": [], "deployments": [], "daemonsets": [], "statefulsets": []
    }
  }
}
  • monitorAllServices: Enable AutoMonitor for all services in the cluster i.e. for any K8s workloads that are brought up in the cluster, auto-instrument them. Defaults to false i.e. not enabled.
  • langugages: Specify the list of languages that AutoMonitor should inject auto-instrumentation for. Defaults to all supported languages.
  • restartPods: When enabled, restart pods that are already running on the cluster corresponding to K8s workloads that now fall under the scope of AutoMonitor. Defaults to false i.e. not enabled.
  • customSelector: Provides more granular control to explicitly specify namespaces and workloads that should be auto-instrumented. Can be specified even if monitorAllServices is disabled.
  • exclude: Similar to customSelector, but is instead used to deny specific namespaces or workloads from getting auto-instrumented when monitorAllServices is enabled. Takes precedence over customSelector in the case of conflicts.

Additional Notes:

  • customSelector with restartPods enabled serves as a replacement for the existing auto-annotation-config arg. auto-annotation-config will be deprecated entirely in a future release. Using both is consider invalid and will continue to respect auto-annotation-config in such scenarios.
  • monitorAllServices by default does not auto-instrument services in the kube-system and amazon-cloudwatch namespaces. If you require services in these namespaces to be auto-instrumented, you can explicitly specify them using customSelector.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

the-mann added 30 commits March 10, 2025 10:06
…h AutoMonitor and AnnotationMutators, check if safe to mutate before applying custom selector, run opt out tests for each type of workload, test opt out by disabling monitorallservices
CustomSelectors should obey autoRestart, autoAnnotateAutoInstrumentation shouldn't. Rename MonitorInterface to InstrumentationAnnotator. Add docs.
…ntation container validation by default.

This is required for automonitor to work, because it tries to apply all init containers to each selected pod.
…el custom selector should not update pod template
…art namespace for autoAnnotateAutoInstrumentation.
the-mann added 24 commits April 25, 2025 14:56
a namespaced name of a "namespace-a" is just "namespace-a", not "namespace-a/namespace-a"
…hNamespaces so Monitor's MutateAndPatchAll can trigger different behavior separately based on RestartPods
…el if automonitor is enabled.

this prevents multi instrumentation unit tests from failing
@sky333999 sky333999 changed the title AutoMonitor Introduce AutoMonitor for simpler enablement of Application Signals May 9, 2025
@sky333999 sky333999 merged commit ab616e5 into main May 9, 2025
28 of 31 checks passed
@sky333999 sky333999 deleted the mpmann/appsignals-1-step branch May 9, 2025 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants