Skip to content

Commit

Permalink
Merge pull request #7 from kabisa/renovate/configure
Browse files Browse the repository at this point in the history
Configure Renovate
  • Loading branch information
obeleh authored Aug 5, 2022
2 parents 2d3d1bc + a1e0502 commit 8b92409
Show file tree
Hide file tree
Showing 15 changed files with 140 additions and 87 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Generate terraform docs

on:
push:
# don't run when we push a tag
tags-ignore:
- '*'
# don't run when we merge to main
# the action should have run already
branches-ignore:
- 'main'
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: terraform-linters/setup-tflint@v2
name: Setup TFLint
with:
tflint_version: v0.38.1
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: pre-commit/[email protected]
# pre-commit fails if it changed files
# we want to go on
continue-on-error: true
- uses: pre-commit/[email protected]
- uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
5 changes: 2 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ repos:
- id: terraform-fmt
- id: terraform-validate
- id: tflint
- repo: git@github.com:kabisa/terraform-datadog-pre-commit-hook.git
rev: "1.2.2"
- repo: https://github.com/kabisa/terraform-datadog-pre-commit-hook
rev: "1.3.6"
hooks:
- id: terraform-datadog-docs
exclude: ^README.md$
args:
- "."
21 changes: 18 additions & 3 deletions .terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

148 changes: 76 additions & 72 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,47 +14,31 @@ We have two base modules we use to standardise development of our Monitor Module

Modules are generated with this tool: https://github.com/kabisa/datadog-terraform-generator


[Module Variables](#module-variables)

Monitors:
* [Terraform module for Datadog Redis](#terraform-module-for-datadog-redis)
* [Evicted Keys](#evicted-keys)
* [Blocked Clients](#blocked-clients)
* [Connected Clients](#connected-clients)
* [Hitratio](#hitratio)
* [Memory Free Bytes](#memory-free-bytes)
* [Memory Fragmentation](#memory-fragmentation)
* [Oom Error](#oom-error)
* [Memory Used Percentage](#memory-used-percentage)
* [Latency](#latency)
* [Module Variables](#module-variables)

| Monitor name | Default enabled | Priority | Query |
|-----------------|------|----|------------------------|
| [Blocked Clients](#blocked-clients) | True | 2 | `avg(last_5m):avg:redis.clients.blocked{tag:xxx} >= 10` |
| [Connected Clients](#connected-clients) | True | 3 | `avg(last_5m):avg:redis.net.clients{tag:xxx} >= 800` |
| [Evicted Keys](#evicted-keys) | True | 3 | `avg(last_5m):avg:redis.keys.evicted{tag:xxx} >= 20` |
| [Hitratio](#hitratio) | True | 4 | `avg(last_5m):( avg:redis.stats.keyspace_hits{tag:xxx} / ( avg:redis.stats.keyspace_hits{tag:xxx} + avg:redis.stats.keyspace_misses{tag:xxx} ) ) * 100 <= 40` |
| [Latency](#latency) | True | 3 | `avg(last_15m):avg:redis.info.latency_ms{tag:xxx} >= 25` |
| [Memory Fragmentation](#memory-fragmentation) | True | 3 | `avg(last_5m):avg:redis.mem.fragmentation_ratio{tag:xxx} > 1.5` |
| [Memory Free Bytes](#memory-free-bytes) | True | 2 | `avg(last_5m):avg:redis.mem.maxmemory{tag:xxx} - avg:redis.mem.used{tag:xxx} < 500000000` |
| [Memory Used Percentage](#memory-used-percentage) | True | 2 | `avg(last_5m):( avg:redis.mem.used{tag:xxx} / avg:redis.mem.maxmemory{tag:xxx} ) * 100 >= 95` |
| [Oom Error](#oom-error) | True | 2 | `logs(\"OOM command not allowed when used memory \\> 'maxmemory'.\").index(\"*\").rollup(\"count\").last(\"15m\") > 5` |

# Getting started developing
[pre-commit](http://pre-commit.com/) was used to do Terraform linting and validating.

Steps:
- Install [pre-commit](http://pre-commit.com/). E.g. `brew install pre-commit`.
- Run `pre-commit install` in this repo. (Every time you cloud a repo with pre-commit enabled you will need to run the pre-commit install command)
- Run `pre-commit install` in this repo. (Every time you clone a repo with pre-commit enabled you will need to run the pre-commit install command)
- That’s it! Now every time you commit a code change (`.tf` file), the hooks in the `hooks:` config `.pre-commit-config.yaml` will execute.

## Evicted Keys

Query:
```terraform
avg(last_5m):avg:redis.keys.evicted{tag:xxx} >= 20
```

| variable | default | required | description |
|--------------------------------|----------|----------|----------------------------------|
| evicted_keys_enabled | True | No | eviction in redis |
| evicted_keys_warning | 10 | No | |
| evicted_keys_critical | 20 | No | |
| evicted_keys_evaluation_period | last_5m | No | |
| evicted_keys_note | "" | No | |
| evicted_keys_docs | "" | No | |
| evicted_keys_filter_override | "" | No | |
| evicted_keys_alerting_enabled | True | No | |
| evicted_keys_priority | 3 | No | Number from 1 (high) to 5 (low). |


## Blocked Clients

Query:
Expand Down Expand Up @@ -95,6 +79,26 @@ avg(last_5m):avg:redis.net.clients{tag:xxx} >= 800
| connected_clients_priority | 3 | No | Number from 1 (high) to 5 (low). |


## Evicted Keys

Query:
```terraform
avg(last_5m):avg:redis.keys.evicted{tag:xxx} >= 20
```

| variable | default | required | description |
|--------------------------------|----------|----------|----------------------------------|
| evicted_keys_enabled | True | No | eviction in redis |
| evicted_keys_warning | 10 | No | |
| evicted_keys_critical | 20 | No | |
| evicted_keys_evaluation_period | last_5m | No | |
| evicted_keys_note | "" | No | |
| evicted_keys_docs | "" | No | |
| evicted_keys_filter_override | "" | No | |
| evicted_keys_alerting_enabled | True | No | |
| evicted_keys_priority | 3 | No | Number from 1 (high) to 5 (low). |


## Hitratio

Query:
Expand All @@ -115,24 +119,24 @@ avg(last_5m):( avg:redis.stats.keyspace_hits{tag:xxx} / ( avg:redis.stats.keyspa
| hitratio_priority | 4 | No | Number from 1 (high) to 5 (low). |


## Memory Free Bytes
## Latency

Query:
```terraform
avg(last_5m):avg:redis.mem.maxmemory{tag:xxx} - avg:redis.mem.used{tag:xxx} < 500000000
avg(last_15m):avg:redis.info.latency_ms{tag:xxx} >= 25
```

| variable | default | required | description |
|-------------------------------------|------------|----------|----------------------------------|
| memory_free_bytes_enabled | True | No | Memory free in redis |
| memory_free_bytes_warning | 1000000000 | No | |
| memory_free_bytes_critical | 500000000 | No | |
| memory_free_bytes_evaluation_period | last_5m | No | |
| memory_free_bytes_note | "" | No | |
| memory_free_bytes_docs | "" | No | |
| memory_free_bytes_filter_override | "" | No | |
| memory_free_bytes_alerting_enabled | True | No | |
| memory_free_bytes_priority | 2 | No | Number from 1 (high) to 5 (low). |
| variable | default | required | description |
|---------------------------|----------|----------|----------------------------------|
| latency_enabled | True | No | Latency in redis |
| latency_warning | None | No | |
| latency_critical | 25 | No | |
| latency_evaluation_period | last_15m | No | |
| latency_note | "" | No | |
| latency_docs | "" | No | |
| latency_filter_override | "" | No | |
| latency_alerting_enabled | True | No | |
| latency_priority | 3 | No | Number from 1 (high) to 5 (low). |


## Memory Fragmentation
Expand All @@ -155,25 +159,24 @@ avg(last_5m):avg:redis.mem.fragmentation_ratio{tag:xxx} > 1.5
| memory_fragmentation_priority | 3 | No | Number from 1 (high) to 5 (low). |


## Oom Error
## Memory Free Bytes

Query:
```terraform
logs(\"OOM command not allowed when used memory \\> 'maxmemory'.\").index(\"*\").rollup(\"count\").last(\"15m\") > 5
avg(last_5m):avg:redis.mem.maxmemory{tag:xxx} - avg:redis.mem.used{tag:xxx} < 500000000
```

| variable | default | required | description |
|-----------------------------|-----------|----------|----------------------------------|
| oom_error_enabled | True | No | oom_error in redis |
| oom_error_warning | 1 | No | |
| oom_error_critical | 5 | No | |
| oom_error_evaluation_period | last_5m | No | |
| oom_error_note | "" | No | |
| oom_error_docs | "" | No | |
| oom_error_filter_override | "" | No | |
| oom_error_alerting_enabled | True | No | |
| oom_error_type | log alert | No | |
| oom_error_priority | 2 | No | Number from 1 (high) to 5 (low). |
| variable | default | required | description |
|-------------------------------------|------------|----------|----------------------------------|
| memory_free_bytes_enabled | True | No | Memory free in redis |
| memory_free_bytes_warning | 1000000000 | No | |
| memory_free_bytes_critical | 500000000 | No | |
| memory_free_bytes_evaluation_period | last_5m | No | |
| memory_free_bytes_note | "" | No | |
| memory_free_bytes_docs | "" | No | |
| memory_free_bytes_filter_override | "" | No | |
| memory_free_bytes_alerting_enabled | True | No | |
| memory_free_bytes_priority | 2 | No | Number from 1 (high) to 5 (low). |


## Memory Used Percentage
Expand All @@ -196,24 +199,25 @@ avg(last_5m):( avg:redis.mem.used{tag:xxx} / avg:redis.mem.maxmemory{tag:xxx} )
| memory_used_percentage_priority | 2 | No | Number from 1 (high) to 5 (low). |


## Latency
## Oom Error

Query:
```terraform
avg(last_15m):avg:redis.info.latency_ms{tag:xxx} >= 25
logs(\"OOM command not allowed when used memory \\> 'maxmemory'.\").index(\"*\").rollup(\"count\").last(\"15m\") > 5
```

| variable | default | required | description |
|---------------------------|----------|----------|----------------------------------|
| latency_enabled | True | No | Latency in redis |
| latency_warning | None | No | |
| latency_critical | 25 | No | |
| latency_evaluation_period | last_15m | No | |
| latency_note | "" | No | |
| latency_docs | "" | No | |
| latency_filter_override | "" | No | |
| latency_alerting_enabled | True | No | |
| latency_priority | 3 | No | Number from 1 (high) to 5 (low). |
| variable | default | required | description |
|-----------------------------|-----------|----------|----------------------------------|
| oom_error_enabled | True | No | oom_error in redis |
| oom_error_warning | 1 | No | |
| oom_error_critical | 5 | No | |
| oom_error_evaluation_period | last_5m | No | |
| oom_error_note | "" | No | |
| oom_error_docs | "" | No | |
| oom_error_filter_override | "" | No | |
| oom_error_alerting_enabled | True | No | |
| oom_error_type | log alert | No | |
| oom_error_priority | 2 | No | Number from 1 (high) to 5 (low). |


## Module Variables
Expand Down
2 changes: 1 addition & 1 deletion blocked-clients.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ locals {

module "blocked_clients_clients" {
source = "kabisa/generic-monitor/datadog"
version = "0.7.5"
version = "1.0.0"

name = "Blocked Clients"
query = "avg(${var.blocked_clients_evaluation_period}):avg:redis.clients.blocked{${local.blocked_clients_filter}} >= ${var.blocked_clients_critical}"
Expand Down
2 changes: 1 addition & 1 deletion connected-clients.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ locals {

module "connected_clients" {
source = "kabisa/generic-monitor/datadog"
version = "0.7.5"
version = "1.0.0"

name = "Connected Clients"
query = "avg(${var.connected_clients_evaluation_period}):avg:redis.net.clients{${local.connected_clients_filter}} >= ${var.connected_clients_critical}"
Expand Down
2 changes: 1 addition & 1 deletion evicted-keys.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ locals {

module "evicted_keys" {
source = "kabisa/generic-monitor/datadog"
version = "0.7.5"
version = "1.0.0"

name = "Evicted Keys"
query = "avg(${var.evicted_keys_evaluation_period}):avg:redis.keys.evicted{${local.evicted_keys_filter}} >= ${var.evicted_keys_critical}"
Expand Down
2 changes: 1 addition & 1 deletion hitratio.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ locals {

module "hitratio" {
source = "kabisa/generic-monitor/datadog"
version = "0.7.5"
version = "1.0.0"

name = "Hitratio"
query = "avg(${var.hitratio_evaluation_period}):( avg:redis.stats.keyspace_hits{${local.hitratio_filter}} / ( avg:redis.stats.keyspace_hits{${local.hitratio_filter}} + avg:redis.stats.keyspace_misses{${local.hitratio_filter}} ) ) * 100 <= ${var.hitratio_critical}"
Expand Down
2 changes: 1 addition & 1 deletion latency.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ locals {

module "latency" {
source = "kabisa/generic-monitor/datadog"
version = "0.7.5"
version = "1.0.0"

name = "Latency"
query = "avg(${var.latency_evaluation_period}):avg:redis.info.latency_ms{${local.latency_filter}} >= ${var.latency_critical}"
Expand Down
2 changes: 1 addition & 1 deletion memory-fragmentation.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ locals {

module "memory_fragmentation" {
source = "kabisa/generic-monitor/datadog"
version = "0.7.5"
version = "1.0.0"

name = "Memory Fragmentation"
query = "avg(${var.memory_fragmentation_evaluation_period}):avg:redis.mem.fragmentation_ratio{${local.memory_fragmentation_filter}} > ${var.memory_fragmentation_critical}"
Expand Down
2 changes: 1 addition & 1 deletion memory-free-bytes.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ locals {

module "memory_free_bytes" {
source = "kabisa/generic-monitor/datadog"
version = "0.7.5"
version = "1.0.0"

name = "Available Memory"
query = "avg(${var.memory_free_bytes_evaluation_period}):avg:redis.mem.maxmemory{${local.memory_free_bytes_filter}} - avg:redis.mem.used{${local.memory_free_bytes_filter}} < ${var.memory_free_bytes_critical}"
Expand Down
2 changes: 1 addition & 1 deletion memory-used-percentage.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ locals {

module "memory_used_percentage" {
source = "kabisa/generic-monitor/datadog"
version = "0.7.5"
version = "1.0.0"

name = "Memory Usage"
query = "avg(${var.memory_used_percentage_evaluation_period}):( avg:redis.mem.used{${local.memory_used_percentage_filter}} / avg:redis.mem.maxmemory{${local.memory_used_percentage_filter}} ) * 100 >= ${var.memory_used_percentage_critical}"
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion OOM-error.tf → oom-error.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ locals {

module "oom_error" {
source = "kabisa/generic-monitor/datadog"
version = "0.7.5"
version = "1.0.0"

name = "Out Of Memory errors in the logs"
query = "logs(\"OOM command not allowed when used memory \\> 'maxmemory'.\").index(\"*\").rollup(\"count\").last(\"15m\") > ${var.oom_error_critical}"
Expand Down
6 changes: 6 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base"
]
}

0 comments on commit 8b92409

Please sign in to comment.