Skip to content

Commit

Permalink
backstage: add prometheus
Browse files Browse the repository at this point in the history
Signed-off-by: Victor Login <batazor@evrone.com>
  • Loading branch information
batazor committed Jan 15, 2023
1 parent 60e0ad4 commit dceb42a
Show file tree
Hide file tree
Showing 6 changed files with 270 additions and 8 deletions.
5 changes: 5 additions & 0 deletions internal/services/backstage/app-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ proxy:
headers:
Cookie:
$env: ARGOCD_AUTH_TOKEN
'/prometheus/api':
# url to the api and path of your hosted prometheus instance
target: https://shortlink.best/prometheus/api/v1/
headers:
Authorization: ${YOUR_AUTH_TOKEN_IF_PROMETHEUS_IS_SECURED}

# Reference documentation http://backstage.io/docs/features/techdocs/configuration
# Note: After experimenting with basic setup, use CI/CD to generate docs
Expand Down
1 change: 1 addition & 0 deletions internal/services/backstage/packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"@material-ui/core": "^4.12.4",
"@material-ui/icons": "^4.9.1",
"@roadiehq/backstage-plugin-argo-cd": "^2.2.3",
"@roadiehq/backstage-plugin-prometheus": "^2.2.2",
"history": "^5.3.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ import { EntityKubernetesContent } from '@backstage/plugin-kubernetes';
import { EntityAdrContent, isAdrAvailable } from '@backstage/plugin-adr';
// eslint-disable-next-line import/no-extraneous-dependencies
import { EntityTodoContent } from '@backstage/plugin-todo';
// eslint-disable-next-line import/no-extraneous-dependencies
import {
EntityPrometheusContent,
EntityPrometheusAlertCard,
EntityPrometheusGraphCard,
} from '@roadiehq/backstage-plugin-prometheus';

const techdocsContent = (
<EntityTechdocsContent>
Expand Down Expand Up @@ -144,6 +150,13 @@ const overviewContent = (
<Grid item md={8} xs={12}>
<EntityHasSubcomponentsCard variant="gridItem" />
</Grid>

<Grid item md={8}>
<EntityPrometheusAlertCard />
</Grid>
<Grid item md={6}>
<EntityPrometheusGraphCard />
</Grid>
</Grid>
);

Expand All @@ -157,6 +170,10 @@ const serviceEntityPage = (
<EntityKubernetesContent refreshIntervalMs={30000} />
</EntityLayout.Route>

<EntityLayout.Route path="/prometheus" title="Prometheus">
<EntityPrometheusContent />
</EntityLayout.Route>

<EntityLayout.Route path="/todo" title="Todo">
<EntityTodoContent />
</EntityLayout.Route>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ metadata:
'backstage.io/kubernetes-label-selector': 'app.kubernetes.io/name=shortlink-api'
backstage.io/source-location: url:https://github.com/shortlink-org/shortlink/tree/main/internal/services/api
backstage.io/techdocs-ref: url:url:https://github.com/shortlink-org/shortlink/tree/main/internal/services/api
prometheus.io/alert: 'Excessive Memory Usage'
prometheus.io/rule: memUsage|component,node_memory_active_bytes|instance,sum by (instance) (node_cpu_seconds_total)
spec:
type: service
lifecycle: production
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ metadata:
'backstage.io/kubernetes-label-selector': 'app.kubernetes.io/name=shortlink-billing'
backstage.io/source-location: url:https://github.com/shortlink-org/shortlink/tree/main/internal/services/billing
backstage.io/techdocs-ref: url:url:https://github.com/shortlink-org/shortlink/tree/main/internal/services/billing
prometheus.io/alert: 'Excessive Memory Usage'
prometheus.io/rule: memUsage|component,node_memory_active_bytes|instance,sum by (instance) (node_cpu_seconds_total)
spec:
type: service
lifecycle: production
Expand Down
Loading

0 comments on commit dceb42a

Please sign in to comment.