pyrollbar
pyrollbar copied to clipboard
Unable to Override the Host name
I'm integrating the RollBar with python for our project that ran on Docker. But I can't override the host name of Server. Rollbar is only reporting default host name. How can I change the host name ?
@EricSei Good quesiton... there's no great way to do this now, but here's an ugly one that should work:
Monkeypatch _build_server_data, e.g.:
import rollbar
orig_build_server_data = rollbar._build_server_data
def new_build_server_data():
data = orig_build_server_data()
data['host'] = 'my hostname value goes here' # call a function to get this, etc.
return data
rollbar._build_server_data = new_build_server_data
Will this work?
Thanks for your answer. I will try your code and keep you updated.
Note that the official rollbar docs recommend setting the host for multiple production environments:
Recommended usage
Use the environment value production for all errors from and deploys to any production environment, even if you have multiple production environments. Use the host property in your error payloads to include the 'full path' of the server where an error occurred, including the name of the region/zone, e.g. us-east-1-web02 for the server web-02 that is hosted in the us-east-1 region.
So this should probably be supported. I can work on a PR for this if you'd like.
@gnpar I agree that an update seems reasonable. Let me see what I can do.