oxidecomputer / dropshot

expose REST APIs from a Rust program
Apache License 2.0
820 stars 73 forks source link

want server name in headers and errors #1100

Open davepacheco opened 3 weeks ago

davepacheco commented 3 weeks ago

When debugging errors in systems with multiple dropshot servers, it's great to have the request id, but you often want an identifier for the server, too. Some systems have used the x-server-name header for this. How can we support this? Maybe callers can provide an optional server name to use? If we only cared about the headers, then consumers could probably use #1060, but I think we want this in error response bodies, too.

hawkw commented 3 weeks ago

What about the Server header? I believe that Hyper might also add Server: hyper v{version} by default, but we could also add Server: {dropshot server name}

sunshowers commented 1 week ago

Maybe callers can provide an optional server name to use

Hmm -- in general, we have this while generating OpenAPI documents (e.g. "Oxide Region API"), but the server is not aware of this.

For API traits we could use the name of the trait.

davepacheco commented 1 week ago

The idea here is to figure out which instance of, say, Nexus, generated the request. The value has to come at runtime. I was assuming we'd add a new argument.

jclulow commented 1 week ago

I don't think there's a standard header that provides that information. Server is supposed to identify static information about the software or product, analogous to User-Agent.

It seems like X-Backend-Server might be somewhat common for including, say, the DNS name of the backend instance in a load balancer pool.