Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Add Telemetry dashboard #19

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# PowerSync Self Hosted Example

## v0.5.0

- Added custom telemetry integration (Enterprise only feature) to NodeJS demo

## v0.4.0

- Added Supabase local development demo.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This repository contains basic demonstrations in the `demos` folder.

- [NodeJS](./demos/nodejs/README.md)

- This can be stared from the repo root with `docker compose -f demos/nodejs/docker-compose.yaml up`
- This can be stared from the repo root with `docker compose -f demos/nodejs/docker-compose.yaml up`. See the readme for additional instructions including telemetry configuration.

- [Django](./demos/django/README.md)

Expand Down
6 changes: 6 additions & 0 deletions config/powersync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ telemetry:
# Opt out of reporting anonymized usage metrics to PowerSync telemetry service
disable_telemetry_sharing: false

# This is only available when using the Enterprise edition of the PowerSync self hosted Docker image
additional_endpoints:
- url: http://telemetry-collector:4318/v1/metrics
# Optionally configure the export interval - defaults to 5 minutes
export_interval_ms: 10000 # 10 seconds

# Settings for source database replication
replication:
# Specify database connection details
Expand Down
18 changes: 18 additions & 0 deletions demos/nodejs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,24 @@ docker compose -f demos/nodejs/docker-compose.yaml up

The frontend can be accessed at `http://localhost:3030` in a browser.

### Telemetry

The enterprise edition of the PowerSync self hosting Docker image supports custom telemetry integration.

This demo can be started with custom telemetry by running

```bash
docker compose -f docker-compose.yaml -f docker-compose-telemetry.yaml up
```

This will additionally start an OpenTelemetry OTLP collector, Prometheus exporter and Grafana service.

The telemetry can be viewed by accessing `http://localhost:3121` in a browser.

Login with `admin` for both the username and password.

The `Telemetry` dashboard contains panels with various metrics.

## Cleanup

The `setup.sql` script only runs on the first initialization of the container. Delete the container and volumes if making changes.
14 changes: 14 additions & 0 deletions demos/nodejs/docker-compose-telemetry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Include syntax requires Docker compose > 2.20.3
# https://docs.docker.com/compose/release-notes/#2203
include:
# Creates the internal MongoDB replica set
- path: ../../services/telemetry/telemetry.yaml

services:
# Include all services from the other file
powersync:
extends:
file: ./docker-compose.yaml
service: powersync
# This image needs to be used for custom telemetry integration
image: container-registry.staging.journeyapps.com/powersync-service:latest
4 changes: 4 additions & 0 deletions demos/supabase/config/powersync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
telemetry:
# Opt out of reporting anonymized usage metrics to PowerSync telemetry service
disable_telemetry_sharing: false
additional_endpoints:
- url: http://telemetry-collector:4318/v1/metrics
# Optionally configure the export interval - defaults to 5 minutes
export_interval_ms: 10000 # 10 seconds

# Settings for source database replication
replication:
Expand Down
3 changes: 3 additions & 0 deletions services/telemetry/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Telemetry

Note: Custom telemetry integration is only supported in the Enterprise edition of the PowerSync self hosted Docker image.
25 changes: 25 additions & 0 deletions services/telemetry/telemetry-config/collector-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
receivers:
otlp:
protocols:
http:

exporters:
debug:
verbosity: detailed
sampling_initial: 5
sampling_thereafter: 200
prometheus:
endpoint: "0.0.0.0:7654"

processors:
batch:

service:
telemetry:
logs:
level: "debug"
pipelines:
metrics:
receivers: [otlp]
exporters: [debug, prometheus]
processors: [batch]
Loading