Skip to content

Create user facing documentation - #1361

Draft
sysadmind wants to merge 3 commits into
prometheus-community:masterfrom
sysadmind:user-docs
Draft

Create user facing documentation#1361
sysadmind wants to merge 3 commits into
prometheus-community:masterfrom
sysadmind:user-docs

Conversation

@sysadmind

Copy link
Copy Markdown
Contributor

Create a docs/ directory with user facing documentation. This covers getting started, running with docker, specifying secrets, configuration, and database permissions. This is all focused on the perspective of a user or someone deploying the exporter.

@nicolastakashi

Copy link
Copy Markdown

Is part of #1363

@ArthurSens ArthurSens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't read the written documentation just yet, I'm just thinking about how this would be integrated in the website.

Since you're writing separate documents per topic, are you imagining that each document also becomes a separate page in the website? With README kinda working as some kind of index.html for postgres exporter?

Comment thread docs/docker.md
Comment on lines +13 to +15
- `latest` — the most recent release.
- `vX.Y.Z` — a specific release, e.g. `v0.18.1`. Pin to a specific tag for production deployments so upgrades are intentional.
- `master` — the latest build from the `master` branch, which may be unstable. Use this only for testing or development.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to explain semver here 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My intent here was to list the tags that a normal user might care about. Discoverability of tags for docker images isn't always straightforward - you often have to go dig through a git repo or just read through Dockerhub tags to find what you're looking for.

Also, while our releases are formatted like semver (x.y.z), we don't really treat it as semver. We will make breaking changes on a Y update. And if you think of it like a library (which you will going forward) the PR you just had to make it embeddable is probably a breaking change even though it was not user visible.

Comment thread docs/docker.md
@@ -0,0 +1,59 @@
# Docker Images

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't create a document called Docker, especially when Docker is already mentioned in the Getting Started.

Maybe in Getting Started, we could have different sections? Getting Started with Docker/Kubernetes/Binary/Ansible/whatever is available.

I'm imagining a component like this (change Java/Go with what is relevant to us)

Image

Where the reader can click and choose the preferred way of getting started

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that there's value here. The docker file talks about a lot more than you need just to get started. The image details are something that a user would have to go digging through code to understand if it's not called out.

Comment thread docs/configuration.md Outdated
Comment on lines +9 to +36
| Collector | Default | Notes |
|---|---|---|
| `database` | enabled | |
| `database_wraparound` | disabled | transaction ID wraparound risk |
| `locks` | enabled | |
| `long_running_transactions` | disabled | |
| `postmaster` | disabled | |
| `process_idle` | disabled | |
| `replication` | enabled | |
| `replication_slots` | enabled | |
| `roles` | enabled | |
| `settings` | enabled | values from `pg_settings` |
| `stat_activity` | enabled | |
| `stat_activity_autovacuum` | disabled | |
| `stat_archiver` | enabled | |
| `stat_bgwriter` | enabled | |
| `stat_checkpointer` | disabled | PostgreSQL 17+ only |
| `stat_database` | enabled | |
| `stat_progress_vacuum` | enabled | |
| `stat_replication` | enabled | |
| `stat_statements` | disabled | requires the `pg_stat_statements` extension |
| `stat_user_tables` | enabled | |
| `stat_wal_receiver` | disabled | |
| `statio_user_indexes` | disabled | |
| `statio_user_tables` | enabled | |
| `wal` | enabled | |
| `xlog_location` | disabled | |
| `buffercache_summary` | disabled | requires the `pg_buffercache` extension |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd love it if this table could be automated with mdox. We should have a hidden CLI flag that builds this table to make sure it is always up to date.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also believe that we should have some meaninfull description for each option

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we have that abstraction in exporter-toolkit @nicolastakashi? :)

Not sure how yet, but I'm thking something about exporter toolkit managing collector enable/disable states, we could use that to have exporter toolkit automatically generate tables like this for documentation and us using the same state to enable/disable collectors.

Either way, this is work for the future :p

Comment thread docs/configuration.md
Comment on lines +61 to +71
```yaml
auth_modules:
foo: # referenced as ?auth_module=foo on /probe requests
type: userpass
userpass:
username: monitoring_user
password: monitoring_password
options:
# merged into the DSN as key=value query parameters
sslmode: require
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one also, it would be awesome if we used mdox-exec=cat example.yaml and we actually use this file as part of our tests in CI to make sure it's always valid.

Comment thread docs/connecting.md
@@ -0,0 +1,60 @@
# Connecting to PostgreSQL

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't database permissions related to this topic? should we merge them?

Comment thread docs/getting-started.md

## Point Prometheus at it

Add a scrape job to your Prometheus configuration:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe worth a cross reference here pointing to the scrape config docs for more details, mentioning this is a simple example, wdyt?

Comment thread docs/configuration.md Outdated
Comment on lines +9 to +36
| Collector | Default | Notes |
|---|---|---|
| `database` | enabled | |
| `database_wraparound` | disabled | transaction ID wraparound risk |
| `locks` | enabled | |
| `long_running_transactions` | disabled | |
| `postmaster` | disabled | |
| `process_idle` | disabled | |
| `replication` | enabled | |
| `replication_slots` | enabled | |
| `roles` | enabled | |
| `settings` | enabled | values from `pg_settings` |
| `stat_activity` | enabled | |
| `stat_activity_autovacuum` | disabled | |
| `stat_archiver` | enabled | |
| `stat_bgwriter` | enabled | |
| `stat_checkpointer` | disabled | PostgreSQL 17+ only |
| `stat_database` | enabled | |
| `stat_progress_vacuum` | enabled | |
| `stat_replication` | enabled | |
| `stat_statements` | disabled | requires the `pg_stat_statements` extension |
| `stat_user_tables` | enabled | |
| `stat_wal_receiver` | disabled | |
| `statio_user_indexes` | disabled | |
| `statio_user_tables` | enabled | |
| `wal` | enabled | |
| `xlog_location` | disabled | |
| `buffercache_summary` | disabled | requires the `pg_buffercache` extension |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also believe that we should have some meaninfull description for each option

Comment thread docs/configuration.md

Run `postgres_exporter --help` for the exact, current list of flags — new collectors are added over time and this table can drift.

## Common flags

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are all those common flags comming from exporter toolkit? should we reference it here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many are or from prometheus/common. Updated this section.

Comment thread docs/configuration.md Outdated
| `xlog_location` | disabled | |
| `buffercache_summary` | disabled | requires the `pg_buffercache` extension |

`pg_stat_statements` has its own sub-flags: `--collector.stat_statements.include_query` (off by default — includes raw query text), `--collector.stat_statements.query_length` (default 120), `--collector.stat_statements.limit` (default 100), and `--collector.stat_statements.exclude_databases` / `--collector.stat_statements.exclude_users` (comma-separated).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we have a dedicated section to what's pg_stat_statements?

Comment thread docs/configuration.md

## Deprecated options

These remain for backward compatibility but shouldn't be used in new deployments:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't those removed on newer versions?

Comment thread docs/connecting.md
Prometheus is typically configured to do this via relabeling so the target list can come from service discovery:

```yaml
scrape_configs:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create a docs/ directory with user facing documentation. This covers getting started, running with docker, specifying secrets, configuration, and database permissions. This is all focused on the perspective of a user or someone deploying the exporter.

Signed-off-by: Joe Adams <github@joeadams.io>
Clean up duplication on docker commands. Make the docs README more useful as a standalone page.

Signed-off-by: Joe Adams <github@joeadams.io>
@sysadmind

Copy link
Copy Markdown
Contributor Author

@ArthurSens yes I'm imagining each file becomes a navigation item in the site. One thing I also want to consider with this - people will also come directly to this repo to view docs, so I want to enable viewing them in Github and avoid anything too custom that reduces the value of them as standalone files in this repo.

Add more details on each flag and collector to help the user understand the purpose.

Signed-off-by: Joe Adams <github@joeadams.io>
@ArthurSens

Copy link
Copy Markdown
Contributor

I spent some time looking at how to pull exporter docs into prometheus.io. The docs site can support this with a latest-release-tag source for exporters, but each Markdown file needs the same frontmatter contract that the site uses for title/nav ordering.

Could you add this frontmatter while keeping the existing # heading in each file? Keeping the H1 means the files still read well on GitHub; the website will use the frontmatter for metadata and navigation.

docs/README.md:

---
title: postgres_exporter Documentation
nav_title: Overview
sort_rank: 1
---

docs/getting-started.md:

---
title: Getting Started
sort_rank: 2
---

docs/connecting.md:

---
title: Connecting to PostgreSQL
sort_rank: 3
---

docs/database-permissions.md:

---
title: Database Permissions
sort_rank: 4
---

docs/configuration.md:

---
title: Configuring the Exporter
nav_title: Configuration
sort_rank: 5
---

docs/secrets.md:

---
title: Secrets
sort_rank: 6
---

docs/docker.md:

---
title: Docker Images
nav_title: Docker
sort_rank: 7
---

docs/aws-rds.md:

---
title: Running Against AWS RDS
nav_title: AWS RDS
sort_rank: 8
---

One important detail: prometheus.io will pull exporter docs from the latest stable release tag, not directly from master. So after this merges, the docs will appear on the website once postgres_exporter cuts a release containing the docs/ directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants