I custom a span and I see can use 'span.injectTraceHeaders((name, value) -> request.addHeader(name, value));' to implement RPC framework,but I don't know the name I can set? Another,the operate '->' must need java 8？beause when I direct use it，it compile failre,This is my code:
span.injectTraceHeaders((name, value) -> RpcContext.getContext().setAttachment(name, value));
To add on top of the last comment: you don't need to know the name of the header. The agent only expects you provide it with the ability to add the context- an implementation for the HeaderInjector interface that gets a name and a value and knows what to do with them in your specific framework. The agent will invoke this method with the right header name and header value. Same for the HeaderExtractor.
Please take the time to read through @stephenb's examples.
For pre-8 Java, you can use an explicit implementation of the header in a "regular" class implementing it, or anonymous, as such: