feat(nodemapper): include peer ip addr in geostr (#39)
This commit is contained in:
@@ -42,14 +42,15 @@ def generate_prometheus_line(ip, status) -> Union[str, None]:
|
|||||||
if geo is None or 'en' not in geo.continent.names:
|
if geo is None or 'en' not in geo.continent.names:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
geostr = 'geoip{{latitude="{lat}", longitude="{lon}", country_code="{country_code}", country_name="{country_name}", status="{status}"}} 1'
|
geostr = 'geoip{{latitude="{lat}", longitude="{lon}", country_code="{country_code}", country_name="{country_name}", status="{status}", ip="{ip}"}} 1'
|
||||||
# print(f"Found GeoIP for {ip}: {geostr}")
|
# print(f"Found GeoIP for {ip}: {geostr}")
|
||||||
return geostr.format(
|
return geostr.format(
|
||||||
lat=geo.location.latitude,
|
lat=geo.location.latitude,
|
||||||
lon=geo.location.longitude,
|
lon=geo.location.longitude,
|
||||||
country_code=geo.continent.code,
|
country_code=geo.continent.code,
|
||||||
country_name=geo.continent.names['en'],
|
country_name=geo.continent.names['en'],
|
||||||
status=status
|
status=status,
|
||||||
|
ip=ip
|
||||||
)
|
)
|
||||||
|
|
||||||
@app.route("/metrics")
|
@app.route("/metrics")
|
||||||
|
|||||||
Reference in New Issue
Block a user