@@ -113,26 +113,26 @@ register_one_component(Config) ->
113
113
CheckServer = fun (#{lserver := S }) -> S =:= ComponentAddr end ,
114
114
115
115
% % Expect events for handshake, but not for 'start stream'.
116
- instrument_helper :assert (xmpp_element_out , #{ connection_type => component } , FullCheckF ,
116
+ instrument_helper :assert (xmpp_element_out , ht_labels () , FullCheckF ,
117
117
#{expected_count => 1 , min_timestamp => TS }),
118
- instrument_helper :assert (xmpp_element_in , #{ connection_type => component } , FullCheckF ,
118
+ instrument_helper :assert (xmpp_element_in , ht_labels () , FullCheckF ,
119
119
#{expected_count => 1 , min_timestamp => TS }),
120
120
121
121
instrument_helper :assert (component_auth_failed , #{}, FullCheckF ,
122
122
#{expected_count => 0 , min_timestamp => TS }),
123
- instrument_helper :assert (tcp_data_in , #{ connection_type => component } , CheckBytes ,
123
+ instrument_helper :assert (tcp_data_in , labels () , CheckBytes ,
124
124
#{min_timestamp => TS }),
125
- instrument_helper :assert (tcp_data_out , #{ connection_type => component } , CheckBytes ,
125
+ instrument_helper :assert (tcp_data_out , labels () , CheckBytes ,
126
126
#{min_timestamp => TS }),
127
127
128
128
TS1 = instrument_helper :timestamp (),
129
129
verify_component (Config , Component , ComponentAddr ),
130
130
131
131
% Message from Alice
132
- instrument_helper :assert (xmpp_element_out , #{ connection_type => component } , FullCheckF ,
132
+ instrument_helper :assert (xmpp_element_out , ht_labels () , FullCheckF ,
133
133
#{expected_count => 1 , min_timestamp => TS1 }),
134
134
% Reply to Alice
135
- instrument_helper :assert (xmpp_element_in , #{ connection_type => component } , FullCheckF ,
135
+ instrument_helper :assert (xmpp_element_in , ht_labels () , FullCheckF ,
136
136
#{expected_count => 1 , min_timestamp => TS1 }),
137
137
138
138
component_helper :disconnect_component (Component , ComponentAddr ).
@@ -147,9 +147,9 @@ register_one_component_tls(Config) ->
147
147
end ,
148
148
CheckBytes = fun (#{byte_size := S }) -> S > 0 end ,
149
149
CheckServer = fun (#{lserver := S }) -> S =:= ComponentAddr end ,
150
- instrument_helper :assert (tls_data_in , #{ connection_type => component } , CheckBytes ,
150
+ instrument_helper :assert (tls_data_in , labels () , CheckBytes ,
151
151
#{min_timestamp => TS }),
152
- instrument_helper :assert (tls_data_out , #{ connection_type => component } , CheckBytes ,
152
+ instrument_helper :assert (tls_data_out , labels () , CheckBytes ,
153
153
#{min_timestamp => TS }),
154
154
155
155
TS1 = instrument_helper :timestamp (),
@@ -183,9 +183,9 @@ intercomponent_communication(Config) ->
183
183
FullCheckF = fun (#{byte_size := S , lserver := LServer }) ->
184
184
S > 0 andalso LServer =:= CompAddr1 orelse LServer =:= CompAddr2
185
185
end ,
186
- instrument_helper :assert (xmpp_element_out , #{ connection_type => component } , FullCheckF ,
186
+ instrument_helper :assert (xmpp_element_out , ht_labels () , FullCheckF ,
187
187
#{expected_count => 1 , min_timestamp => TS }),
188
- instrument_helper :assert (xmpp_element_in , #{ connection_type => component } , FullCheckF ,
188
+ instrument_helper :assert (xmpp_element_in , ht_labels () , FullCheckF ,
189
189
#{expected_count => 1 , min_timestamp => TS }),
190
190
191
191
component_helper :disconnect_component (Comp1 , CompAddr1 ),
@@ -237,10 +237,10 @@ register_two_components(Config) ->
237
237
S > 0 andalso LServer =:= CompAddr1 orelse LServer =:= CompAddr2
238
238
end ,
239
239
% Msg to Alice, msg to Bob
240
- instrument_helper :assert (xmpp_element_in , #{ connection_type => component } , FullCheckF ,
240
+ instrument_helper :assert (xmpp_element_in , ht_labels () , FullCheckF ,
241
241
#{expected_count => 2 , min_timestamp => TS }),
242
242
% Msg from Bob, msg from Alice
243
- instrument_helper :assert (xmpp_element_out , #{ connection_type => component } , FullCheckF ,
243
+ instrument_helper :assert (xmpp_element_out , ht_labels () , FullCheckF ,
244
244
#{expected_count => 2 , min_timestamp => TS }),
245
245
246
246
component_helper :disconnect_component (Comp1 , CompAddr1 ),
@@ -587,6 +587,14 @@ restore_domain(Config) ->
587
587
events () ->
588
588
instrument_helper :declared_events (mongoose_component_listener , [#{}]).
589
589
590
+ % % Data metrics have only the connection_type label
591
+ labels () ->
592
+ #{connection_type => component }.
593
+
594
+ % % XMPP element metric labels include host_type, but components don't have host types
595
+ ht_labels () ->
596
+ (labels ())#{host_type => <<>>}.
597
+
590
598
% %--------------------------------------------------------------------
591
599
% % Stanzas
592
600
% %--------------------------------------------------------------------
0 commit comments