Open
Description
Is your feature request related to a problem? Please describe.
We forked this code repository and made several significant modifications to support our clients. These changes mainly involved adding some attributes to certain spans and modifying the names and dimensions of metrics. Consequently, merging the latest open-source code will result in many conflicts. We hope to receive support in providing some extension mechanisms that allow us to expand functionality without modifying this code repository.
Describe the solution you'd like
We expecte the following fields in io.opentelemetry.instrumentation.api.instrumenter.Instrumenter
can be customized
- spanNameExtractor
- attributesExtractors
- contextCustomizers
- operationListeners
pseudo code
public final class TomcatInstrumenterFactory {
private TomcatInstrumenterFactory() {}
public static <REQUEST, RESPONSE> Instrumenter<Request, Response> create(
String instrumentationName, ServletAccessor<REQUEST, RESPONSE> accessor,
HttpServerAttributesGetter<Request, Response> httpAttributesGetter) {
TomcatNetAttributesGetter netAttributesGetter = new TomcatNetAttributesGetter()
return Instrumenter.<Request, Response>builder(
GlobalOpenTelemetry.get(),
instrumentationName,
HttpSpanNameExtractor.create(httpAttributesGetter))
.addAttributesExtractor(
HttpServerAttributesExtractor.builder(httpAttributesGetter, netAttributesGetter)
.setCapturedRequestHeaders(CommonConfig.get().getServerRequestHeaders())
.setCapturedResponseHeaders(CommonConfig.get().getServerResponseHeaders())
.build())
.addAttributesExtractor(
loadCustomAttributesExtractor(instrumentationName)
)
.addContextCustomizer(
loadContextCustomizer(instrumentationName)
)
.addOperationMetrics(HttpServerMetrics.get())
.addOperationMetrics(loadCustomOperationMetrics())
.buildServerInstrumenter(TomcatRequestGetter.INSTANCE)
}
public AttributesExtractor loadCustomAttributesExtractor(String instrumentationName) {
throw new UnsupportedException();
}
public ContextCustomizer loadContextCustomizer(String instrumentationName) {
throw new UnsupportedException();
}
public OperationMetrics loadCustomOperationMetrics(String instrumentationName)) {
throw new UnsupportedException();
}
}
Describe alternatives you've considered
No response
Additional context
No response