Technology Templates¶
NthLayer includes built-in templates for common technology dependencies. Each template generates dashboard panels and alerts for the specified technology.
Supported Technologies¶
| Technology | Template | Status |
|---|---|---|
| PostgreSQL | postgresql | ✅ Complete |
| Redis | redis | ✅ Complete |
| Elasticsearch | elasticsearch | ✅ Complete |
| Kafka | kafka | 📋 Planned |
| MongoDB | mongodb | 📋 Planned |
| RabbitMQ | rabbitmq | 📋 Planned |
Usage¶
Add dependencies to your service.yaml:
NthLayer automatically generates:
- Dashboard panels for each dependency
- Alerts for common failure modes
- Recording rules for SLO calculations
Prometheus Exporters Required¶
Technology templates expect metrics from Prometheus exporters. When nthlayer verify reports missing metrics, install the appropriate exporter:
| Technology | Exporter | Repository | Key Metrics |
|---|---|---|---|
| PostgreSQL | postgres_exporter | prometheus-community/postgres_exporter | pg_stat_*, pg_database_* |
| Redis | redis_exporter | oliver006/redis_exporter | redis_* |
| Elasticsearch | elasticsearch_exporter | prometheus-community/elasticsearch_exporter | elasticsearch_* |
| Kafka | kafka_exporter | danielqsj/kafka_exporter | kafka_* |
| MongoDB | mongodb_exporter | percona/mongodb_exporter | mongodb_* |
| RabbitMQ | Built-in plugin | RabbitMQ Prometheus | rabbitmq_* |
Template Details¶
PostgreSQL¶
Exporter: postgres_exporter
Panels generated:
| Panel | Intent | Metrics Used |
|---|---|---|
| Connections | postgresql.connections | pg_stat_database_numbackends, pg_stat_activity_count |
| Cache Hit Ratio | postgresql.cache_hit | pg_stat_database_blks_hit, pg_stat_database_blks_read |
| Transactions | postgresql.transactions_committed | pg_stat_database_xact_commit, pg_stat_database_xact_rollback |
| Database Size | postgresql.database_size | pg_database_size_bytes |
| Query Duration | postgresql.query_duration | pg_stat_statements_mean_exec_time_seconds_bucket |
| Deadlocks | postgresql.deadlocks | pg_stat_database_deadlocks |
| Replication Lag | postgresql.replication_lag | pg_replication_lag_seconds |
| Table Bloat | postgresql.table_bloat | pg_stat_user_tables_n_dead_tup |
Redis¶
Exporter: redis_exporter
Panels generated:
| Panel | Intent | Metrics Used |
|---|---|---|
| Memory Usage | redis.memory | redis_memory_used_bytes, redis_used_memory |
| Connected Clients | redis.connections | redis_connected_clients, redis_clients_connected |
| Keys | redis.keys | redis_db_keys, redis_keys_total |
| Hit Rate | redis.hits / redis.misses | redis_keyspace_hits_total, redis_keyspace_misses_total |
| Evictions | redis.evicted_keys | redis_evicted_keys_total |
| Expired Keys | redis.expired_keys | redis_expired_keys_total |
| Commands/sec | redis.commands | redis_commands_processed_total |
Elasticsearch¶
Exporter: elasticsearch_exporter
Panels generated:
| Panel | Intent | Metrics Used |
|---|---|---|
| Cluster Health | elasticsearch.cluster_health | elasticsearch_cluster_health_status |
| Shards | elasticsearch.shards | elasticsearch_cluster_health_active_shards |
| Search Rate | elasticsearch.search_rate | elasticsearch_indices_search_query_total |
| Search Latency | elasticsearch.search_latency | elasticsearch_indices_search_query_time_seconds_bucket |
| Indexing Rate | elasticsearch.indexing_rate | elasticsearch_indices_indexing_index_total |
| Index Size | elasticsearch.index_size | elasticsearch_indices_store_size_bytes |
| JVM Heap | elasticsearch.jvm_heap | elasticsearch_jvm_memory_used_bytes |
| GC Time | elasticsearch.gc_time | elasticsearch_jvm_gc_collection_seconds_sum |
Troubleshooting Missing Metrics¶
When nthlayer verify reports missing metrics for a dependency:
$ nthlayer verify services/checkout-service.yaml
Verifying checkout-service...
Missing metrics for postgresql dependency:
- pg_stat_database_numbackends
- pg_stat_database_blks_hit
Missing metrics for redis dependency:
- redis_memory_used_bytes
Resolution Steps¶
-
Check exporter is installed and running
-
Verify Prometheus is scraping the exporter
-
Confirm metric labels match
NthLayer templates expect a service label. Configure relabeling if needed:
relabel_configs:
- source_labels: [__address__]
target_label: service
replacement: 'checkout-service'
- Check exporter version
Some metrics require specific exporter versions. Refer to the exporter's documentation for metric availability.
Intent Resolution¶
NthLayer uses an intent system to handle metric variability:
- Intent defined - e.g.,
postgresql.connections - Candidates listed - Multiple metric names that satisfy the intent
- Discovery - NthLayer queries Prometheus to find which candidates exist
- Resolution - Uses the first available metric, or shows guidance if none found
This allows templates to work across different exporter versions and configurations.
Custom Overrides¶
Override default metrics in your service.yaml: