getsentry / raven-go

Sentry client in Go
https://sentry.io
BSD 3-Clause "New" or "Revised" License
561 stars 147 forks source link

No way to set Packet.ServerName #189

Open kirugan opened 6 years ago

kirugan commented 6 years ago

Problem:

Currently there is no way to set ServerName property in Packet struct. Here is the only code that access this property:

if packet.ServerName == "" {
    packet.ServerName = hostname
}

where hostname value is a result of call to os.Hostname() Link to code ^.

Why do we need one:

I need to distinguish hostname from server_name, cause in environments like kubernetes it is useful to have pod name as a hostname and real server name as a server_name. You can specify hostname by using host tag, unfortunately server_name tag doesn't work the same way.

Proposed solution

Simplest solution is to use server_name tag for this field, no bc changes and everyone is happy.

P.S. If this ^ is ok, i will make a PR with such changes.

kamilogorek commented 5 years ago

SetServerName config method would be nice as well.