# newrelic/newrelic-diagnostics-cli architecture

> Architecture diagram of the GitHub repository newrelic/newrelic-diagnostics-cli, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/newrelic/newrelic-diagnostics-cli
- Repository: https://github.com/newrelic/newrelic-diagnostics-cli

## Overview

nrdiag is a cross-platform diagnostics CLI for finding configuration, connectivity, and compatibility problems in New Relic-supported products. Users run it with selected suites or tasks; the CLI selects and registers checks, executes them, and presents diagnostic results. Checks span shared host and agent diagnostics plus technology-specific domains, including Kubernetes and synthetics. Results can also be packaged and uploaded to a New Relic account. The graph follows relationships visible in the excerpts, SOURCE INDEX, or README; unsampled task internals are represented at their existing directories.

Main entry points: [`registration/registerTasks.go`](https://github.com/newrelic/newrelic-diagnostics-cli/blob/main/registration/registerTasks.go) (Task registration), [`processTasks.go`](https://github.com/newrelic/newrelic-diagnostics-cli/blob/main/processTasks.go) (Task runner), [`attach/attach.go`](https://github.com/newrelic/newrelic-diagnostics-cli/blob/main/attach/attach.go) (Result attachment), [`tasks/agentcontrol/agent/connect.go`](https://github.com/newrelic/newrelic-diagnostics-cli/blob/main/tasks/agentcontrol/agent/connect.go) (Agent control)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["CLI orchestration"]
  node_runner["Task runner<br/>[processTasks.go]"]
  node_suites["Suite selection"]
  node_registry["Task registration<br/>[registerTasks.go]"]
end

subgraph group_diagnostics["Diagnostic checks"]
  node_basechecks["Host and agent checks"]
  node_agentcontrol["Agent control<br/>[connect.go]"]
  node_java["Java checks"]
  node_dotnet[".NET checks"]
  node_dotnetcore[".NET Core checks"]
  node_infra["Infrastructure checks"]
  node_languages["Language agent checks"]
  node_kubernetes["Kubernetes checks"]
  node_synthetics["Synthetics checks"]
end

subgraph group_results["Results and delivery"]
  node_output["Result output<br/>[output.go]"]
  node_attachment["Result attachment<br/>[attach.go]"]
end

subgraph group_shared["Shared task layers"]
  node_taskcontract["Task results<br/>[tasks.go]"]
  node_configvalidation["Configuration validation<br/>[validate.go]"]
  node_logcollection["Log collection<br/>[copy.go]"]
  node_http["HTTP client<br/>[httpHelper.go]"]
end

node_user(("CLI user"))
node_newrelic(("New Relic account"))

node_user -->|"runs"| node_runner
node_runner -->|"selects suites"| node_suites
node_runner -->|"registers tasks"| node_registry
node_runner -->|"executes tasks"| node_taskcontract
node_registry -->|"registers checks"| node_basechecks
node_registry -->|"registers checks"| node_agentcontrol
node_registry -->|"registers checks"| node_java
node_registry -->|"registers checks"| node_dotnet
node_registry -->|"registers checks"| node_dotnetcore
node_registry -->|"registers checks"| node_infra
node_registry -->|"registers checks"| node_languages
node_registry -->|"registers checks"| node_kubernetes
node_registry -->|"registers checks"| node_synthetics
node_runner -->|"writes results"| node_output
node_runner -->|"starts upload"| node_attachment
node_output -->|"formats results"| node_taskcontract
node_agentcontrol -->|"makes requests"| node_http
node_attachment -->|"uploads files"| node_http
node_attachment -->|"uploads results"| node_newrelic
node_runner -.->|"executes selected checks"| node_configvalidation
node_runner -.->|"executes selected checks"| node_logcollection

click node_runner "https://github.com/newrelic/newrelic-diagnostics-cli/blob/main/processTasks.go"
click node_suites "https://github.com/newrelic/newrelic-diagnostics-cli/blob/main/suites/suiteDefinitions.go"
click node_registry "https://github.com/newrelic/newrelic-diagnostics-cli/blob/main/registration/registerTasks.go"
click node_taskcontract "https://github.com/newrelic/newrelic-diagnostics-cli/blob/main/tasks/tasks.go"
click node_basechecks "https://github.com/newrelic/newrelic-diagnostics-cli/tree/main/tasks/base"
click node_agentcontrol "https://github.com/newrelic/newrelic-diagnostics-cli/blob/main/tasks/agentcontrol/agent/connect.go"
click node_java "https://github.com/newrelic/newrelic-diagnostics-cli/tree/main/tasks/java"
click node_dotnet "https://github.com/newrelic/newrelic-diagnostics-cli/blob/main/tasks/dotnet/requirements/messagingServicesCheck_windows.go"
click node_dotnetcore "https://github.com/newrelic/newrelic-diagnostics-cli/tree/main/tasks/dotnetcore"
click node_infra "https://github.com/newrelic/newrelic-diagnostics-cli/tree/main/tasks/infra"
click node_languages "https://github.com/newrelic/newrelic-diagnostics-cli/tree/main/tasks/node"
click node_kubernetes "https://github.com/newrelic/newrelic-diagnostics-cli/tree/main/tasks/k8s"
click node_synthetics "https://github.com/newrelic/newrelic-diagnostics-cli/tree/main/tasks/synthetics/minion"
click node_configvalidation "https://github.com/newrelic/newrelic-diagnostics-cli/blob/main/tasks/base/config/validate.go"
click node_logcollection "https://github.com/newrelic/newrelic-diagnostics-cli/blob/main/tasks/base/log/copy.go"
click node_output "https://github.com/newrelic/newrelic-diagnostics-cli/blob/main/output/output.go"
click node_attachment "https://github.com/newrelic/newrelic-diagnostics-cli/blob/main/attach/attach.go"
click node_http "https://github.com/newrelic/newrelic-diagnostics-cli/blob/main/helpers/httpHelper/httpHelper.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_runner,node_suites,node_registry,node_user toneBlue
class node_basechecks,node_agentcontrol,node_java,node_dotnet,node_dotnetcore,node_infra,node_languages,node_kubernetes,node_synthetics toneAmber
class node_output,node_attachment toneMint
class node_taskcontract,node_configvalidation,node_logcollection,node_http toneRose
class node_newrelic toneIndigo
```

## Components

### CLI orchestration

- [Task runner](https://github.com/newrelic/newrelic-diagnostics-cli/blob/main/processTasks.go): `processTasks.go`
- [Suite selection](https://github.com/newrelic/newrelic-diagnostics-cli/blob/main/suites/suiteDefinitions.go): `suites/suiteDefinitions.go`
- [Task registration](https://github.com/newrelic/newrelic-diagnostics-cli/blob/main/registration/registerTasks.go): `registration/registerTasks.go`

### Diagnostic checks

- [Host and agent checks](https://github.com/newrelic/newrelic-diagnostics-cli/tree/main/tasks/base): `tasks/base`
- [Agent control](https://github.com/newrelic/newrelic-diagnostics-cli/blob/main/tasks/agentcontrol/agent/connect.go): `tasks/agentcontrol/agent/connect.go`
- [Java checks](https://github.com/newrelic/newrelic-diagnostics-cli/tree/main/tasks/java): `tasks/java`
- [.NET checks](https://github.com/newrelic/newrelic-diagnostics-cli/blob/main/tasks/dotnet/requirements/messagingServicesCheck_windows.go): `tasks/dotnet/requirements/messagingServicesCheck_windows.go`
- [.NET Core checks](https://github.com/newrelic/newrelic-diagnostics-cli/tree/main/tasks/dotnetcore): `tasks/dotnetcore`
- [Infrastructure checks](https://github.com/newrelic/newrelic-diagnostics-cli/tree/main/tasks/infra): `tasks/infra`
- [Language agent checks](https://github.com/newrelic/newrelic-diagnostics-cli/tree/main/tasks/node): `tasks/node`
- [Kubernetes checks](https://github.com/newrelic/newrelic-diagnostics-cli/tree/main/tasks/k8s): `tasks/k8s`
- [Synthetics checks](https://github.com/newrelic/newrelic-diagnostics-cli/tree/main/tasks/synthetics/minion): `tasks/synthetics/minion`

### Results and delivery

- [Result output](https://github.com/newrelic/newrelic-diagnostics-cli/blob/main/output/output.go): `output/output.go`
- [Result attachment](https://github.com/newrelic/newrelic-diagnostics-cli/blob/main/attach/attach.go): `attach/attach.go`

### Shared task layers

- [Task results](https://github.com/newrelic/newrelic-diagnostics-cli/blob/main/tasks/tasks.go): `tasks/tasks.go`
- [Configuration validation](https://github.com/newrelic/newrelic-diagnostics-cli/blob/main/tasks/base/config/validate.go): `tasks/base/config/validate.go`
- [Log collection](https://github.com/newrelic/newrelic-diagnostics-cli/blob/main/tasks/base/log/copy.go): `tasks/base/log/copy.go`
- [HTTP client](https://github.com/newrelic/newrelic-diagnostics-cli/blob/main/helpers/httpHelper/httpHelper.go): `helpers/httpHelper/httpHelper.go`

### Other components

- **CLI user**
- **New Relic account**

## Connections

- CLI user → Task runner: runs
- Task runner → Suite selection: selects suites (evidence: `processTasks.go`)
- Task runner → Task registration: registers tasks (evidence: `processTasks.go`)
- Task runner → Task results: executes tasks (evidence: `processTasks.go`)
- Task registration → Host and agent checks: registers checks (evidence: `registration/registerTasks.go`)
- Task registration → Agent control: registers checks (evidence: `registration/registerTasks.go`)
- Task registration → Java checks: registers checks (evidence: `registration/registerTasks.go`)
- Task registration → .NET checks: registers checks (evidence: `registration/registerTasks.go`)
- Task registration → .NET Core checks: registers checks (evidence: `registration/registerTasks.go`)
- Task registration → Infrastructure checks: registers checks (evidence: `registration/registerTasks.go`)
- Task registration → Language agent checks: registers checks (evidence: `registration/registerTasks.go`)
- Task registration → Kubernetes checks: registers checks (evidence: `registration/registerTasks.go`)
- Task registration → Synthetics checks: registers checks (evidence: `registration/registerTasks.go`)
- Task runner → Result output: writes results (evidence: `processTasks.go`)
- Task runner → Result attachment: starts upload (evidence: `processTasks.go`)
- Result output → Task results: formats results (evidence: `output/output.go`)
- Agent control → HTTP client: makes requests (evidence: `tasks/agentcontrol/agent/connect.go`)
- Result attachment → HTTP client: uploads files (evidence: `attach/attach.go`)
- Result attachment → New Relic account: uploads results
- Task runner → Configuration validation: executes selected checks
- Task runner → Log collection: executes selected checks
