1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231
|
From: Martina Ferrari <tina@debian.org>
Date: Mon, 17 Oct 2022 20:07:52 +0000
Subject: Disable Consul service discovery
Forwarded: not-needed
Last-Update: 2025-02-09
Disable Consul SD, as its Debian package has lots of problems.
---
config/config_test.go | 58 +-------------------------------------
config/testdata/conf.good.yml | 25 ----------------
config/testdata/roundtrip.good.yml | 14 ---------
discovery/consul/consul.go | 3 ++
discovery/consul/consul_test.go | 3 ++
discovery/consul/metrics.go | 3 ++
discovery/install/install.go | 1 -
plugins/plugins.go | 3 --
8 files changed, 10 insertions(+), 100 deletions(-)
diff --git a/config/config_test.go b/config/config_test.go
index d3e860b..ecb8c0a 100644
--- a/config/config_test.go
+++ b/config/config_test.go
@@ -33,7 +33,6 @@ import (
"github.com/prometheus/prometheus/discovery"
"github.com/prometheus/prometheus/discovery/aws"
"github.com/prometheus/prometheus/discovery/azure"
- "github.com/prometheus/prometheus/discovery/consul"
"github.com/prometheus/prometheus/discovery/digitalocean"
"github.com/prometheus/prometheus/discovery/dns"
"github.com/prometheus/prometheus/discovery/eureka"
@@ -385,61 +384,6 @@ var expectedConf = &Config{
},
},
},
- {
- JobName: "service-y",
-
- HonorTimestamps: true,
- ScrapeInterval: model.Duration(15 * time.Second),
- ScrapeTimeout: DefaultGlobalConfig.ScrapeTimeout,
- EnableCompression: true,
- BodySizeLimit: globBodySizeLimit,
- SampleLimit: globSampleLimit,
- TargetLimit: globTargetLimit,
- LabelLimit: globLabelLimit,
- LabelNameLengthLimit: globLabelNameLengthLimit,
- LabelValueLengthLimit: globLabelValueLengthLimit,
- ScrapeProtocols: DefaultGlobalConfig.ScrapeProtocols,
-
- MetricsPath: DefaultScrapeConfig.MetricsPath,
- Scheme: DefaultScrapeConfig.Scheme,
- HTTPClientConfig: config.DefaultHTTPClientConfig,
-
- ServiceDiscoveryConfigs: discovery.Configs{
- &consul.SDConfig{
- Server: "localhost:1234",
- PathPrefix: "/consul",
- Token: "mysecret",
- Services: []string{"nginx", "cache", "mysql"},
- ServiceTags: []string{"canary", "v1"},
- NodeMeta: map[string]string{"rack": "123"},
- TagSeparator: consul.DefaultSDConfig.TagSeparator,
- Scheme: "https",
- RefreshInterval: consul.DefaultSDConfig.RefreshInterval,
- AllowStale: true,
- HTTPClientConfig: config.HTTPClientConfig{
- TLSConfig: config.TLSConfig{
- CertFile: filepath.FromSlash("testdata/valid_cert_file"),
- KeyFile: filepath.FromSlash("testdata/valid_key_file"),
- CAFile: filepath.FromSlash("testdata/valid_ca_file"),
- InsecureSkipVerify: false,
- },
- FollowRedirects: true,
- EnableHTTP2: true,
- },
- },
- },
-
- RelabelConfigs: []*relabel.Config{
- {
- SourceLabels: model.LabelNames{"__meta_sd_consul_tags"},
- Regex: relabel.MustNewRegexp("label:([^=]+)=([^,]+)"),
- Separator: ",",
- TargetLabel: "${1}",
- Replacement: "${2}",
- Action: relabel.Replace,
- },
- },
- },
{
JobName: "service-z",
@@ -1470,7 +1414,7 @@ func TestElideSecrets(t *testing.T) {
yamlConfig := string(config)
matches := secretRe.FindAllStringIndex(yamlConfig, -1)
- require.Len(t, matches, 22, "wrong number of secret matches found")
+ require.Len(t, matches, 21, "wrong number of secret matches found")
require.NotContains(t, yamlConfig, "mysecret",
"yaml marshal reveals authentication credentials.")
}
diff --git a/config/testdata/conf.good.yml b/config/testdata/conf.good.yml
index 3890f51..a7bcdf2 100644
--- a/config/testdata/conf.good.yml
+++ b/config/testdata/conf.good.yml
@@ -160,31 +160,6 @@ scrape_configs:
regex: expensive_metric.*
action: drop
- - job_name: service-y
-
- consul_sd_configs:
- - server: "localhost:1234"
- token: mysecret
- path_prefix: /consul
- services: ["nginx", "cache", "mysql"]
- tags: ["canary", "v1"]
- node_meta:
- rack: "123"
- allow_stale: true
- scheme: https
- tls_config:
- ca_file: valid_ca_file
- cert_file: valid_cert_file
- key_file: valid_key_file
- insecure_skip_verify: false
-
- relabel_configs:
- - source_labels: [__meta_sd_consul_tags]
- separator: ","
- regex: label:([^=]+)=([^,]+)
- target_label: ${1}
- replacement: ${2}
-
- job_name: service-z
tls_config:
diff --git a/config/testdata/roundtrip.good.yml b/config/testdata/roundtrip.good.yml
index 51b59dd..f560e8c 100644
--- a/config/testdata/roundtrip.good.yml
+++ b/config/testdata/roundtrip.good.yml
@@ -37,20 +37,6 @@ scrape_configs:
client_secret: <secret>
port: 9100
- consul_sd_configs:
- - server: localhost:1234
- token: <secret>
- services: [nginx, cache, mysql]
- tags: [canary, v1]
- node_meta:
- rack: "123"
- allow_stale: true
- scheme: https
- tls_config:
- ca_file: valid_ca_file
- cert_file: valid_cert_file
- key_file: valid_key_file
-
digitalocean_sd_configs:
- authorization:
credentials: <secret>
diff --git a/discovery/consul/consul.go b/discovery/consul/consul.go
index bdc1fc8..acde681 100644
--- a/discovery/consul/consul.go
+++ b/discovery/consul/consul.go
@@ -11,6 +11,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+//go:build ignore
+// +build ignore
+
package consul
import (
diff --git a/discovery/consul/consul_test.go b/discovery/consul/consul_test.go
index e3bc793..03e5f09 100644
--- a/discovery/consul/consul_test.go
+++ b/discovery/consul/consul_test.go
@@ -11,6 +11,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+//go:build ignore
+// +build ignore
+
package consul
import (
diff --git a/discovery/consul/metrics.go b/discovery/consul/metrics.go
index 8266e7c..b57999d 100644
--- a/discovery/consul/metrics.go
+++ b/discovery/consul/metrics.go
@@ -11,6 +11,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+//go:build ignore
+// +build ignore
+
package consul
import (
diff --git a/discovery/install/install.go b/discovery/install/install.go
index 41c13fb..631b61f 100644
--- a/discovery/install/install.go
+++ b/discovery/install/install.go
@@ -18,7 +18,6 @@ package install
import (
_ "github.com/prometheus/prometheus/discovery/aws" // register aws
_ "github.com/prometheus/prometheus/discovery/azure" // register azure
- _ "github.com/prometheus/prometheus/discovery/consul" // register consul
_ "github.com/prometheus/prometheus/discovery/digitalocean" // register digitalocean
_ "github.com/prometheus/prometheus/discovery/dns" // register dns
_ "github.com/prometheus/prometheus/discovery/eureka" // register eureka
diff --git a/plugins/plugins.go b/plugins/plugins.go
index e3f0c7a..ce286a1 100644
--- a/plugins/plugins.go
+++ b/plugins/plugins.go
@@ -22,9 +22,6 @@ import (
// Register azure plugin.
_ "github.com/prometheus/prometheus/discovery/azure"
- // Register consul plugin.
- _ "github.com/prometheus/prometheus/discovery/consul"
-
// Register digitalocean plugin.
_ "github.com/prometheus/prometheus/discovery/digitalocean"
|