Git Product home page Git Product logo

backstage-plugin's Introduction

Dynatrace Backstage Plugins

Context-rich observability and security insights at hand - The Dynatrace Backstage plugins enable you to fetch observability and security data from Dynatrace to be displayed at software components managed in your Backstage Software Catalog. The data is in tabular format with smart links to Dynatrace Apps for deeper analysis and root cause investigation in case of a related problem or security vulnerability.

The plugins support Kubernetes entities by default. This means that it comes with a pre-configured query for Kubernetes deployments and a dedicated component for data representation.

This repository contains a complete Backstage installation at its root, with the individual plugins in the plugins directory. Backstage is configured to include the plugins so you can start the app and see them in action.

Table of contents:

Overview

Three plugins are required to fetch and visualize the data from Dynatrace:

  • DQL - A plugin showing DQL query results from Dynatrace in Backstage.
  • DQL Backend - The backend for the DQL plugin.
  • DQL Common - Common functionality shared between the DQL frontend and backend plugin.

With the Backstage plugins, the Backstage Software Catalog component can be associated with real-time monitoring data. The screenshot shows three Kubernetes deployments of the easytrade-frontend component running in different namespaces, i.e., development, hardening, and production. The table provides smart links for more details about the workload and logs in Dynatrace.

Kubernetes deployments monitored by Dynatrace

While Kubernetes deployments are supported by default, any data can be fetched from Dynatrace and displayed in Backstage. See below how to configure custom queries.

Getting Started

Next are the instructions to install, integrate, configure, and run the Dyantrace Backstage plugins.

Install Plugins

We are publishing our packages to NPM and removed the release candidate (v1.0.0-rc1) packages from the GitHub registry. If you were using the v1.0.0-rc1 packages, please update your .yarnrc.yml correspondingly.

Install the DQL plugins into Backstage:

yarn --cwd packages/app add @dynatrace/backstage-plugin-dql
yarn --cwd packages/backend add @dynatrace/backstage-plugin-dql-backend
yarn --cwd packages/backend add @dynatrace/backstage-plugin-dql-common

Integrate the EntityDqlQueryCard

Add the DQL plugin to the respective component type pages in your packages/app/src/components/catalog/EntityPage.tsx:

<EntityDqlQueryCard
  title="Kubernetes Deployments"
  queryId="dynatrace.kubernetes-deployments"
/>

See the EntityPage.tsx file in this repository (packages/app/src/components/catalog/EntityPage.tsx) for a full example.

Integrate the DQL Backend Plugin

Add the DQL backend plugin to in packages/backend/src/index.ts:

const backend = createBackend();
...
backend.add(import('@dynatrace/backstage-plugin-dql-backend'));
...

See the index.ts file in this repository (packages/backend/src/index.ts) for a full example.

Add Dynatrace Environment Connection

Before configuring a Dynatrace connection, an OAuth 2.0 client is required.

How to create an OAuth 2.0 client
  1. In Dynatrace, go to Account Management.
  2. Select Identity & access management > OAuth clients.
  3. Select Create client.
  4. Enter a client description and the user email.
  5. Select at least the following scopes.
    • storage:metrics:read
    • storage:entities:read
    • storage:events:read
    • storage:buckets:read
  6. Scroll down and select Create client.
  7. Copy your client ID, client secret, and Dynatrace account URN. These settings are required for the Backstage plugin configuration.

Create or update the app-config.local.yaml file (excluded by .gitignore) configuring the connection to the Dynatrace environment:

dynatrace:
  environments:
    - name: xxxxxxxx
      url: https://xxxxxxxx.sprint.apps.dynatracelabs.com
      tokenUrl: https://sso-sprint.dynatracelabs.com/sso/oauth2/token
      accountUrn: <accountUrn>
      clientId: <clientId>
      clientSecret: <clientSecret>

See below how to configure multiple Dynatrace environments.

Run Backstage with Dynatrace Plugins

To start the app, run:

yarn install
yarn dev

Backstage is pre-configured but relies on appropriate data to be available in the demo Dynatrace environment. See catalog-info.yaml for details.

Additional Features

Find here additional features to customize the plugin for different requirements.

Multi-environment Support

If the component in Backstage should display data from multiple Dynatrace environments, add each Dynatrace environment to the dynatrace.environments list in the app-config.local.yaml file.

dynatrace:
  environments:
    - name: xxxxxxxx
      url: https://xxxxxxxx.apps.dynatrace.com
      tokenUrl: https://sso.dynatrace.com/sso/oauth2/token
      accountUrn: <accountUrn>
      clientId: <clientId>
      clientSecret: <clientSecret>
    - name: yyyyyyyy
      url: https://yyyyyyyy.apps.dynatrace.com
      tokenUrl: https://sso.dynatrace.com/sso/oauth2/token
      accountUrn: <accountUrn>
      clientId: <clientId>
      clientSecret: <clientSecret>

Kubernetes Use Case

Using the EntityKubernetesDeploymentsCard, you can see the Kubernetes deployments in your Dynatrace environment.

<EntityKubernetesDeploymentsCard
  title="Show me my Kubernetes deployments"
  queryId="dynatrace.kubernetes-deployments"
/>

Convention: Kubernetes pods will be listed for the corresponding Backstage component if they are properly annotated in the deployment descriptor. See annotations.

Example:

backstage.io/kubernetes-id: <backstage-namespace>.<backstage-component-name> *)
backstage.io/kubernetes-namespace: namespace
backstage.io/kubernetes-label-selector: stage=hardening,name=frontend

*) While any value can be defined, it is recommended to set the backstage namespace followed by the component name.

  • The annotation backstage.io/kubernetes-id will look for the Kubernetes label backstage.io/kubernetes-id.
  • The annotation backstage.io/kubernetes-namespace will look for the Kubernetes namespace.
  • The annotation backstage.io/kubernetes-label-selector will look for the labels defined in it. So backstage.io/kubernetes-label-selector: stage=hardening,name=frontend will look for a Kubernetes label stage with the value hardening and a label name with the value frontend.

If a backstage.io/kubernetes-label-selector is given, backstage.io/kubernetes-id is ignored.

If no namespace is given, it looks for all namespaces. There is no fallback to default.

The query for fetching the monitoring data for Kubernetes deployments is defined here: dynatrace.kubernetes-deployments. You can change this query for all cards or override it using a custom query.

Site Reliability Guardian Validations

Using the EntityDqlQueryCard with the queryId dynatrace.srg-validations, you can see the validations of the site reliability guardians in your Dynatrace environment.

<EntityDqlQueryCard
  title="Site Reliability Guardian Validations"
  queryId="dynatrace.srg-validations"
/>

To filter for specific guardians, you can filter tags defined in the metadata.annotations property of the catalog-info.yaml file under the key dynatrace.com/guardian-tags.

apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
  name: demo-backstage
  description: Backstage Demo instance.
  annotations:
    backstage.io/kubernetes-id: kubernetescustom
    dynatrace.com/guardian-tags: 'service=my-service,stage=development,novalue'

There are two ways to filter tags:

  1. Key-Value Match: The tag must match both the key and the value. For example, the key service must have the value my-service.
  2. Key Exists: The tag key must exist with any value. For example, the key novalue.

The difference between these filtering methods is indicated by the presence of the = symbol.

For the example provided above, the filtered guardian should have at least these tags:

service: my-service
stage: development
novalue:

See How to create a Site Reliability Guardian and Guardian tags.

The query for fetching the monitoring data for Site Reliability Guardian validations is defined here: dynatrace.srg-validations. You can change this query for all cards or override it using a custom query.

Custom Queries

You can also register your custom queries and use them with EntityDqlQueryCard:

dynatrace:
  queries:
    - id: my-custom-query
      query: >
        fetch events | filter event.kind == "DAVIS_EVENT" | fields event.kind,
        timestamp

Queries can contain placeholders, which will be replaced with the values from the context in which it is executed. These placeholders are prefixed with $$ in order to escape the environment variable substitution of Backstage. The following placeholders are available:

  • $${componentNamespace} the namespace of the Backstage component, as defined in the Backstage catalog
  • $${componentName} the name of the Backstage component, as defined in the Backstage catalog
  • $${environmentName} the name of the environment (e.g. production), as defined in the Dynatrace environment configuration
  • $${environmentUrl} the URL of the environment (e.g. https://my-environment.dynatrace.com), as defined in the Dynatrace environment configuration

For example, to filter for the events of the component, you could use the following in your query:

filter backstageComponent == "$${componentNamespace}.$${componentName}"

To be able to render correctly, the DQL must return data conforming to the following:

  • No null values; use coalesce to replace null values with a default value
  • May contain simple types:
    • Strings (e.g. Name: 'My Name')
  • May contain complex types that have a type discriminator (type):
    • Links: (e.g. Logs: { type: 'link', title: 'Link to Logs', url: 'https...' })
  • As a fallback, other types will be rendered as JSON

An example of a valid DQL result would be:

[
  {
    "Name": "backstage",
    "Namespace": "hardening",
    "Link": {
      "type": "link",
      "text": "Click me",
      "url": "https://backstage.io"
    }
  }
]

To include the result table for your custom query, you would reference the query by its ID with the custom. prefix:

<EntityDqlQueryCard
  title="My Custom Query Results"
  queryId="custom.my-custom-query"
/>

Custom Queries within the catalog-info.yaml file of the Backstage Entity

You can register custom queries in the metadata.dynatrace.queries property of a component within the catalog-info.yaml file

apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
  name: demo-backstage
  description: Backstage Demo instance.
  annotations:
    backstage.io/kubernetes-id: kubernetescustom
    dynatrace.com/guardian-tags: 'service=my-service,stage=development,novalue'
  dynatrace:
    queries:
      - id: Error Logs
        description: Fetch Error Logs
        query: >
          fetch logs, from: -2d
                | filter status == "ERROR"
                | sort timestamp desc
                | fieldsAdd content=if(isNull(content), "N/A", else: content)
                | fieldsAdd source=if(isNull(log.source), "N/A", else:
          log.source)
                | fieldsAdd host=if(isNull(host.name), "N/A", else: host.name)
                | fieldsAdd environment = "${environmentName}"
                | fieldsKeep timestamp, source, content, host, environment
spec:
  type: website
  owner: user:default/mjakl
  lifecycle: experimental
  system: integrations

As mentioned before, queries can contain placeholders. In the catalog-info.yaml file, the placeholders are prefixed with a single $. Please find the supported placeholders listed here.

To include the result tables for the custom queries of the entity, you would use:

<EntityCatalogInfoQueryCard />

This component displays a result table for each query. The order in which the tables are displayed depends on the order of the entity's queries defined in the catalog-info.yaml file.

Optional environment limitation for custom queries

It is possible to specify the environments in which each query defined in the app-config.yaml and catalog-info.yaml is executed.

By default, queries are executed against all defined environments.

Example query defined in catalog-info.yaml with environment limitation:

apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
  name: demo-backstage
  description: Backstage Demo instance.
  annotations:
    backstage.io/kubernetes-id: kubernetescustom
    dynatrace.com/guardian-tags: "service=my-service,stage=development,novalue"
  dynatrace:
    queries:
      - id: Error Logs
        description: Fetch Error Logs
        environments:
          - tenant1
          - tenant2
        query: >
          fetch logs, from: -2d
                | filter status == "ERROR"
                | sort timestamp desc
                | fieldsAdd content=if(isNull(content), "N/A", else: content)
                | fieldsAdd source=if(isNull(log.source), "N/A", else: log.source)
                | fieldsAdd host=if(isNull(host.name), "N/A", else: host.name)
                | fieldsAdd environment = "${environmentName}"
                | fieldsKeep timestamp, source, content, host, environment

The environments defined for a query must align with the environments names configured in the app-config.local.yaml file.

Sample DQL Queries

These are sample custom queries for the app-config.yaml. To use these queries in the catalog-info.yaml, you need to remove one $ from the placeholders.

Query Error Logs:

fetch logs, from: -2d
        | filter status == "ERROR"
        | sort timestamp desc
        | fieldsAdd content=if(isNull(content), "N/A", else: content)
        | fieldsAdd source=if(isNull(log.source), "N/A", else: log.source)
        | fieldsAdd host=if(isNull(host.name), "N/A", else: host.name)
        | fieldsAdd environment = "$${environmentName}"
        | fieldsKeep timestamp, source, content, host, environment

Query Problem Events:

fetch events, from: -2d
        | filter event.kind=="DAVIS_PROBLEM"
        | fieldsAdd category=if(isNull(event.category), "N/A", else: event.category)
        | fieldsAdd id=if(isNull(event.id), "N/A", else: event.id)
        | fieldsAdd status=if(isNull(event.status), "N/A", else: event.status)
        | fieldsAdd name=if(isNull(event.name), "N/A", else: event.name)
        | fieldsAdd environment = "$${environmentName}"
        | fieldsKeep timestamp, category, id, name, status, environment

Query Security Vulnerabilities:

fetch events, from: -2d
        | filter event.provider=="Dynatrace"
        | filter event.kind=="SECURITY_EVENT"
        | filter event.type=="VULNERABILITY_STATUS_CHANGE_EVENT"
        | filter event.level=="VULNERABILITY"
        | fieldsAdd environment = "$${environmentName}"
        | fieldsKeep timestamp, event.status, vulnerability.display_id, event.id, vulnerability.title, vulnerability.risk.level, vulnerability.display_id, environment

Backlink to Dynatrace

To link from a table cell to a Dynatrace app, the DQL query must contain a record with the proper type, text, and url. This is an example to link to the Dynatrace Kubernetes app filtered by Kubernetes pods:

fetch dt.entity.cloud_application, from: -10m
| fieldsAdd Workload = record({type="link", text=entity.name, url=concat("\${environmentUrl}/ui/apps/dynatrace.kubernetes/resources/pod?entityId=", id)})

The query returns a result of:

[
  {
    "Workload": {
      "type": "link",
      "text": "<ENTITY_NAME>",
      "url": "https://<ENVIRONMENT_URL>/ui/apps/dynatrace.kubernetes/resources/pod?entityId=<ENTITY_ID>"
    }
  }
]

Help & Support

This Backstage integration is an open source project. The features are fully supported by Dynatrace.

Get help:

Open a GitHub issue to:

  • Report minor defects, minor items, or typos
  • Ask for improvements or changes
  • Ask any questions related to the community effort
  • Contribute as per our Contribution guidelines

SLAs don't apply for GitHub tickets.

Customers can open a ticket on the Dynatrace support portal to:

  • Get support from the Dynatrace technical support engineering team
  • Manage and resolve product related technical issues

SLAs apply according to the customer's support level.

Contributing

Everyone is welcome to contribute to this repository. See our contributing guidelines, raise issues or submit pull requests.

backstage-plugin's People

Contributors

aepfli avatar agrimmer avatar blasget avatar dependabot[bot] avatar heinzburgstaller avatar johannes-b avatar katharinasick avatar kirdock avatar lalit774 avatar mjakl avatar mrmanny avatar renovate[bot] avatar tannergilbert avatar thammerl avatar tobigremmer-dt avatar torbengallobdynatrace avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

backstage-plugin's Issues

Automate the release process

The release process at the moment is manual, i.e. the release engineer needs to supply a version. Using Changesets as described in #12, it should be possible to make semver conform releases automatially.

The current GitHub Action does not change the repository (i.e. tag release versions or add/change files like a changelog). Tagging and updating the respective changelog would be nice and should be included in the automated release process.

New Backend system No custom query to the given id

Summary

can you please explain this annotations. do we need too add *) in end?
backstage.io/kubernetes-id: . *)

can you please update plugin install commands like that. It will little easy because of one command

yarn --cwd packages/app add @dynatrace/backstage-plugin-dql
yarn --cwd packages/app backend @dynatrace/backstage-plugin-dql-backend
yarn --cwd packages/app backend @dynatrace/backstage-plugin-dql-common

I have installed this new plugin and i am getting following error.

Error:
500: Error
No custom query to the given id "logs" found

Error: No custom query to the given id "logs" found
at QueryExecutor.executeCustomQuery
dql-backend/src/service/router.ts:64:40)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

{
"error": {
"name": "Error",
"message": "No custom query to the given id "logs" found",
"stack": "Error: No custom query to the given id "logs" found\n at QueryExecutor.executeCustomQuery (*plugins/dql-backend/src/service/queryExecutor.ts:50:13)\n at (*plugins/dql-backend/src/service/router.ts:64:40)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"
},
"request": {
"method": "GET",
"url": "/custom/logs?entityRef=component%3Adefault%2Farmada"
},
"response": {
"statusCode": 500
}
}

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Warning

These dependencies are deprecated:

Datasource Name Replacement PR?
npm @material-ui/core Available
npm @material-ui/icons Available
npm @material-ui/lab Unavailable

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore: Update all patch dependency updates (@backstage-community/plugin-github-actions, @backstage-community/plugin-tech-radar, @backstage/app-defaults, @backstage/backend-defaults, @backstage/catalog-client, @backstage/core-app-api, @backstage/core-components, @backstage/dev-utils, @backstage/integration-react, @backstage/plugin-api-docs, @backstage/plugin-app-backend, @backstage/plugin-auth-backend, @backstage/plugin-auth-backend-module-guest-provider, @backstage/plugin-catalog-common, @backstage/plugin-catalog-graph, @backstage/plugin-catalog-import, @backstage/plugin-catalog-react, @backstage/plugin-org, @backstage/plugin-permission-backend, @backstage/plugin-permission-backend-module-allow-all-policy, @backstage/plugin-permission-common, @backstage/plugin-permission-node, @backstage/plugin-permission-react, @backstage/plugin-proxy-backend, @backstage/plugin-search, @backstage/plugin-search-backend, @backstage/plugin-search-backend-module-pg, @backstage/plugin-search-react, @backstage/plugin-techdocs, @backstage/plugin-techdocs-backend, @backstage/plugin-techdocs-module-addons-contrib, @backstage/plugin-techdocs-react, @backstage/plugin-user-settings, @backstage/test-utils, husky, lerna, lint-staged)
  • chore: Update dependency @typescript-eslint/parser to v8
  • 🔐 Create all rate-limited PRs at once 🔐

Pending Status Checks

These updates await pending status checks. To force their creation now, click the checkbox below.

  • chore: Update dependency concurrently to v9

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

dockerfile
packages/backend/Dockerfile
  • node 20-bookworm-slim
github-actions
.github/workflows/ci.yaml
  • actions/checkout v4
  • actions/setup-node v4
npm
package.json
  • @backstage/cli ^0.26.6
  • @commitlint/cli ^19.0.0
  • @commitlint/config-conventional ^19.0.0
  • @commitlint/config-lerna-scopes ^19.0.0
  • @spotify/prettier-config ^15.0.0
  • @trivago/prettier-plugin-sort-imports ^4.2.1
  • concurrently ^8.0.0
  • eslint-plugin-header ^3.1.1
  • husky ^9.0.0
  • lerna ^8.0.0
  • lint-staged ^15.0.1
  • node-gyp ^10.0.0
  • prettier ^2.0.0
  • typescript ~5.5.0
  • @typescript-eslint/parser ^7.0.0
  • node 18 || 20
  • @types/react ^17
  • @types/react-dom ^17
packages/app/package.json
  • @backstage/app-defaults ^1.5.5
  • @backstage/catalog-model ^1.5.0
  • @backstage/cli ^0.26.6
  • @backstage/core-app-api ^1.12.5
  • @backstage/core-components ^0.14.7
  • @backstage/core-plugin-api ^1.9.2
  • @backstage/integration-react ^1.1.27
  • @backstage/plugin-api-docs ^0.11.5
  • @backstage/plugin-catalog ^1.20.0
  • @backstage/plugin-catalog-common ^1.0.23
  • @backstage/plugin-catalog-graph ^0.4.5
  • @backstage/plugin-catalog-import ^0.12.0
  • @backstage/plugin-catalog-react ^1.12.0
  • @backstage/plugin-org ^0.6.25
  • @backstage/plugin-permission-react ^0.4.22
  • @backstage/plugin-scaffolder ^1.20.1
  • @backstage/plugin-search ^1.4.11
  • @backstage/plugin-search-react ^1.7.11
  • @backstage/plugin-techdocs ^1.10.5
  • @backstage/plugin-techdocs-module-addons-contrib ^1.1.10
  • @backstage/plugin-techdocs-react ^1.2.4
  • @backstage/plugin-user-settings ^0.8.6
  • @backstage/theme ^0.5.5
  • @material-ui/core ^4.12.2
  • @material-ui/icons ^4.9.1
  • history ^5.0.0
  • react ^17.0.2
  • react-dom ^17.0.2
  • react-router ^6.3.0
  • react-router-dom ^6.3.0
  • react-use ^17.2.4
  • @backstage-community/plugin-github-actions ^0.6.16
  • @backstage-community/plugin-tech-radar ^0.7.4
  • @backstage/test-utils ^1.5.5
  • @testing-library/dom ^8.0.0
  • @testing-library/jest-dom ^5.10.1
  • @testing-library/react ^12.1.3
  • @testing-library/user-event ^14.0.0
  • @types/react-dom *
packages/backend/package.json
  • @backstage/backend-common ^0.23.2
  • @backstage/backend-defaults ^0.4.0
  • @backstage/backend-plugin-api ^0.7.0
  • @backstage/backend-tasks ^0.5.23
  • @backstage/catalog-client ^1.6.5
  • @backstage/catalog-model ^1.5.0
  • @backstage/config ^1.2.0
  • @backstage/plugin-app-backend ^0.3.67
  • @backstage/plugin-auth-backend ^0.22.5
  • @backstage/plugin-auth-backend-module-guest-provider ^0.1.4
  • @backstage/plugin-auth-node ^0.4.13
  • @backstage/plugin-catalog-backend ^1.22.0
  • @backstage/plugin-permission-backend ^0.5.42
  • @backstage/plugin-permission-backend-module-allow-all-policy ^0.1.15
  • @backstage/plugin-permission-common ^0.8.0
  • @backstage/plugin-permission-node ^0.8.0
  • @backstage/plugin-proxy-backend ^0.5.0
  • @backstage/plugin-scaffolder-backend ^1.22.8
  • @backstage/plugin-search-backend ^1.5.9
  • @backstage/plugin-search-backend-module-pg ^0.5.27
  • @backstage/plugin-search-backend-node ^1.2.23
  • @backstage/plugin-techdocs-backend ^1.10.5
  • better-sqlite3 ^9.0.0
  • dockerode ^4.0.0
  • express ^4.17.1
  • express-promise-router ^4.1.0
  • pg ^8.3.0
  • winston ^3.2.1
  • @backstage/cli ^0.26.6
  • @types/dockerode ^3.3.0
  • @types/express ^4.17.6
  • @types/express-serve-static-core ^4.17.5
  • @types/luxon ^3.0.0
plugins/dql-backend/package.json
  • @backstage/backend-common ^0.23.0
  • @backstage/config ^1.2.0
  • @types/express *
  • express ^4.17.1
  • express-promise-router ^4.1.0
  • node-fetch ^2.6.7
  • https-proxy-agent 7.0.5
  • winston ^3.2.1
  • yn ^4.0.0
  • zod ^3.22.4
  • @backstage/cli ^0.26.6
  • @backstage/test-utils ^1.5.5
  • @types/supertest ^6.0.0
  • msw ^2.0.0
  • supertest ^6.2.4
plugins/dql-common/package.json
  • lodash ^4.17.21
  • zod ^3.22.4
  • @backstage/cli ^0.26.6
  • @types/lodash ^4.17.0
plugins/dql/package.json
  • @backstage/catalog-model ^1.5.0
  • @backstage/core-components ^0.14.7
  • @backstage/core-plugin-api ^1.9.2
  • @backstage/errors ^1.2.4
  • @backstage/plugin-catalog-react ^1.12.0
  • @backstage/theme ^0.5.5
  • @material-ui/core ^4.12.2
  • @material-ui/icons ^4.9.1
  • @material-ui/lab 4.0.0-alpha.61
  • lodash ^4.17.21
  • react-use ^17.2.4
  • zod ^3.22.4
  • @backstage/cli ^0.26.6
  • @backstage/core-app-api ^1.12.5
  • @backstage/dev-utils ^1.0.32
  • @backstage/test-utils ^1.5.5
  • @testing-library/jest-dom ^5.10.1
  • @testing-library/react ^12.1.3
  • @testing-library/react-hooks ^8.0.1
  • @testing-library/user-event ^14.0.0
  • @types/lodash ^4.17.0
  • msw ^2.0.0
  • react ^16.13.1 || ^17.0.0
nvm
.nvmrc
  • node 20

  • Check this box to trigger a request for Renovate to run again on this repository

Better feeback for misconfigured plugins

Summary

I've recently gone through configuring this plugin and there were a couple of times I needed to get out the debugger to work out why things were failing so I thought I'd raise an issue to maybe have these things smoothed out for future users.

Both boil down to a failure to execute a query not being surfaced well to the user. This is kind of two issues but one is very minor.

Feature Suggestion

Firstly, It looks like if you have a trailing forward slash '/' on the url in environment config then query execution fails with a 401 (e.g. the path is something like https://<id>.apps.dynatrace.com//platform/storage/query/v1/query:execute (note: //) however the waitForQueryResult function still tries to check the status of the query but request-token is undefined and this fails returning a 500 error.

The same error occurs if query execution fails for lack of permissions. For example, I tried to query logs fetch logs but I hadn't given the token view logs permission.

Possible Implementation

Return an error message to the user which includes or is based on the response code of the execute query API call so users can better respond.

Also, the url building should handle a trailing forward slash.

Context

Custom query execution - Environment limitation

Summary

Currently, custom queries defined in the app-config.yaml or catalog-info.yaml are executed against all specified environments. However, executing a query in an environment where no results are expected can be inefficient. Therefore, it should be possible to specify the environments in which each query is executed.

Feature Suggestion

It should be possible to specify the environments in which each query defined in the app-config.yaml and catalog-info.yaml is executed.

By default, queries should be executed against all defined environments.

Possible Implementation

The configuration could look like this:

dynatrace:
  queries:
    - id: davis-events
      description: Fetches all Davis events
      environments:
        - tenant1
        - tenant2
      query: >
        fetch events | filter event.kind == "DAVIS_EVENT" | fields event.kind, timestamp

Context

Providing the ability to specify the environments in which each query defined in the app-config.yaml and catalog-info.yaml is executed.

Please use the following code-base: #131

@dynatrace/backstage-plugin-dql@unknown can't be resolved to a satisfying range

Summary

I am trying to use this plugin within my backstage following the README installation instructions and I am not able to install @dynatrace/backstage-plugin-dql

Expected Behavior

I would expect the package to be added to my project with no issue.

Current Behavior

when I run yarn --cwd packages/app add @dynatrace/backstage-plugin-dql I get a 404.
image

Steps to Reproduce

  1. run yarn --cwd packages/app add @dynatrace/backstage-plugin-dql

Your Environment

  • @dynatrace/backstage-plugin-dql-backend version: N/A
  • @dynatrace/backstage-plugin-dql version: N/A

Render Dates/Timestamps as local string

Currently the DQL Frontend Plugin renders anything coming from the backend as-is. This is fine for most data, but for dates and timestamps, Backstage recommends to render them formatted for the locale of the user (ADR012).

To comply with ADR012, we'd need to know that the given column is a date or timestamp and use Luxon.toLocaleString to render it accordingly.

This also pulls in the necessity to deal with null values when not all entries contain a date or timestamp, something that's currently covered by the DQL query itself (no logic on the Frontend side).

Bad

2023-11-13T14:45:43.278000000Z

Good (for German/Austrian Locale)

13.11.2023 15:45:43

Define k8s workloads in entity catalog-info.yaml instead of using k8s labels

Summary

Hey! :)
Currently we have to add k8s label for every k8s deployments that we want to integrate with Dynatrace Backstage plugin.
It would be great if we could add an annotation for Entities that would point to the corresponding k8s deployment instead of adding label to the actual deployment.

Feature Suggestion

Define k8s-workloads used by Backstage entities within the entities catalog-info.yaml files instead of labeling each k8s workload.

Context

Currently we have to label k8s deployments with the following label:

metadata:
  labels:
    backstage.io/component: '<backstage-namespace>.<backstage-name>'

We would like to use annotation for Backstage entity instead.
For example:

apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
  annotations:
    dynatrace/k8s-workload: '<k8s-cluster-name>.<k8s-namespace>', '<k8s-cluster-name>.<k8s-namespace>'

I think that the annotation should be a list since there can be more than one workload associated with given entity.
like for Backstage we have backstage-prod and backstage-stg.

Also it would be great if we could use tags or labels to get all the k8s resources associated with a workload.
For example, we would like to see all the resources associated with some Jenkins instance, so we would like to see every resource which has a tag/label: <jenkins-instance-name>-jenkins. Would that be possible as well?

That would be more user friendly approach and it would make integration with Dynatrace easier.

Thank you! :)

Define custom DQL queries within catalog-info.yaml file of the Backstage Entity

Summary

Hey! :)
Currently custom DQL queries has to be defined within app-config.yaml file of Backstage instance.
With big adoption of Backstage and Dynatrace plugin it might cause some problems in the future if developers would like to define their own custom actions for their components. They would have to add every query to Backstage repository which is not ideal.
We would love to have an possibility for plugin users to define their own custom DQL queries within catalog-info.yaml files describing their components.

Feature Suggestion

Possibility of defining custom DQL queries in catalog-info.yaml file of an Entity.
It would make it easier for developers to define their custom DQL queries.

Possible Implementation

Such annotation could look like this:
metadata: annotations: dynatrace: queries: - id: ... description: ... query: >
Based on the contents of the dynatrace.queries annotation plugin would display instances of EntityDqlQueryCard under the dedicated Dynatrace tab at the Backstage Entity page.

Context

Move custom DQL queries definitions out of app-config.yaml file to catalog-info.yaml files of an Entities

Thanks :)

Expand destination selection for 'show logs'

Summary

Hi! :)
We would like to request more possibilities when it comes to Show logs option.
image
Currently we can either create a new notebook by clicking on New notebook or select existing one from the drop down menu.
image

Feature Suggestion

It would be nice to have additional option such as log explorer or its 3rd gen alternative when its available in the 3rd gen.

Possible Implementation

Context

We would like to have more option to explore logs, such as log explorer from 2nd gen.

Release validations from SRG as default query

Summary

The Site Reliability Guardian validates new versions of a deployment (release) to find performance regression and ensure security objectives. These validation results are queryable from Dynatrace and should be listed by the plugin.

image

Functional requirements

  • Default built-in query to fetch validation results
  • Link from the table to open SRG (see screenshot Open validation)
  • Empty screen: Oromote the Site Reliability Guardian and to support to integrate it

Non-functional requirements

  • Documentation about the requirements to make the view work (convention on meta-data to find the right data)

Context

Release Cadence?

Hey team, will there be a release cadence for this plugin? We are currently trying to bump versions of other backstage plugins and we are having some conflicts because this plugin hasn't been released with some of the latest backstage core packages. Do you have a timeline on when the next release will be coming?

Include Token Caching

Each request to the DQL Backend hits the token server and fetches a new token. It might be possible and beneficial to cache the token for some time. This would increase the response time of the DQL Backend, and reduce the load on the DT infrastructure.

Install Plugins error: Registry not found on yarn/npm

Summary

Trying to add any of the 3 packages (backstage-plugin-dql, backstage-plugin-dql-backend, backstage-plugin-dql-common), a "Not found" error is received.

I have change the repository to npm: also unsuccessful

Expected Behavior

>yarn --cwd packages/app add @dynatrace/backstage-plugin-dql
[n/n] Building fresh packages...
success Saved 1 new dependency.
info Direct dependencies
info All dependencies
└─ @dynatrace/[email protected]
Done in tt.tts.

Current Behavior

>yarn --cwd packages/app add @dynatrace/backstage-plugin-dql
error Error: https://registry.yarnpkg.com/@dynatrace%2fbackstage-plugin-dql: Not found`

Steps to Reproduce

  1. run:
cd packages/app; yarn add @dynatrace/backstage-plugin-dql

Possible Solution

Context

user@hostname:~/backstage$ cd packages/app
user@hostname:~/backstage/packages/app$ yarn add @dynatrace/backstage-plugin-dql --verbose
yarn add v1.22.22
verbose 0.208621221 Checking for configuration file "/home/user/backstage/packages/app/.npmrc".
verbose 0.209068736 Checking for configuration file "/home/user/.npmrc".
verbose 0.209471744 Found configuration file "/home/user/.npmrc".
verbose 0.210322772 Checking for configuration file "/home/user/.nvm/versions/node/v20.11.0/etc/npmrc".
verbose 0.210725502 Checking for configuration file "/home/user/backstage/packages/app/.npmrc".
verbose 0.210919876 Checking for configuration file "/home/user/backstage/packages/.npmrc".
verbose 0.211062098 Checking for configuration file "/home/user/backstage/.npmrc".
verbose 0.211240306 Checking for configuration file "/home/user/.npmrc".
verbose 0.211461927 Found configuration file "/home/user/.npmrc".
verbose 0.212027556 Checking for configuration file "/home/.npmrc".
verbose 0.213230323 Checking for configuration file "/home/user/backstage/packages/app/.yarnrc".
verbose 0.213606957 Checking for configuration file "/home/user/.yarnrc".
verbose 0.21384815 Found configuration file "/home/user/.yarnrc".
verbose 0.214231051 Checking for configuration file "/home/user/.nvm/versions/node/v20.11.0/etc/yarnrc".
verbose 0.214367723 Checking for configuration file "/home/user/backstage/packages/app/.yarnrc".
verbose 0.214465126 Checking for configuration file "/home/user/backstage/packages/.yarnrc".
verbose 0.214549226 Checking for configuration file "/home/user/backstage/.yarnrc".
verbose 0.214668267 Checking for configuration file "/home/user/.yarnrc".
verbose 0.214760191 Found configuration file "/home/user/.yarnrc".
verbose 0.215451003 Checking for configuration file "/home/.yarnrc".
verbose 0.223513062 current time: 2024-05-20T13:54:25.323Z
[1/4] Resolving packages...
verbose 0.684119727 Performing "GET" request to "https://registry.yarnpkg.com/@dynatrace%2fbackstage-plugin-dql".
verbose 1.577293128 Request "https://registry.yarnpkg.com/@dynatrace%2fbackstage-plugin-dql" finished with status code 404.
verbose 1.587709245 Error: https://registry.yarnpkg.com/@dynatrace%2fbackstage-plugin-dql: Not found
    at params.callback [as _callback] (/home/user/.nvm/versions/node/v20.11.0/lib/node_modules/yarn/lib/cli.js:66680:18)
    at self.callback (/home/user/.nvm/versions/node/v20.11.0/lib/node_modules/yarn/lib/cli.js:141410:22)
    at Request.emit (node:events:518:28)
    at Request.<anonymous> (/home/user/.nvm/versions/node/v20.11.0/lib/node_modules/yarn/lib/cli.js:142382:10)
    at Request.emit (node:events:518:28)
    at IncomingMessage.<anonymous> (/home/user/.nvm/versions/node/v20.11.0/lib/node_modules/yarn/lib/cli.js:142304:12)
    at Object.onceWrapper (node:events:632:28)
    at IncomingMessage.emit (node:events:530:35)
    at endReadableNT (node:internal/streams/readable:1696:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
error Error: https://registry.yarnpkg.com/@dynatrace%2fbackstage-plugin-dql: Not found
    at params.callback [as _callback] (/home/user/.nvm/versions/node/v20.11.0/lib/node_modules/yarn/lib/cli.js:66680:18)
    at self.callback (/home/user/.nvm/versions/node/v20.11.0/lib/node_modules/yarn/lib/cli.js:141410:22)
    at Request.emit (node:events:518:28)
    at Request.<anonymous> (/home/user/.nvm/versions/node/v20.11.0/lib/node_modules/yarn/lib/cli.js:142382:10)
    at Request.emit (node:events:518:28)
    at IncomingMessage.<anonymous> (/home/user/.nvm/versions/node/v20.11.0/lib/node_modules/yarn/lib/cli.js:142304:12)
    at Object.onceWrapper (node:events:632:28)
    at IncomingMessage.emit (node:events:530:35)
    at endReadableNT (node:internal/streams/readable:1696:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
user@hostname:~/backstage/packages/app$ yarn config set registry https://registry.npmjs.org/
yarn config v1.22.22
success Set "registry" to "https://registry.npmjs.org/".
Done in 0.04s.
user@hostname:~/backstage/packages/app$ yarn add @dynatrace/backstage-plugin-dql
yarn add v1.22.22
[1/4] Resolving packages...
error Error: https://registry.npmjs.org/@dynatrace%2fbackstage-plugin-dql: Not found
    at params.callback [as _callback] (/home/user/.nvm/versions/node/v20.11.0/lib/node_modules/yarn/lib/cli.js:66680:18)
    at self.callback (/home/user/.nvm/versions/node/v20.11.0/lib/node_modules/yarn/lib/cli.js:141410:22)
    at Request.emit (node:events:518:28)
    at Request.<anonymous> (/home/user/.nvm/versions/node/v20.11.0/lib/node_modules/yarn/lib/cli.js:142382:10)
    at Request.emit (node:events:518:28)
    at IncomingMessage.<anonymous> (/home/user/.nvm/versions/node/v20.11.0/lib/node_modules/yarn/lib/cli.js:142304:12)
    at Object.onceWrapper (node:events:632:28)
    at IncomingMessage.emit (node:events:530:35)
    at endReadableNT (node:internal/streams/readable:1696:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Your Environment

  • @dynatrace/backstage-plugin-dql-backend version: still any
  • @dynatrace/backstage-plugin-dql version: still any

yarn v1.22.22
backstage v1.26.0

Missing Annotation layout for EntityKubernetesDeploymentsCard

Summary

After looking into the EntityKubernetesDeploymentsCard component and how it acts when there is no annotation provided we would like to suggest some possible improvements for the layout of the component.
Screenshot from 2024-04-17 08-29-29

Feature Suggestion

Screenshot from 2024-04-17 08-30-53

Currently in the Missing Annotation we can see detailed information about one of the required annotations - backstage.io/kubernetes-id (orange color) and a note about label selector query under the whole Missing Annotation field (green color).

Would it be possible to remove missingAnnotation image (red color) and instead of it display the same information about label selector as we can see for the backstage.io/kubernetes-id.
Then the green note could be removed.

We think that it would improve the way that Annotation looks like and user would have a better understanding of an annotations that can be used for the plugin.

Possible Implementation

Context

Improve the clarity of Missing Annotation` component

Placeholders in custom queries are not working

Describe the bug
If you put some placeholders in queries like fetch bizevents | filter event.type == ${componentName} it will resolve to undefined and the query can't be used. The cause of this is the replace feature of backstage, where it replaces everything inside ${} with environment variables and each variable must be set, else the query will be undefined. Documentation link.

Possible solutions:

  • Adjust the documentation that placeholders should be added via $${placeholder} instead of ${placeholder}
  • Use another library to parse the YAML file on our own. This would be overkill in my opinion, because we would need to duplicate some logic and maybe have other side effects.

To Reproduce
Steps to reproduce the behavior:

  1. Go to app-config.local.yaml
  2. Add a query with a placeholder
  3. Execute the query with the given identifier
  4. Get a 500 result because the query of the given identifier is undefined

Expected behavior
There is no error and the custom query is executed

Introduce Changesets for auto-generated changelogs

The repository uses conventional commits, but the granularity of a commit does not sufficiently match a significant change worth documenting.

The Backstage project itself also uses conventional commits (not very consistently, though), but relies on Changesets to generate changelogs (after the first stable release).

It would be good to introduce Changesets, and include a changeset for each significant change in the code base. During pull request reviews, thes changeset can be ensured/reviewed/discussed.

Conventional commits could stay if they serve a purpose (or just for consistency).

Typo in README.md

Hey,
there is a small typo on README.md file.
It is located in this line.
I think that it should be storage:buckets:read instead of storage:bucket:read

Thanks :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.