Add extension points that allows to listen to incoming requests
Basic information about the incoming request is provided when this extension point is invoked. This includes: * the request type (whether this is a REST request, an SSH request or a git upload or receive) * the calling user * the trace context * the name of the project for which the request is being done (only available if the request is tied to a project or change) TraceContext gets 2 new methods so that implementations of the extension point can check if tracing is enabled and if yes, which trace ID is set. Possible use cases for the extension point are: * setting logging tags for a request (implemented in follow-up change) * implement advanced tracing (e.g. allow to enable tracing for a certain user or project by configuration) If implementations of the extension point have the need to open resources that must be closed when the request is done, we should consider to allow adding close listeners to the TraceContext, that are guranteed to be invoked when the TraceContext gets closed. Signed-off-by: Edwin Kempin <ekempin@google.com> Change-Id: Ic328c4d6a66ab7dbfb848c41dd4ada9b1dedb847
This commit is contained in:
@@ -79,6 +79,7 @@ import com.google.gerrit.server.CmdLineParserModule;
|
||||
import com.google.gerrit.server.CreateGroupPermissionSyncer;
|
||||
import com.google.gerrit.server.DynamicOptions;
|
||||
import com.google.gerrit.server.IdentifiedUser;
|
||||
import com.google.gerrit.server.RequestListener;
|
||||
import com.google.gerrit.server.account.AccountCacheImpl;
|
||||
import com.google.gerrit.server.account.AccountControl;
|
||||
import com.google.gerrit.server.account.AccountDeactivator;
|
||||
@@ -384,6 +385,7 @@ public class GerritGlobalModule extends FactoryModule {
|
||||
DynamicSet.setOf(binder(), SubmitRule.class);
|
||||
DynamicSet.setOf(binder(), QuotaEnforcer.class);
|
||||
DynamicSet.setOf(binder(), PerformanceLogger.class);
|
||||
DynamicSet.setOf(binder(), RequestListener.class);
|
||||
|
||||
DynamicMap.mapOf(binder(), MailFilter.class);
|
||||
bind(MailFilter.class).annotatedWith(Exports.named("ListMailFilter")).to(ListMailFilter.class);
|
||||
|
||||
Reference in New Issue
Block a user