Skip to content

Commit

Permalink
chore(helm): add README.md, release 0.2.1 (#394)
Browse files Browse the repository at this point in the history
chore(helm): add README.md files for Helm chart
  • Loading branch information
burningalchemist authored Nov 16, 2023
1 parent 5072ceb commit 0e6c041
Show file tree
Hide file tree
Showing 4 changed files with 205 additions and 51 deletions.
2 changes: 1 addition & 1 deletion helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: sql-exporter
description: Database agnostic SQL exporter for Prometheus
type: application
version: 0.2.0
version: 0.2.1
appVersion: 0.13.0
keywords:
- exporter
Expand Down
71 changes: 71 additions & 0 deletions helm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# sql-exporter

![Version: 0.2.1](https://img.shields.io/badge/Version-0.2.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.13.0](https://img.shields.io/badge/AppVersion-0.13.0-informational?style=flat-square)

Database agnostic SQL exporter for Prometheus

## Source Code

* <https://github.com/burningalchemist/sql_exporter>

## Maintainers

| Name | Email | Url |
| ---- | ------ | --- |
| Nikolai Rodionov | <[email protected]> | <https://badhouseplants.net> |

## Installing the Chart

To install the chart with the release name `sql-exporter`:

```console
helm repo add sql_exporter https://burningalchemist.github.io/sql_exporter/
helm install sql_exporter/sql-exporter
```

## Chart Values

### General parameters

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| nameOverride | string | `""` | Provide a name in place of `sql-exporter` |
| fullnameOverride | string | `""` | String to fully override "sql-exporter.fullname" |
| image.repository | string | `"burningalchemist/sql_exporter"` | Image repository |
| image.pullPolicy | string | `"IfNotPresent"` | Image pull policy |
| image.tag | string | `appVersion` value from `Chart.yaml` | Image tag |
| imagePullSecrets | list | `[]` | Secrets with credentials to pull images from a private registry |
| service.type | string | `"ClusterIP"` | Service type |
| service.port | int | `80` | Service port |
| service.labels | object | `{}` | Service labels |
| service.annotations | object | `{}` | Service annotations |
| resources | object | `{}` | Resource limits and requests for the application controller pods |
| podLabels | object | `{}` | Pod labels |
| podAnnotations | object | `{}` | Pod annotations |
| podSecurityContext | object | `{}` | Pod security context |

### Prometheus ServiceMonitor

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| serviceMonitor.enabled | bool | `true` | Enable ServiceMonitor |
| serviceMonitor.interval | string | `"15s"` | ServiceMonitor interval |
| serviceMonitor.path | string | `"/metrics"` | ServiceMonitor path |
| serviceMonitor.scrapeTimeout | string | `"60s"` | ServiceMonitor scrape timeout |

### Configuration

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| config.global.scrape_timeout | string | `"10s"` | Scrape timeout |
| config.global.scrape_timeout_offset | string | `"500ms"` | Scrape timeout offset. Must be strictly positive. |
| config.global.min_interval | string | `"0s"` | Minimum interval between collector runs. |
| config.global.max_connections | int | `3` | Number of open connections. |
| config.global.max_idle_connections | int | `3` | Number of idle connections. |
| target | object | `nil` | Check documentation. Mutually exclusive with `jobs` |
| jobs | list | `nil` | Check documentation. Mutually exclusive with `target` |
| collector_files | list | `[]` | Check documentation |

To configure `target`, `jobs`, `collector_files` please refer to the [documentation](https://github.com/burningalchemist/sql_exporter/blob/master/documentation/sql_exporter.yml) in the source repository. These values are not set by default.

It's also possible to define collectors (i.e. metrics and queries) in separate files, and specify the filenames in the `collector_files` list. For that we can use `CollectorFiles` field (check `values.yaml` for the available example).
61 changes: 61 additions & 0 deletions helm/README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{{ template "chart.header" . }}
{{ template "chart.deprecationWarning" . }}

{{ template "chart.badgesSection" . }}

{{ template "chart.description" . }}

{{ template "chart.sourcesSection" . }}

{{ template "chart.maintainersSection" . }}

{{ template "chart.requirementsSection" . }}


## Installing the Chart

To install the chart with the release name `sql-exporter`:

```console
helm repo add sql_exporter https://burningalchemist.github.io/sql_exporter/
helm install sql_exporter/sql-exporter
```

## Chart Values

### General parameters

| Key | Type | Default | Description |
|-----|------|---------|-------------|
{{- range .Values }}
{{- if not (or (hasPrefix "serviceMonitor" .Key) (hasPrefix "config" .Key) (hasPrefix "collectorFiles" .Key))}}
| {{ .Key }} | {{ .Type }} | {{ if .Default }}{{ .Default }}{{ else }}{{ .AutoDefault }}{{ end }} | {{ if .Description }}{{ .Description }}{{ else }}{{ .AutoDescription }}{{ end }} |
{{- end }}
{{- end }}

### Prometheus ServiceMonitor

| Key | Type | Default | Description |
|-----|------|---------|-------------|
{{- range .Values }}
{{- if hasPrefix "serviceMonitor" .Key }}
| {{ .Key }} | {{ .Type }} | {{ if .Default }}{{ .Default }}{{ else }}{{ .AutoDefault }}{{ end }} | {{ if .Description }}{{ .Description }}{{ else }}{{ .AutoDescription }}{{ end }} |
{{- end }}
{{- end }}

### Configuration

| Key | Type | Default | Description |
|-----|------|---------|-------------|
{{- range .Values }}
{{- if or (hasPrefix "config" .Key) }}
| {{ .Key }} | {{ .Type }} | {{ if .Default }}{{ .Default }}{{ else }}{{ .AutoDefault }}{{ end }} | {{ if .Description }}{{ .Description }}{{ else }}{{ .AutoDescription }}{{ end }} |
{{- end }}
{{- end }}
| target | object | `nil` | Check documentation. Mutually exclusive with `jobs` |
| jobs | list | `nil` | Check documentation. Mutually exclusive with `target` |
| collector_files | list | `[]` | Check documentation |

To configure `target`, `jobs`, `collector_files` please refer to the [documentation](https://github.com/burningalchemist/sql_exporter/blob/master/documentation/sql_exporter.yml) in the source repository. These values are not set by default.

It's also possible to define collectors (i.e. metrics and queries) in separate files, and specify the filenames in the `collector_files` list. For that we can use `CollectorFiles` field (check `values.yaml` for the available example).
122 changes: 72 additions & 50 deletions helm/values.yaml
Original file line number Diff line number Diff line change
@@ -1,89 +1,111 @@
# ---------------------------------------------------------------------
# -- Global values
# ---------------------------------------------------------------------
# -- Provide a name in place of `sql-exporter`
nameOverride: ""
# -- String to fully override "sql-exporter.fullname"
fullnameOverride: ""

image:
# -- Image repository
repository: burningalchemist/sql_exporter
# -- Image pull policy
pullPolicy: IfNotPresent
# tag: $IMAGE_TAG
# -- Image tag
# @default -- `appVersion` value from `Chart.yaml`
tag: ""

# -- Secrets with credentials to pull images from a private registry
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

service:
# -- Service type
type: ClusterIP
# -- Service port
port: 80
# -- Service labels
labels: {}
# -- Service annotations
annotations: {}
# example of prometheus usage
# prometheus.io/scrape: "true"
# prometheus.io/path: "/metrics"
resources:
{}

# -- Resource limits and requests for the application controller pods
resources: {}
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi

# -- Pod labels
podLabels: {}
# -- Pod annotations
podAnnotations: {}

# -- Pod security context
podSecurityContext: {}
securityContext:
{}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
# @ignored
securityContext: {}

# ---------------------------------------------------------------------
# -- Prometheus operator values
# ---------------------------------------------------------------------
# Prometheus Operator values
serviceMonitor:
# -- Enable ServiceMonitor
enabled: true
# -- ServiceMonitor interval
interval: 15s
# ---------------------------------------------------------------------
# -- SQL exporter configuration
# -- For a comprehensive and comprehensively documented configuration
# -- file check out: https://github.com/burningalchemist/sql_exporter/blob/master/documentation/sql_exporter.yml
# ---------------------------------------------------------------------
# -- ServiceMonitor path
path: /metrics
# -- ServiceMonitor scrape timeout
scrapeTimeout: 60s

config:
global:
# -- Scrape timeout
scrape_timeout: 10s
# -- Scrape timeout offset. Must be strictly positive.
scrape_timeout_offset: 500ms
# -- Minimum interval between collector runs.
min_interval: 0s
# -- Number of open connections.
max_connections: 3
# -- Number of idle connections.
max_idle_connections: 3
# ---------------------------------------------------------------------
# -- Target and collectors are not set so the chart is more flexible
# -- Please configure it yourself
# ---------------------------------------------------------------------
# target:
# data_source_name: 'sqlserver://prom_user:[email protected]:1433'
# collectors: [active_connections]
# collectors:
# - collector_name: active_connections
# metrics:
# - metric_name: active_connections
# type: gauge
# help: 'Active connections'
# key_labels:
# - "datname"
# - "usename"
# - "state"
# values:
# - "count"
# query_ref: active_connections
# queries:
# - query_name: active_connections
# query: |
# SELECT
# datname::text,
# usename::text,
# state::text,
# COUNT(state)::float AS count
# FROM pg_stat_activity
# GROUP BY datname, usename, state;
# collector_files:
# - "*.collector.yml"

# Target and collectors are not set so the chart is more flexible. Please configure it yourself.
# target:
# data_source_name: 'sqlserver://prom_user:[email protected]:1433'
# collectors: [active_connections]
# collectors:
# - collector_name: active_connections
# metrics:
# - metric_name: active_connections
# type: gauge
# help: 'Active connections'
# key_labels:
# - "datname"
# - "usename"
# - "state"
# values:
# - "count"
# query_ref: active_connections
# queries:
# - query_name: active_connections
# query: |
# SELECT
# datname::text,
# usename::text,
# state::text,
# COUNT(state)::float AS count
# FROM pg_stat_activity
# GROUP BY datname, usename, state;
# collector_files:
# - "*.collector.yml"

# ---------------------------------------------------------------------
# -- Collector Files
Expand Down

0 comments on commit 0e6c041

Please sign in to comment.