Skip to content

Commit

Permalink
all: remove dead code from static mode (#55)
Browse files Browse the repository at this point in the history
While #15 removed static mode and operator from being
reachable from the binary, all static mode code remained in the database
to be removed later.

This commit removes all unreachable code; what remains is constrained to
config structre which is still used for config conversion.

This commit does accidentally remove code that changed the order of
static mode conversion components. This isn't a big deal, and the
converted configs are still correct, so that code is being left out
rather than being hunted down. (It is likely code that implements an
interface but wasn't called directly.)
  • Loading branch information
rfratto authored Mar 21, 2024
1 parent 95f66e0 commit 4272894
Show file tree
Hide file tree
Showing 133 changed files with 160 additions and 22,187 deletions.
12 changes: 2 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
## generate-drone Generate the Drone YAML from Jsonnet.
## generate-helm-docs Generate Helm chart documentation.
## generate-helm-tests Generate Helm chart tests.
## generate-protos Generate protobuf files.
## generate-ui Generate the UI assets.
## generate-versioned-files Generate versioned files.
##
Expand Down Expand Up @@ -219,8 +218,8 @@ agent-boringcrypto-image:
# Targets for generating assets
#

.PHONY: generate generate-drone generate-helm-docs generate-helm-tests generate-protos generate-ui generate-versioned-files
generate: generate-drone generate-helm-docs generate-helm-tests generate-protos generate-ui generate-versioned-files generate-docs
.PHONY: generate generate-drone generate-helm-docs generate-helm-tests generate-ui generate-versioned-files
generate: generate-drone generate-helm-docs generate-helm-tests generate-ui generate-versioned-files generate-docs

generate-drone:
drone jsonnet -V BUILD_IMAGE_VERSION=$(BUILD_IMAGE_VERSION) --stream --format --source .drone/drone.jsonnet --target .drone/drone.yml
Expand All @@ -239,13 +238,6 @@ else
bash ./operations/helm/scripts/rebuild-tests.sh
endif

generate-protos:
ifeq ($(USE_CONTAINER),1)
$(RERUN_IN_CONTAINER)
else
go generate ./internal/static/agentproto/
endif

generate-ui:
ifeq ($(USE_CONTAINER),1)
$(RERUN_IN_CONTAINER)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,32 @@ logging {
format = "json"
}

faro.receiver "integrations_app_agent_receiver" {
extra_log_labels = {}

server {
listen_address = "localhost"
listen_port = 55678
max_allowed_payload_size = "4MiB786KiB832B"

rate_limiting {
enabled = true
rate = 100
burst_size = 50
}
}

sourcemaps {
download_from_origins = ["*"]
download_timeout = "1s"
}

output {
logs = [loki.write.logs_log_config.receiver]
traces = []
}
}

loki.relabel "integrations_eventhandler" {
forward_to = [loki.write.logs_log_config.receiver]

Expand Down Expand Up @@ -237,27 +263,6 @@ prometheus.scrape "integrations_elasticsearch" {
job_name = "integrations/elasticsearch"
}

prometheus.exporter.gcp "integrations_gcp_exporter" {
project_ids = ["<project_id>"]
metrics_prefixes = ["loadbalancing.googleapis.com/https/request_bytes_count", "loadbalancing.googleapis.com/https/total_latencies"]
extra_filters = ["loadbalancing.googleapis.com:resource.labels.backend_target_name=\"sample-value\""]
}

discovery.relabel "integrations_gcp" {
targets = prometheus.exporter.gcp.integrations_gcp_exporter.targets

rule {
target_label = "job"
replacement = "integrations/gcp"
}
}

prometheus.scrape "integrations_gcp" {
targets = discovery.relabel.integrations_gcp.output
forward_to = [prometheus.remote_write.metrics_default.receiver]
job_name = "integrations/gcp"
}

prometheus.exporter.github "integrations_github_exporter" {
repositories = ["grafana/agent", "grafana/agent-modules"]
api_token = "ABCDEFGH-1234-ABCD-1234-ABCDEFGHIJKL"
Expand Down Expand Up @@ -680,32 +685,6 @@ prometheus.scrape "integrations_apache2" {
job_name = "integrations/apache2"
}

faro.receiver "integrations_app_agent_receiver" {
extra_log_labels = {}

server {
listen_address = "localhost"
listen_port = 55678
max_allowed_payload_size = "4MiB786KiB832B"

rate_limiting {
enabled = true
rate = 100
burst_size = 50
}
}

sourcemaps {
download_from_origins = ["*"]
download_timeout = "1s"
}

output {
logs = [loki.write.logs_log_config.receiver]
traces = []
}
}

prometheus.exporter.blackbox "integrations_blackbox" {
config = "modules:\n http_2xx:\n prober: http\n timeout: 5s\n http:\n method: POST\n headers:\n Content-Type: application/json\n body: '{}'\n preferred_ip_protocol: ip4\n"

Expand Down Expand Up @@ -762,3 +741,24 @@ prometheus.scrape "integrations_snmp" {
forward_to = [prometheus.remote_write.metrics_default.receiver]
job_name = "integrations/snmp"
}

prometheus.exporter.gcp "integrations_gcp_exporter" {
project_ids = ["<project_id>"]
metrics_prefixes = ["loadbalancing.googleapis.com/https/request_bytes_count", "loadbalancing.googleapis.com/https/total_latencies"]
extra_filters = ["loadbalancing.googleapis.com:resource.labels.backend_target_name=\"sample-value\""]
}

discovery.relabel "integrations_gcp" {
targets = prometheus.exporter.gcp.integrations_gcp_exporter.targets

rule {
target_label = "job"
replacement = "integrations/gcp"
}
}

prometheus.scrape "integrations_gcp" {
targets = discovery.relabel.integrations_gcp.output
forward_to = [prometheus.remote_write.metrics_default.receiver]
job_name = "integrations/gcp"
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ loki.write "logs_log_config" {
external_labels = {}
}

loki.source.kubernetes_events "integrations_eventhandler" {
forward_to = [loki.write.logs_log_config.receiver]
}

faro.receiver "integrations_app_agent_receiver" {
extra_log_labels = {}

Expand All @@ -45,3 +41,7 @@ faro.receiver "integrations_app_agent_receiver" {
traces = []
}
}

loki.source.kubernetes_events "integrations_eventhandler" {
forward_to = [loki.write.logs_log_config.receiver]
}
Original file line number Diff line number Diff line change
Expand Up @@ -324,33 +324,6 @@ prometheus.scrape "integrations_elasticsearch_exporter" {
}
}

prometheus.exporter.gcp "integrations_gcp_exporter" {
project_ids = ["<project_id>"]
metrics_prefixes = ["loadbalancing.googleapis.com/https/request_bytes_count", "loadbalancing.googleapis.com/https/total_latencies"]
extra_filters = ["loadbalancing.googleapis.com:resource.labels.backend_target_name=\"sample-value\""]
}

discovery.relabel "integrations_gcp_exporter" {
targets = prometheus.exporter.gcp.integrations_gcp_exporter.targets

rule {
target_label = "job"
replacement = "integrations/gcp_exporter"
}
}

prometheus.scrape "integrations_gcp_exporter" {
targets = discovery.relabel.integrations_gcp_exporter.output
forward_to = [prometheus.remote_write.integrations.receiver]
job_name = "integrations/gcp_exporter"

tls_config {
ca_file = "/something7.cert"
cert_file = "/something8.cert"
key_file = "/something9.cert"
}
}

prometheus.exporter.github "integrations_github_exporter" {
repositories = ["grafana/agent", "grafana/agent-modules"]
api_token = "ABCDEFGH-1234-ABCD-1234-ABCDEFGHIJKL"
Expand Down Expand Up @@ -780,3 +753,30 @@ prometheus.scrape "integrations_statsd_exporter" {
key_file = "/something9.cert"
}
}

prometheus.exporter.gcp "integrations_gcp_exporter" {
project_ids = ["<project_id>"]
metrics_prefixes = ["loadbalancing.googleapis.com/https/request_bytes_count", "loadbalancing.googleapis.com/https/total_latencies"]
extra_filters = ["loadbalancing.googleapis.com:resource.labels.backend_target_name=\"sample-value\""]
}

discovery.relabel "integrations_gcp_exporter" {
targets = prometheus.exporter.gcp.integrations_gcp_exporter.targets

rule {
target_label = "job"
replacement = "integrations/gcp_exporter"
}
}

prometheus.scrape "integrations_gcp_exporter" {
targets = discovery.relabel.integrations_gcp_exporter.output
forward_to = [prometheus.remote_write.integrations.receiver]
job_name = "integrations/gcp_exporter"

tls_config {
ca_file = "/something7.cert"
cert_file = "/something8.cert"
key_file = "/something9.cert"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ integrations:
scrape_integration: true
postgres_exporter:
enabled: true
data_source_names:
data_source_names:
- postgres://postgres:password@localhost:5432/postgres?sslmode=disable
relabel_configs:
- source_labels: [__address__]
Expand Down
136 changes: 0 additions & 136 deletions internal/static/agentctl/sync.go

This file was deleted.

Loading

0 comments on commit 4272894

Please sign in to comment.