mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-03 23:15:52 +00:00
Merge pull request #659 from michael-loki/metrics_netid
Send netid to metrictank
This commit is contained in:
commit
4b990ab347
@ -118,6 +118,14 @@ namespace llarp
|
||||
if(singleThreaded)
|
||||
num_nethreads = 0;
|
||||
}
|
||||
else if(!strcmp(key, "netid"))
|
||||
{
|
||||
metricTags["netid"] = val;
|
||||
}
|
||||
else if(!strcmp(key, "nickname"))
|
||||
{
|
||||
metricTags["nickname"] = val;
|
||||
}
|
||||
}
|
||||
if(!strcmp(section, "netdb"))
|
||||
{
|
||||
|
@ -124,6 +124,10 @@ namespace llarp
|
||||
absl::StrAppend(&tagStr, ";", tag.first, "=",
|
||||
absl::visit(overloaded, tag.second));
|
||||
}
|
||||
if(!tags.empty())
|
||||
{
|
||||
absl::StrAppend(&tagStr, ";");
|
||||
}
|
||||
return tagStr;
|
||||
}
|
||||
|
||||
@ -336,26 +340,6 @@ namespace llarp
|
||||
#endif
|
||||
}
|
||||
|
||||
if(tags.count("user") == 0)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
const char *username = getlogin();
|
||||
if(username != nullptr)
|
||||
{
|
||||
tags["user"] = username;
|
||||
}
|
||||
else
|
||||
{
|
||||
tags["user"] = "unknown";
|
||||
}
|
||||
#else
|
||||
char username[UNLEN + 1];
|
||||
DWORD username_len = UNLEN + 1;
|
||||
GetUserName(username, &username_len);
|
||||
tags["user"] = username;
|
||||
#endif
|
||||
}
|
||||
|
||||
return tags;
|
||||
}
|
||||
} // namespace
|
||||
|
Loading…
Reference in New Issue
Block a user