Skip to content

Commit

Permalink
add integration feature
Browse files Browse the repository at this point in the history
Signed-off-by: Pete Wall <pete.wall@grafana.com>
  • Loading branch information
petewall committed Oct 1, 2024
1 parent def3112 commit 91999f5
Show file tree
Hide file tree
Showing 44 changed files with 2,011 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-feature-charts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ jobs:
run: |
echo "Running make all in charts/${{ matrix.dir }}"
cd charts/${{ matrix.dir }}
make all
make clean build
- name: Check for changes in generated files
run: |
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ FEATURE_CHARTS = $(shell ls charts | grep -v k8s-monitoring)
build:
set -e && \
for chart in $(FEATURE_CHARTS); do \
make -C charts/$$chart all; \
make -C charts/$$chart build; \
done
#make -C charts/k8s-monitoring all
#make -C charts/k8s-monitoring build

.PHONY: test
test: build
Expand Down
10 changes: 7 additions & 3 deletions charts/feature-annotation-autodiscovery/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@ Chart.lock: Chart.yaml
values.schema.json: values.yaml $$(wildcard schema-mods/*)
../../scripts/schema-gen.sh .

.PHONY: all
all: README.md Chart.lock values.schema.json
.PHONY: clean
clean:
rm -f README.md Chart.lock values.schema.json

.PHONY: build
build: README.md Chart.lock values.schema.json

.PHONY: test
test: all
test: build
helm lint .
ifdef HAS_HELM_UNITTEST
helm unittest .
Expand Down
10 changes: 7 additions & 3 deletions charts/feature-application-observability/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@ Chart.lock: Chart.yaml
values.schema.json: values.yaml $$(wildcard schema-mods/*)
../../scripts/schema-gen.sh .

.PHONY: all
all: README.md Chart.lock values.schema.json
.PHONY: clean
clean:
rm -f README.md Chart.lock values.schema.json

.PHONY: build
build: README.md Chart.lock values.schema.json

.PHONY: test
test: all
test: build
helm lint .
ifdef HAS_HELM_UNITTEST
helm unittest .
Expand Down
10 changes: 7 additions & 3 deletions charts/feature-cluster-events/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@ Chart.lock: Chart.yaml
values.schema.json: values.yaml $$(wildcard schema-mods/*)
../../scripts/schema-gen.sh .

.PHONY: all
all: README.md Chart.lock values.schema.json
.PHONY: clean
clean:
rm -f README.md Chart.lock values.schema.json

.PHONY: build
build: README.md Chart.lock values.schema.json

.PHONY: test
test: all
test: build
helm lint .
ifdef HAS_HELM_UNITTEST
helm unittest .
Expand Down
10 changes: 7 additions & 3 deletions charts/feature-cluster-metrics/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@ Chart.lock: Chart.yaml
values.schema.json: values.yaml $$(wildcard schema-mods/*)
../../scripts/schema-gen.sh .

.PHONY: all
all: README.md Chart.lock values.schema.json
.PHONY: clean
clean:
rm -f README.md Chart.lock values.schema.json

.PHONY: build
build: README.md Chart.lock values.schema.json

.PHONY: test
test: all
test: build
helm lint .
ifdef HAS_HELM_UNITTEST
helm unittest .
Expand Down
10 changes: 7 additions & 3 deletions charts/feature-frontend-observability/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@ Chart.lock: Chart.yaml
values.schema.json: values.yaml $$(wildcard schema-mods/*)
../../scripts/schema-gen.sh .

.PHONY: all
all: README.md Chart.lock values.schema.json
.PHONY: clean
clean:
rm -f README.md Chart.lock values.schema.json

.PHONY: build
build: README.md Chart.lock values.schema.json

.PHONY: test
test: all
test: build
helm lint .
ifdef HAS_HELM_UNITTEST
helm unittest .
Expand Down
5 changes: 5 additions & 0 deletions charts/feature-integrations/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
docs
schema-mods
tests
Makefile
README.md
3 changes: 3 additions & 0 deletions charts/feature-integrations/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dependencies: []
digest: sha256:643d5437104296e21d906ecb15b2c96ad278f20cfc4af53b12bb6069bd853726
generated: "2024-09-25T13:47:44.987117-05:00"
7 changes: 7 additions & 0 deletions charts/feature-integrations/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v2

Check failure on line 1 in charts/feature-integrations/Chart.yaml

View workflow job for this annotation

GitHub Actions / runner / yamllint

[yamllint] reported by reviewdog 🐶 [warning] missing document start "---" (document-start) Raw Output: ./charts/feature-integrations/Chart.yaml:1:1: [warning] missing document start "---" (document-start)
name: integrations
description: Service integrations
icon: https://raw.githubusercontent.com/grafana/grafana/main/public/img/grafana_icon.svg
version: 1.0.0
appVersion: 1.0.0
dependencies: []
94 changes: 94 additions & 0 deletions charts/feature-integrations/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
HAS_HELM_DOCS := $(shell command -v helm-docs;)
HAS_HELM_UNITTEST := $(shell helm plugin list | grep unittest 2> /dev/null)

SCHEMA_MODS_JSON_FILES = $(shell find schema-mods -name "*.json")
SCHEMA_MODS_JQ_FILES = $(shell find schema-mods -name "*.jq")

INTEGRATION_VALUES_FILES = $(shell find integrations -name "*-values.yaml")
INTEGRATION_DOCS_FILES = $(INTEGRATION_VALUES_FILES:integrations/%-values.yaml=./docs/integrations/%.md)
INTEGRATION_SCHEMA_FILES = $(INTEGRATION_VALUES_FILES:integrations/%-values.yaml=./schema-mods/definitions/%-integration.schema.json)

Chart.lock: Chart.yaml
helm dependency update .
touch Chart.lock # Ensure the timestamp is updated

.SECONDEXPANSION:
docs/integrations/%.md: integrations/%-values.yaml $$(wildcard docs/integrations/.doc_templates/%.gotmpl)
docker run --platform linux/amd64 --rm -v $(shell pwd):/src ghcr.io/grafana/helm-docs-and-schema-gen $(shell echo $< | sed 's/integrations\/\([-a-z]*\)-values.yaml/\1/') integration

schema-mods/definitions/%-integration.schema.json: integrations/%-values.yaml
docker run --platform linux/amd64 --rm -v $(shell pwd):/src ghcr.io/grafana/helm-docs-and-schema-gen $(shell echo $< | sed 's/integrations\/\([-a-z]*\)-values.yaml/\1/') integration

NUMBER_OF_INTEGRATION_VALUES_FILES := $(words $(INTEGRATION_VALUES_FILES))
schema-mods/integration-list.json: $(INTEGRATION_VALUES_FILES)
@echo '{' > $@
@echo ' "definitions": {' >> $@
@echo ' "integration-list": {' >> $@
@echo ' "type": "array",' >> $@
@echo ' "items": {' >> $@
@echo ' "anyOf": [' >> $@
@count=0; \
for file in $(INTEGRATION_VALUES_FILES); do \
count=$$((count + 1)); \
if [ $$count -eq $(NUMBER_OF_INTEGRATION_VALUES_FILES) ]; then \
echo ' { "$$ref": "#/definitions/'$$(echo $${file} | sed 's/integrations\/\([-a-z]*\)-values.yaml/\1/')'-integration"}' >> $@; \
else \
echo ' { "$$ref": "#/definitions/'$$(echo $${file} | sed 's/integrations\/\([-a-z]*\)-values.yaml/\1/')'-integration"},' >> $@; \
fi; \
done
@echo ' ]' >> $@
@echo ' }' >> $@
@echo ' }' >> $@
@echo ' }' >> $@
@echo '}' >> $@

templates/_integration_types.tpl: $(INTEGRATION_VALUES_FILES)
echo '{{/* Do not edit this file. It is generated by the Makefile */}}' > $@
echo '{{- define "integrations.types" -}}' >> $@
for file in $(INTEGRATION_VALUES_FILES); do \
echo - $$(echo $${file} | sed 's/integrations\/\([-a-z]*\)-values.yaml/\1/') >> $@; \
done
echo '{{- end -}}' >> $@

values.schema.json: values.yaml $(INTEGRATION_SCHEMA_FILES) $(SCHEMA_MODS_JSON_FILES) $(SCHEMA_MODS_JQ_FILES) schema-mods/integration-list.json
../../scripts/schema-gen.sh .

docs/integrations/README.md: $(INTEGRATION_DOCS_FILES)
echo "# Integrations" > $@
echo "" >> $@
echo "This directory contains the values files for the integrations that are available." >> $@
echo "" >> $@
echo "## Integrations" >> $@
echo "" >> $@
echo "| Name | Docs |" >> $@
echo "|------|------|" >> $@
for file in $(INTEGRATION_DOCS_FILES); do \
echo "| $$(echo $${file} | sed 's/\.\/docs\/integrations\/\([-a-z]*\).md/\1/') | [Docs]($$(echo $${file} | sed 's/docs\/integrations\/\([-a-z]*.md\)/\1/')) |" >> $@; \
done

README.md: values.yaml Chart.yaml $$(wildcard README.md.gotmpl)
ifdef HAS_HELM_DOCS
helm-docs
else
docker run --rm --volume "$(shell pwd):/helm-docs" -u $(shell id -u) jnorwood/helm-docs:latest
endif

.PHONY: clean
clean:
rm -f README.md values.schema.json schema-mods/integration-list.json templates/_integration_types.tpl
rm -f $(INTEGRATION_SCHEMA_FILES)
rm -f $(INTEGRATION_DOCS_FILES)
rm -f docs/integrations/README.md

.PHONY: build
build: README.md Chart.lock values.schema.json templates/_integration_types.tpl docs/integrations/README.md

.PHONY: test
test: build
helm lint .
ifdef HAS_HELM_UNITTEST
helm unittest .
else
docker run --rm --volume $(shell pwd):/apps helmunittest/helm-unittest .
endif

42 changes: 42 additions & 0 deletions charts/feature-integrations/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# integrations

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

Service integrations

## Values

### Integration: Alloy

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| alloy | object | `{"instances":[]}` | Scrape metrics from Grafana Alloy |

### Integration: cert-manager

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| cert-manager | object | `{"instances":[]}` | Scrape metrics from cert-manager |

### Integration: etcd

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| etcd | object | `{"instances":[]}` | Scrape metrics from etcd |

### General settings

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| fullnameOverride | string | `""` | Full name override |
| nameOverride | string | `""` | Name override |

### Global Settings

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| global.maxCacheSize | int | `100000` | Sets the max_cache_size for every prometheus.relabel component. ([docs](https://grafana.com/docs/alloy/latest/reference/components/prometheus.relabel/#arguments)) This should be at least 2x-5x your largest scrape target or samples appended rate. |
| global.scrapeInterval | string | `"60s"` | How frequently to scrape metrics. |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2)
105 changes: 105 additions & 0 deletions charts/feature-integrations/default-allow-lists/alloy-integration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
---
# The set of metrics from Grafana Alloy required for the Grafana Alloy integration
- alloy_build_info
- alloy_component_controller_running_components
- alloy_component_dependencies_wait_seconds
- alloy_component_dependencies_wait_seconds_bucket
- alloy_component_evaluation_seconds
- alloy_component_evaluation_seconds_bucket
- alloy_component_evaluation_seconds_count
- alloy_component_evaluation_seconds_sum
- alloy_component_evaluation_slow_seconds
- alloy_config_hash
- alloy_resources_machine_rx_bytes_total
- alloy_resources_machine_tx_bytes_total
- alloy_resources_process_cpu_seconds_total
- alloy_resources_process_resident_memory_bytes
- alloy_tcp_connections
- alloy_wal_samples_appended_total
- alloy_wal_storage_active_series
- cluster_node_gossip_health_score
- cluster_node_gossip_proto_version
- cluster_node_gossip_received_events_total
- cluster_node_info
- cluster_node_lamport_time
- cluster_node_peers
- cluster_node_update_observers
- cluster_transport_rx_bytes_total
- cluster_transport_rx_packet_queue_length
- cluster_transport_rx_packets_failed_total
- cluster_transport_rx_packets_total
- cluster_transport_stream_rx_bytes_total
- cluster_transport_stream_rx_packets_failed_total
- cluster_transport_stream_rx_packets_total
- cluster_transport_stream_tx_bytes_total
- cluster_transport_stream_tx_packets_failed_total
- cluster_transport_stream_tx_packets_total
- cluster_transport_streams
- cluster_transport_tx_bytes_total
- cluster_transport_tx_packet_queue_length
- cluster_transport_tx_packets_failed_total
- cluster_transport_tx_packets_total
- exporter_send_failed_spans_ratio_total
- exporter_sent_spans_ratio_total
- go_gc_duration_seconds_count
- go_goroutines
- go_memstats_heap_inuse_bytes
- loki_process_dropped_lines_total
- loki_write_batch_retries_total
- loki_write_dropped_bytes_total
- loki_write_dropped_entries_total
- loki_write_encoded_bytes_total
- loki_write_mutated_bytes_total
- loki_write_mutated_entries_total
- loki_write_request_duration_seconds_bucket
- loki_write_sent_bytes_total
- loki_write_sent_entries_total
- process_cpu_seconds_total
- process_start_time_seconds
- processor_batch_batch_send_size_ratio_bucket
- processor_batch_metadata_cardinality_ratio
- processor_batch_timeout_trigger_send_ratio_total
- prometheus_remote_storage_bytes_total
- prometheus_remote_storage_enqueue_retries_total
- prometheus_remote_storage_highest_timestamp_in_seconds
- prometheus_remote_storage_metadata_bytes_total
- prometheus_remote_storage_queue_highest_sent_timestamp_seconds
- prometheus_remote_storage_samples_dropped_total
- prometheus_remote_storage_samples_failed_total
- prometheus_remote_storage_samples_pending
- prometheus_remote_storage_samples_retried_total
- prometheus_remote_storage_samples_total
- prometheus_remote_storage_sent_batch_duration_seconds_bucket
- prometheus_remote_storage_sent_batch_duration_seconds_count
- prometheus_remote_storage_sent_batch_duration_seconds_sum
- prometheus_remote_storage_shard_capacity
- prometheus_remote_storage_shards
- prometheus_remote_storage_shards_desired
- prometheus_remote_storage_shards_max
- prometheus_remote_storage_shards_min
- prometheus_remote_storage_succeeded_samples_total
- prometheus_remote_write_wal_samples_appended_total
- prometheus_remote_write_wal_storage_active_series
- prometheus_sd_discovered_targets
- prometheus_target_interval_length_seconds_count
- prometheus_target_interval_length_seconds_sum
- prometheus_target_scrapes_exceeded_sample_limit_total
- prometheus_target_scrapes_sample_duplicate_timestamp_total
- prometheus_target_scrapes_sample_out_of_bounds_total
- prometheus_target_scrapes_sample_out_of_order_total
- prometheus_target_sync_length_seconds_sum
- prometheus_wal_watcher_current_segment
- receiver_accepted_spans_ratio_total
- receiver_refused_spans_ratio_total
- rpc_server_duration_milliseconds_bucket
- scrape_duration_seconds
- traces_exporter_send_failed_spans
- traces_exporter_send_failed_spans_total
- traces_exporter_sent_spans
- traces_exporter_sent_spans_total
- traces_loadbalancer_backend_outcome
- traces_loadbalancer_num_backends
- traces_receiver_accepted_spans
- traces_receiver_accepted_spans_total
- traces_receiver_refused_spans
- traces_receiver_refused_spans_total
3 changes: 3 additions & 0 deletions charts/feature-integrations/default-allow-lists/alloy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
# The minimal set of metrics from Grafana Alloy required for Kubernetes Monitoring
- alloy_build_info
11 changes: 11 additions & 0 deletions charts/feature-integrations/docs/integrations/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Integrations

This directory contains the values files for the integrations that are available.

## Integrations

| Name | Docs |
|------|------|
| etcd | [Docs](./etcd.md) |
| alloy | [Docs](./alloy.md) |
| cert-manager | [Docs](./cert-manager.md) |
Loading

0 comments on commit 91999f5

Please sign in to comment.