Skip to content

Commit

Permalink
Refine the hostname backlist in MetricsPrometheus (pingcap#6784)
Browse files Browse the repository at this point in the history
  • Loading branch information
SeaRise authored and guo-shaoge committed Feb 10, 2023
1 parent 76e725e commit c5ea678
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 11 additions & 2 deletions dbms/src/Server/MetricsPrometheus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,17 @@ std::string getInstanceValue(const Poco::Util::AbstractConfiguration & conf)
auto service_addr = conf.getString("flash.service_addr");
if (service_addr.empty())
return getHostName();
// "0.0.0.0", "127.x.x.x", "locallhost", "0:0:0:0:0:0:0:0", "0:0:0:0:0:0:0:1", "::", "::1", ":${port}"
static const std::vector<std::string> blacklist{"0.0.0.0", "127.", "locallhost", "0:0:0:0:0:0:0", ":"};
// "0.0.0.0", "127.x.x.x", "localhost", "0:0:0:0:0:0:0:0", "0:0:0:0:0:0:0:1", "::", "::1", ":${port}"
static const std::vector<std::string> blacklist{
// ivp4
"0.0.0.0",
"127.",
"localhost",
// ipv6
"0:0:0:0:0:0:0",
"[0:0:0:0:0:0:0",
":",
"[:"};
for (const auto & prefix : blacklist)
{
if (startsWith(service_addr, prefix))
Expand Down
4 changes: 4 additions & 0 deletions etc/config-template.toml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@
# advertise-status-addr = "tiflash0:20292"
# engine-addr = "tiflash0:3930"

# [cluster]
# Used to specify which cluster the tiflash compute node belongs to.
# cluster_id = "${cluster_id}"

[logger]
# log = "/tmp/tiflash/log/server.log"
# level = "debug"
Expand Down

0 comments on commit c5ea678

Please sign in to comment.