@@ -113,30 +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_size_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_size_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_size_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_size_in , #{connection_type => component }, FullCheckF ,
136
- #{expected_count => 1 , min_timestamp => TS1 }),
137
- instrument_helper :assert (component_element_in , #{}, CheckServer ,
138
- #{expected_count => 1 , min_timestamp => TS1 }),
139
- instrument_helper :assert (component_element_out , #{}, CheckServer ,
135
+ instrument_helper :assert (xmpp_element_in , ht_labels (), FullCheckF ,
140
136
#{expected_count => 1 , min_timestamp => TS1 }),
141
137
142
138
component_helper :disconnect_component (Component , ComponentAddr ).
@@ -151,9 +147,9 @@ register_one_component_tls(Config) ->
151
147
end ,
152
148
CheckBytes = fun (#{byte_size := S }) -> S > 0 end ,
153
149
CheckServer = fun (#{lserver := S }) -> S =:= ComponentAddr end ,
154
- instrument_helper :assert (tls_data_in , #{ connection_type => component } , CheckBytes ,
150
+ instrument_helper :assert (tls_data_in , labels () , CheckBytes ,
155
151
#{min_timestamp => TS }),
156
- instrument_helper :assert (tls_data_out , #{ connection_type => component } , CheckBytes ,
152
+ instrument_helper :assert (tls_data_out , labels () , CheckBytes ,
157
153
#{min_timestamp => TS }),
158
154
159
155
TS1 = instrument_helper :timestamp (),
@@ -187,9 +183,9 @@ intercomponent_communication(Config) ->
187
183
FullCheckF = fun (#{byte_size := S , lserver := LServer }) ->
188
184
S > 0 andalso LServer =:= CompAddr1 orelse LServer =:= CompAddr2
189
185
end ,
190
- instrument_helper :assert (xmpp_element_size_out , #{ connection_type => component } , FullCheckF ,
186
+ instrument_helper :assert (xmpp_element_out , ht_labels () , FullCheckF ,
191
187
#{expected_count => 1 , min_timestamp => TS }),
192
- instrument_helper :assert (xmpp_element_size_in , #{ connection_type => component } , FullCheckF ,
188
+ instrument_helper :assert (xmpp_element_in , ht_labels () , FullCheckF ,
193
189
#{expected_count => 1 , min_timestamp => TS }),
194
190
195
191
component_helper :disconnect_component (Comp1 , CompAddr1 ),
@@ -241,10 +237,10 @@ register_two_components(Config) ->
241
237
S > 0 andalso LServer =:= CompAddr1 orelse LServer =:= CompAddr2
242
238
end ,
243
239
% Msg to Alice, msg to Bob
244
- instrument_helper :assert (xmpp_element_size_in , #{ connection_type => component } , FullCheckF ,
240
+ instrument_helper :assert (xmpp_element_in , ht_labels () , FullCheckF ,
245
241
#{expected_count => 2 , min_timestamp => TS }),
246
242
% Msg from Bob, msg from Alice
247
- instrument_helper :assert (xmpp_element_size_out , #{ connection_type => component } , FullCheckF ,
243
+ instrument_helper :assert (xmpp_element_out , ht_labels () , FullCheckF ,
248
244
#{expected_count => 2 , min_timestamp => TS }),
249
245
250
246
component_helper :disconnect_component (Comp1 , CompAddr1 ),
@@ -591,6 +587,14 @@ restore_domain(Config) ->
591
587
events () ->
592
588
instrument_helper :declared_events (mongoose_component_listener , [#{}]).
593
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
+
594
598
% %--------------------------------------------------------------------
595
599
% % Stanzas
596
600
% %--------------------------------------------------------------------
0 commit comments