Merge pull request #4339 from backstage/freben/google-analytics

docs: add a miniature article about observability
This commit is contained in:
Fredrik Adelöw
2021-02-02 12:09:30 +01:00
committed by GitHub
4 changed files with 59 additions and 1 deletions
+2
View File
@@ -218,6 +218,7 @@ Spotify
sqlite
squidfunk
src
stdout
stefanalund
subkey
subtree
@@ -258,6 +259,7 @@ Voi
Wealthsimple
Weaveworks
Webpack
winston
www
WWW
xyz
+54
View File
@@ -0,0 +1,54 @@
---
id: observability
title: Observability
# prettier-ignore
description: Adding Observability to Your Plugin
---
This article briefly describes the observability options that are available to a
Backstage integrator.
## Google Analytics
There is a basic Google Analytics integration built into Backstage. You can
enable it by adding the following to your app configuration:
```yaml
app:
googleAnalyticsTrackingId: UA-000000-0
```
Replace the tracking ID with your own.
For more information, learn about Google Analytics
[here](https://marketingplatform.google.com/about/analytics/).
## Logging
The backend supplies a central [winston](https://github.com/winstonjs/winston)
root logger that plugins are expected to use for their logging needs. In the
default production setup, it emits structured JSON logs on stdout, with a field
`"service": "backstage"` and also tagged on a per-plugin basis. Plugins that
want to more finely specify what part of their processes that emitted the log
message should add a `"component"` field to do so.
An example log line could look as follows:
```json
{
"service": "backstage",
"type": "plugin",
"plugin": "catalog",
"component": "catalog-all-locations-refresh",
"level": "info",
"message": "Locations Refresh: Refreshing location bootstrap:bootstrap"
}
```
## Health Checks
The example backend in the Backstage repository
[supplies](https://github.com/backstage/backstage/blob/bc18571b7a742863a770b2a54e785d6bbef7e184/packages/backend/src/index.ts#L99)
a very basic health check endpoint on the `/healthcheck` route. You may add such
a handler to your backend as well, and supply your own logic to it that fits
your particular health checking needs.
+2 -1
View File
@@ -129,7 +129,8 @@
"ids": [
"plugins/publishing",
"plugins/publish-private",
"plugins/add-to-marketplace"
"plugins/add-to-marketplace",
"plugins/observability"
]
}
],
+1
View File
@@ -80,6 +80,7 @@ nav:
- Publishing:
- Open source and npm: 'plugins/publishing.md'
- Private/internal (non-open source): 'plugins/publish-private.md'
- Observability: 'plugins/observability.md'
- Configuration:
- Overview: 'conf/index.md'
- Reading Configuration: 'conf/reading.md'