opentracing-csharp icon indicating copy to clipboard operation
opentracing-csharp copied to clipboard

ITextMap questions

Open grounded042 opened this issue 6 years ago • 1 comments

While working on adding propagation support for the W3C standard in the Jaeger client I ran into a question about using ITextMap. This is related directly to supporting HTTP headers via ITextMap. The solution on my end might be to not support ITextMap for this propagation method, but I'd like to stick with ITextMap if I can.

According to RFC7230 section 3.2.2 you can have multiple headers with the same name if:

the entire field value for that header field is defined as a comma-separated list

Using ITextMap like we have before makes this hard as it has a Set method that doesn't really allow for multiple keys even though the underlying implementation might. IF the backing for an ITextMap is something like WebHeaderCollection then I don't think this would be a problem as it looks like C# supports multiple headers with the same name as WebHeaderCollection acts similarly to RFC7230 section 3.2.2 in that you can "add" multiple keys but in reality it just adds the value to the end of a comma separated list with that keys name.

My question is: based on the above would it be better for me to use IFormat< WebHeaderCollection> than IFormat<ITextMap>?

Also, would it be of any interest / in the scope of this project to provide small ITextMap wrappers for things like WebHeaderCollection?

grounded042 avatar Jul 30 '18 17:07 grounded042

One problem is that .NET doesn't use WebHeaderCollection everywhere, ASP.NET Core has its own IHeaderDictionary interface for this. So it seems like we always need an abstraction.

Could you just "hide" that multi-key logic in your ITextMap<WebHeaderCollection> implementation or is there anything you need to have exposed?

cwe1ss avatar Aug 29 '18 06:08 cwe1ss