metricq / metricq-python

🐍 The MetricQ Python interface
https://metricq.github.io/metricq-python/
BSD 3-Clause "New" or "Revised" License
18 stars 7 forks source link

Set user_id for sending metrics #88

Open tilsche opened 3 years ago

tilsche commented 3 years ago

For debugging purposes it would be helpful to be able to determine the sender of a message. This requires setting the user_id in the sender itself (see https://adam.younglogic.com/2016/03/id-sender-rabbitmq/).

We should at least check if this has a significant performance cost given our current message rates.

phijor commented 3 years ago

aio_pika.Message supports setting a user ID; and we could parse the current user from Agent._management_url, correct?

tilsche commented 3 years ago

The amqp user may not be unique, the token would be better. We may eventually check that with respect to security though (as we initially intended tokens to be eventually secret).

kinnarr commented 3 years ago

The user_id must be the amqp user.

data channel error: PRECONDITION_FAILED - user_id property set to 'source-stress-test' but authenticated user was 'admin'

We could instead use appID like in Db::on_history.