Skip to content
Open
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
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,40 @@ You will need to have at least golang 1.22.1 installed. It is rather new as of t
2. Check the logs in logs/ (or the log_dir that you configured in fletchling.toml) for errors.
* Every minute, a log message will appear saying how many pokemon were processed. If this is 0, it means that Fletchling is not getting any webhooks. Check your Golbat webhooks configuration. Check the address Fletchling is listening on (http section in config).

# Prometheus / Grafana

Fletchling exposes Prometheus metrics (webhook processing counters, HTTP stats, Go runtime, and process metrics) on the same listen address as the API, at `/metrics`. The endpoint is **disabled by default** — you must opt in.

## 1. Enable the metrics endpoint in Fletchling

Edit `configs/fletchling.toml` and uncomment the `enabled` line:

```toml
[prometheus]
enabled = true
```

Restart Fletchling. Verify it works: `curl http://127.0.0.1:9042/metrics` should return a long list of `fletchling_*` metrics. If you get `404 page not found`, the endpoint isn't enabled — recheck your config.

## 2. Scrape it with Zapdos

[Zapdos](https://github.com/UnownHash/Zapdos) is the UnownHash metrics stack (VmAgent + VictoriaMetrics + Grafana). Follow its docs to get the stack running, then add a scrape job for Fletchling in your `prometheus.yml`:

```yml
scrape_configs:
- job_name: 'fletchling'
static_configs:
- targets: ['fletchling:9042'] # docker; for pm2 use 127.0.0.1:9042
labels:
instance: 'fletchling'
```

Reload VmAgent so the new target is picked up.

## 3. Import the dashboard

A Grafana dashboard covering all exposed metrics is included at [`grafana/fletchling-dashboard.json`](grafana/fletchling-dashboard.json). In Grafana: **Dashboards → New → Import**, upload the file, and select your VictoriaMetrics/Prometheus datasource.

# Migrating from other nest processors

## nestcollector to Fletching using existing Golbat DB for nests (SIMPLEST)
Expand Down
6 changes: 4 additions & 2 deletions app_config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ import (
)

const (
DEFAULT_OVERPASS_URL = "https://overpass-api.de/api/interpreter"
DEFAULT_OVERPASS_URL = "https://overpass-api.de/api/interpreter"
DEFAULT_OVERPASS_USER_AGENT = "Fletchling-USR-OSM-Importer/1.0 contact: overpass@mymail.fiy"

DEFAULT_NEST_NAME = "Unknown Nest"
)
Expand Down Expand Up @@ -151,7 +152,8 @@ func GetDefaultConfig() Config {
Processor: processor.GetDefaultConfig(),

Overpass: overpass.Config{
Url: DEFAULT_OVERPASS_URL,
Url: DEFAULT_OVERPASS_URL,
UserAgent: DEFAULT_OVERPASS_USER_AGENT,
},

Importer: importer.Config{
Expand Down
2 changes: 1 addition & 1 deletion bin/fletchling-osm-importer/fletchling-osm-importer.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ func main() {
continue
}

overpassCli, err := overpass.NewClient(logger, cfg.Overpass.Url)
overpassCli, err := overpass.NewClient(logger, cfg.Overpass.Url, cfg.Overpass.UserAgent)
if err != nil {
logger.Fatalf("failed to create overpass client for area %s: %v", areaName, err)
}
Expand Down
3 changes: 3 additions & 0 deletions configs/fletchling.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,6 @@ no_nesting_pokemon_age_hours = 12
# In case there's a need to change this:
[overpass]
#url = "https://overpass-api.de/api/interpreter"
## User-Agent header sent with overpass requests. Replace the email with your own
## contact address so the overpass operators can reach you if there are issues.
user_agent = "Fletchling USER importer contact: overpass@mymail.fyi"
Loading