-
Notifications
You must be signed in to change notification settings - Fork 1
Prometheus: Refresh usage guide based on Docker Compose #401
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Service composition file for Docker Compose or Podman Compose | ||
# https://cratedb.com/docs/guide/integrate/prometheus/ | ||
|
||
services: | ||
|
||
cratedb: | ||
image: "docker.io/crate:latest" | ||
amotl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
command: > | ||
crate -Cdiscovery.type=single-node | ||
ports: | ||
- "4200:4200" | ||
- "5432:5432" | ||
volumes: | ||
- cratedb-data:/data | ||
healthcheck: | ||
test: ["CMD", "curl", "-f", "http://localhost:4200/"] | ||
interval: 5s | ||
timeout: 30s | ||
retries: 5 | ||
restart: unless-stopped | ||
|
||
cratedb-ddl: | ||
image: docker.io/crate/crate:latest | ||
command: sh -c "crash --hosts http://cratedb:4200/ -c 'SELECT 1'; crash --hosts http://cratedb:4200/ < /var/ddl.sql" | ||
volumes: | ||
- ./ddl.sql:/var/ddl.sql | ||
depends_on: | ||
- cratedb | ||
amotl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
prometheus: | ||
image: "docker.io/prom/prometheus:latest" | ||
volumes: | ||
- ./prometheus.yml:/etc/prometheus/prometheus.yml | ||
ports: | ||
- "9090:9090" | ||
restart: unless-stopped | ||
|
||
cratedb-prometheus-adapter: | ||
image: ghcr.io/crate/cratedb-prometheus-adapter:0.5.8 | ||
command: -config.file /etc/cratedb-prometheus-adapter.yaml | ||
ports: | ||
- "9268:9268/tcp" | ||
volumes: | ||
- ./cratedb-prometheus-adapter.yaml:/etc/cratedb-prometheus-adapter.yaml | ||
depends_on: | ||
- cratedb-ddl | ||
- prometheus | ||
restart: unless-stopped | ||
|
||
volumes: | ||
cratedb-data: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# https://cratedb.com/docs/guide/integrate/prometheus/ | ||
|
||
cratedb_endpoints: | ||
- host: "cratedb" # Host to connect to (default: "localhost"). | ||
port: 5432 # Port to connect to (default: 5432). | ||
user: "crate" # Username to use (default: "crate") | ||
password: "" # Password to use (default: ""). | ||
schema: "testdrive" # Schema to use (default: ""). | ||
max_connections: 0 # The maximum number of concurrent connections (default: runtime.NumCPU()). | ||
# It will get forwarded to pgx's `pool_max_conns`, and determines | ||
# the maximum number of connections in the connection pool for | ||
# both connection pools (read and write). | ||
read_pool_size_max: 0 # Configure the maximum pool size for read operations individually. | ||
# (default: runtime.NumCPU()) | ||
write_pool_size_max: 0 # Configure the maximum pool size for write operations individually. | ||
# (default: runtime.NumCPU()) | ||
connect_timeout: 10 # TCP connect timeout (seconds) (default: 10). | ||
# It has the same meaning as libpq's `connect_timeout`. | ||
read_timeout: 5 # Query context timeout for read queries (seconds) (default: 5). | ||
write_timeout: 5 # Query context timeout for write queries (seconds) (default: 5). | ||
enable_tls: false # Whether to connect using TLS (default: false). | ||
allow_insecure_tls: false # Whether to allow insecure / invalid TLS certificates (default: false). |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
-- https://cratedb.com/docs/guide/integrate/prometheus/ | ||
|
||
CREATE TABLE IF NOT EXISTS "testdrive"."metrics" ( | ||
"timestamp" TIMESTAMP, | ||
"labels_hash" STRING, | ||
"labels" OBJECT(DYNAMIC), | ||
"value" DOUBLE, | ||
"valueRaw" LONG, | ||
"day__generated" TIMESTAMP GENERATED ALWAYS AS date_trunc('day', "timestamp"), | ||
PRIMARY KEY ("timestamp", "labels_hash", "day__generated") | ||
) PARTITIONED BY ("day__generated"); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,8 +7,8 @@ | |
```{div} .clearfix | ||
``` | ||
|
||
|
||
## About | ||
:::{rubric} About | ||
::: | ||
|
||
[Prometheus] is an open-source systems monitoring and alerting toolkit | ||
for collecting metrics data from applications and infrastructures. | ||
|
@@ -37,8 +37,6 @@ Prometheus's main features are: | |
:::: | ||
|
||
|
||
## Learn | ||
|
||
:::{rubric} Remote Endpoints and Storage | ||
::: | ||
|
||
|
@@ -57,15 +55,10 @@ massively scale-out Prometheus. | |
|
||
::::{grid} | ||
|
||
:::{grid-item-card} Blog: Getting started | ||
:link: https://cratedb.com/blog/getting-started-prometheus-cratedb-long-term-storage | ||
:link-type: url | ||
Getting started with Prometheus and CrateDB for long-term storage. | ||
::: | ||
|
||
Comment on lines
-60
to
-65
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @michaelkremmel: The article Getting Started With Prometheus and CrateDB for Long-Term Storage still uses CrateDB 2.2 and already bears the admonition This article is more than 4 years old. That's fine, but let's stop referring to it hereby. Now that the canonical documentation page will be modernized, can you prominently refer here at the top of the page instead? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for letting me know @amotl. I unpublished the blog post and created a redirect to the documentation. No need to keep old blog posts if they could confuse readers and also LLMs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Excellent, thanks. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now, let's review and bring in the updated content (this patch) to make the modernization complete. |
||
:::{grid-item-card} Store Prometheus long-term metrics into CrateDB | ||
:link: prometheus-usage | ||
:link-type: ref | ||
:columns: 6 | ||
Set up CrateDB as a long-term metrics store for Prometheus using Docker Compose. | ||
::: | ||
|
||
|
@@ -99,13 +92,6 @@ usage guide. | |
:::: | ||
|
||
|
||
:::{rubric} Repositories | ||
::: | ||
|
||
[CrateDB] • | ||
[Prometheus] • | ||
[CrateDB Prometheus Adapter] | ||
|
||
|
||
```{seealso} | ||
[CrateDB and Prometheus] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# https://cratedb.com/docs/guide/integrate/prometheus/ | ||
|
||
global: | ||
scrape_interval: 15s # By default, scrape targets every 15 seconds. | ||
|
||
# Attach these labels to any time series or alerts when communicating with | ||
# external systems (federation, remote storage, Alertmanager). | ||
external_labels: | ||
monitor: 'codelab-monitor' | ||
|
||
# A scrape configuration containing exactly one endpoint to scrape: | ||
# Here it's Prometheus itself. | ||
scrape_configs: | ||
# The job name is added as a label `job=<job_name>` to any time-series scraped from this config. | ||
- job_name: 'prometheus' | ||
|
||
# Override the global default and scrape targets from this job every 5 seconds. | ||
scrape_interval: 5s | ||
|
||
static_configs: | ||
- targets: ['prometheus:9090'] | ||
|
||
remote_write: | ||
- url: http://cratedb-prometheus-adapter:9268/write | ||
remote_read: | ||
- url: http://cratedb-prometheus-adapter:9268/read |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refreshing this article did not take many efforts. It was merely just copy/paste from a series of others following the same scheme, then slotting in the Docker Compose file and configuration files from the original article. If you agree with those kinds of changes, we'd like to encourage you to find similar spots to modernize easily.