Custom Diagram Creator

Getting started

Install the app in your Dynatrace environment and open your first live diagram.

Requirements

  • A Dynatrace SaaS environment on the platform with AppEngine, where you are allowed to install custom apps.
  • For the people who use the app: permissions for the scopes listed below (DQL access to entities, events and the data your KPIs query).
  • To deploy, either a GitHub account (GitHub Codespaces, nothing to install — next section) or Node.js 20.19 or later and npm on your machine (steps 1 to 5).

Deploy from GitHub Codespaces

The repository includes a dev container: a codespace starts with Node.js and every dependency installed. You provide two values — your environment URL and a platform token — and run one command.

Open in GitHub Codespaces

1. Create a platform token

Go to My platform tokens, select Platform token, give it a name and an expiration date, choose your environment and add these scopes:

  • app-engine:apps:install
  • app-engine:apps:run
  • app-engine:apps:delete

Select Generate and copy the token — it is shown only once. A platform token works within the permissions of its user, so that user must be allowed to install apps in the environment. See Platform tokens in the Dynatrace documentation.

2. Create the codespace

Use the button above, or Code › Codespaces › Create codespace on main in the repository. The first time, the creation page asks for two recommended secrets:

SecretValue
DT_APP_ENVIRONMENT_URLhttps://<environment-id>.apps.dynatrace.com — the platform URL, with .apps.
DT_APP_PLATFORM_TOKENthe token from step 1

GitHub stores them as Codespace user secrets of your own GitHub account — not in the repository — with access to this repository, and passes them to the codespace as environment variables. From then on the creation page only shows them as Associated with repository and reuses them; the deploy step below lets you use other values anyway. Other people who open a codespace from the repository are asked for their own values. While the codespace starts, npm ci installs the dependencies, and the terminal shows where the app will be deployed.

3. Deploy

In the codespace terminal:

bash
npm run deploy:token

It asks for the environment URL and the platform token, showing your saved values: press Enter to keep them, or type another environment's URL and token to deploy there (nothing is saved). scripts/deploy.sh then builds the app and installs it in that environment (it takes precedence over app.config.json), authenticating with the token instead of a browser sign-in, and prints the link to the app. Extra arguments go to dt-app deploy, e.g. npm run deploy:token -- --dry-run; --yes skips the questions (CI).

Where the saved values are

In your account, not in the repository: your avatar › Settings › Codespaces › Codespace user secrets (github.com/settings/codespaces). Repository › Settings › Secrets › Codespaces stays empty — and should: secrets there would be shared by everyone who opens a codespace from the repository.

Deploying to another environment

You don't have to delete anything — pick one:

You want to…Do this
Deploy once to another environmentIn the codespace, run npm run deploy:token and type that environment's URL and token. Your saved values stay as they are.
Change the default for your codespacesEdit the two secrets (pencil) in Codespace user secrets. New codespaces use the new values; a running one after a restart.
Be asked on the creation page againDelete the two secrets (trash), or remove this repository from their Repository access.

Without secrets you can also copy .env.example to .env (ignored by git) or export the values:

bash
export DT_APP_ENVIRONMENT_URL=https://<environment-id>.apps.dynatrace.com
export DT_APP_PLATFORM_TOKEN=<your-platform-token>
npm run deploy:token

Secrets you add later in GitHub › Settings › Codespaces reach a running codespace only after you restart it. The same script works on any Linux or macOS shell, or Git Bash on Windows.

1. Clone and install

bash
git clone https://github.com/Edunzz/dynatrace_apps_custom_diagram_creator.git
cd dynatrace_apps_custom_diagram_creator
npm install

2. Point it to your environment

Open app.config.json and set your environment URL. The app id my.custom.diagram.creator can stay as it is; change it only if you want to install two copies side by side.

json
{
  "environmentUrl": "https://<your-environment-id>.apps.dynatrace.com/",
  "app": {
    "id": "my.custom.diagram.creator",
    "version": "0.10.1"
  }
}

3. Run it locally (optional)

The development server opens your browser, asks you to sign in with SSO and proxies every platform call with your permissions.

bash
npm run start

4. Deploy

Build and install the app in the environment from app.config.json. The first deploy opens the browser to sign in with SSO; to use a platform token instead, run npm run deploy:token as described in Deploy from GitHub Codespaces.

bash
npm run deploy

Every redeploy needs a new version number: bump version in app.config.json (and in package.json) before running npm run deploy again.

5. Open your first diagram

Open https://<your-environment-id>.apps.dynatrace.com/ui/apps/my.custom.diagram.creator. The first time the app opens it creates the lookup table /lookups/custom-diagram-creator/diagrams with the sample diagram Sample – EasyTrade trading platform — the EasyTrade demo application end to end, which lights up in environments that run EasyTrade — and shows a "Diagram storage created" notification.

Environments that already have diagrams receive a new sample once; a sample you delete doesn't come back. The samples of earlier versions (Online Banking and Platform signals) are removed from the list, unless someone saved them since they were added.

Open the sample, switch to Edit and click any component to see the floating toolbar, or double-click it to open its editor. The user guide walks through every feature.

App scopes

The app asks for these scopes when it is installed, so its queries can read every kind of telemetry in Grail. Scopes are the upper limit: each user still needs the matching IAM permissions to see the data.

ScopeWhy
storage:smartscape:read, storage:entities:readEntity picker and entity queries (Smartscape and classic)
storage:events:readEvents, Davis events and Davis problems (dt.davis.problems)
storage:metrics:read, storage:logs:read, storage:spans:read, storage:bizevents:readMetrics, logs, traces and business events in KPI queries
storage:security.events:read, storage:user.events:read, storage:user.sessions:read, storage:user.replays:read, storage:application.snapshots:readSecurity events, RUM and snapshots in KPI queries
storage:system:read, storage:fieldsets:read, storage:buckets:readdt.system.* data, protected fields and bucket access required by Grail
storage:files:readAny lookup table (load / lookup in KPI queries), including the diagrams lookup
storage:files:write, storage:files:deleteWrite and delete the diagrams lookup
slo:slos:read, slo:objective-templates:readList and evaluate SLOs

Troubleshooting

SymptomWhat to check
A component is grayIts query failed or returned no rows. Hover the status icon or open View details to see the Grail message.
Errors mention missing scopes or permissionsThe user (or the app) lacks a scope from the table above for that data object.
Deploy fails right after a previous deployThe version in app.config.json wasn't bumped.
npm run deploy:token says Missing: DT_APP_…Run it in a terminal and type the values, or set them as secrets (restart the codespace afterwards), in .env or with export.
The codespace creation page no longer asks for the URL and tokenGitHub only asks while your account doesn't have those secrets; it reuses the saved ones. npm run deploy:token asks for both, or edit or delete them in your account: Settings › Codespaces › Codespace user secrets.
The repository's Settings › Secrets › Codespaces is emptyExpected: the values you typed are Codespace user secrets of your account (github.com/settings/codespaces), not repository secrets.
Deploy fails with 401 UnauthorizedThe platform token is wrong, expired or lacks the app-engine:apps:* scopes, or its user can't install apps.
The list is empty after deleting the lookupReload the page: the app creates the table again with the sample diagrams.
The entity picker is emptyIt lists the entities of the chosen type seen in the last 7 days. Check the component type and that you can query Smartscape.
A custom query returns UNKNOWN_DATA_OBJECTNewer environments don't have dt.entity.* tables. Use smartscapeNodes instead.