Skip to content

Commit

Permalink
Stack metrics (#743)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChuckHend authored May 7, 2024
1 parent 61d17bf commit ae42c02
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tembo-operator/src/extensions/database_queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub fn check_input(input: &str) -> bool {
pub const LIST_SHARED_PRELOAD_LIBRARIES_QUERY: &str = r#"SHOW shared_preload_libraries;"#;

pub const LIST_DATABASES_QUERY: &str =
r#"SELECT datname FROM pg_database WHERE datistemplate = false;"#;
r#"SELECT datname FROM pg_database WHERE datname != 'template0';"#;

pub const LIST_EXTENSIONS_QUERY: &str = r#"select
distinct on
Expand Down
12 changes: 11 additions & 1 deletion tembo-stacks/src/stacks/specs/message_queue.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,20 @@ extensions:
- database: postgres
enabled: true
version: 1.1.1
- database: app
enabled: true
version: 1.1.1
- database: template1
enabled: true
version: 1.1.1
- name: pg_partman
locations:
- database: postgres
enabled: true
version: 4.7.4
postgres_metrics:
pgmq:
query: select queue_name, queue_length, oldest_msg_age_sec, newest_msg_age_sec, total_messages from pgmq.metrics_all()
query: select queue_name, queue_length, oldest_msg_age_sec, newest_msg_age_sec, total_messages, current_database() as datname from pgmq.metrics_all()
master: true
metrics:
- queue_name:
Expand All @@ -85,7 +91,11 @@ postgres_metrics:
- total_messages:
usage: GAUGE
description: Total number of messages that have passed into the queue.
- datname:
usage: "LABEL"
description: "Name of current database"
target_databases:
- "*"
- "postgres"
postgres_config_engine: mq
postgres_config:
Expand Down
20 changes: 20 additions & 0 deletions tembo-stacks/src/stacks/specs/vectordb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ extensions:
- database: postgres
enabled: true
version: 0.15.0
- database: app
enabled: true
version: 0.15.0
- database: template1
enabled: true
version: 0.15.0
- name: pg_stat_statements
locations:
- database: postgres
Expand Down Expand Up @@ -123,3 +129,17 @@ postgres_config:
value: vectorize,pg_stat_statements,pg_cron
- name: vectorize.embedding_service_url
value: http://${NAMESPACE}-embeddings.${NAMESPACE}.svc.cluster.local:3000/v1/embeddings
postgres_metrics:
vectorize_jobs:
query: select count(*) as total_jobs, current_database() as datname from vectorize.job
master: true
metrics:
- total_jobs:
usage: GAUGE
description: Number of vectorize jobs
- datname:
usage: "LABEL"
description: "Name of current database"
target_databases:
- "*"
- "postgres"
2 changes: 1 addition & 1 deletion tembo-stacks/src/stacks/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ mod tests {
assert_eq!(mq_metrics.queries.len(), 1);
assert!(mq_metrics.queries.contains_key("pgmq"));
assert!(mq_metrics.queries["pgmq"].master);
assert_eq!(mq_metrics.queries["pgmq"].metrics.len(), 5);
assert_eq!(mq_metrics.queries["pgmq"].metrics.len(), 6);

let mut std = get_stack(StackType::Standard);
let infra = Infrastructure {
Expand Down

0 comments on commit ae42c02

Please sign in to comment.