pyrollbar icon indicating copy to clipboard operation
pyrollbar copied to clipboard

Unable to Override the Host name

Open EricSei opened this issue 6 years ago • 4 comments

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 avatar Jul 11 '19 13:07 EricSei

@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?

brianr avatar Jul 25 '19 00:07 brianr

Thanks for your answer. I will try your code and keep you updated.

EricSei avatar Jul 25 '19 13:07 EricSei

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 avatar Dec 07 '22 01:12 gnpar

@gnpar I agree that an update seems reasonable. Let me see what I can do.

danielmorell avatar Dec 09 '22 18:12 danielmorell