1
1
Fork 0
mirror of https://github.com/oxen-io/lokinet synced 2023-12-14 06:53:00 +01:00

Send netid to metrictank

This commit is contained in:
Michael 2019-06-19 23:57:46 +01:00
parent fd20b33064
commit fedf6cb8e0
No known key found for this signature in database
GPG key ID: 2D51757B47E2434C
2 changed files with 12 additions and 20 deletions

View file

@ -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"))
{

View file

@ -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