1- mod errors;
2-
31use super :: { Collector , CollectorErrors } ;
4- use distributed_metrics:: config:: { DnsConfig , LookupTypes } ;
52use crate :: types:: {
63 PerformDnsBodyConfiguration , PerformDnsBodyConfigurationLookupTypesItem ,
74 PerformDnsBodyContinentCode , PerformDnsBodyCountryCode , PerformDnsBodyMobile ,
@@ -10,6 +7,7 @@ use crate::types::{
107} ;
118use crate :: API_CLIENT ;
129use color_eyre:: eyre:: Result ;
10+ use distributed_metrics:: config:: { DnsConfig , LookupTypes } ;
1311use geohash:: Coord ;
1412use metrics:: { counter, gauge, histogram} ;
1513use std:: collections:: hash_map:: DefaultHasher ;
@@ -155,12 +153,7 @@ impl Collector for DnsCollector {
155153 }
156154
157155 fn handle_response ( & self , response : PerformDnsResponse ) -> Result < ( ) , CollectorErrors > {
158- let endpoint = self
159- . config
160- . common_config
161- . name
162- . as_ref ( )
163- . unwrap_or ( & self . config . common_config . endpoint ) ;
156+ let endpoint = & self . config . common_config . endpoint ;
164157
165158 let node_info = response
166159 . node_info
@@ -175,6 +168,9 @@ impl Collector for DnsCollector {
175168 ( "os" , node_info. operating_system . clone ( ) ) ,
176169 ( "endpoint" , endpoint. clone ( ) ) ,
177170 ] ) ;
171+ if let Some ( name) = & self . config . common_config . name {
172+ labels. insert ( "endpoint_name" , name. clone ( ) ) ;
173+ }
178174 if let Ok ( v) = geohash:: encode (
179175 Coord {
180176 x : node_info. lon ,
0 commit comments