Skip to content

Commit

Permalink
Report XMPP message latency in milliseconds
Browse files Browse the repository at this point in the history
  • Loading branch information
fenek committed Nov 17, 2014
1 parent 264849b commit 0c37ad4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions docs/conf-sessions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -272,15 +272,16 @@ It is possible to stamp chat message by setting ``stamped`` attribute of
``<jabber>`` element inside request to ``true``. The stamp will include current
timestamp and ID of the sender node. If the recipient will recognise the node ID,
it will compare the timestamp inside message with the current one. The difference
will be reported as ``xmpp_msg_latency`` metric. The aim of node ID comparison
is to avoid slight inconsistencies of timestamps on different Tsung nodes.
will be reported as ``xmpp_msg_latency`` metric (in milliseconds).
The aim of node ID comparison is to avoid slight inconsistencies
of timestamps on different Tsung nodes.

Only a fraction of requests will hit the same node they originated from,
but with request rate high enough this fraction should be sufficient.

``stamped`` is allowed only with ``size`` attribute. ``data`` will cause
``stamped`` to be ignored. There is a minimal length of the stamp,
roughly 10-20 bytes. When ``size`` is greater than stamp length, random
roughly 30 bytes. When ``size`` is greater than stamp length, random
padding will be added to the stamp. If the stamp length is higher than
``size``, then only stamp will be used as messagecontent, effectively
exceeding specified length.
Expand Down
2 changes: 1 addition & 1 deletion src/tsung/ts_jabber.erl
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ message_bidi(RcvdXml, State) ->
Secs = list_to_integer(SecsS),
Micro = list_to_integer(MicroS),
Latency = timer:now_diff(erlang:now(), {Mega, Secs, Micro}),
ts_mon:add({ sample, xmpp_msg_latency, Latency });
ts_mon:add({ sample, xmpp_msg_latency, Latency / 1000});
_ ->
ignore
end,
Expand Down

0 comments on commit 0c37ad4

Please sign in to comment.