public static ServiceDownstreamRequestEvent enter()

in disco-java-agent-aws/src/main/java/software/amazon/disco/agent/awsv1/AWSClientInvokeInterceptor.java [50:81]


    public static ServiceDownstreamRequestEvent enter(@Advice.Argument(0) final Object request,
                                                      @Advice.Origin final String origin)
    {
        if (LogManager.isDebugEnabled()) {
            log.debug("DiSCo(AWSv1) method interception of " + origin);
        }

        String service = null;
        String operation = null;

        //Retrieve name of AWS service we are calling
        try {
            service = (String) request.getClass().getMethod("getServiceName").invoke(request);
        } catch (Exception e) {
            log.warn("Disco(AWSv1) failed to retrieve service name from AWS client request", e);
        }


        //Original request contains both the operation name and the request object
        try {
            Object originalRequest = request.getClass().getMethod("getOriginalRequest").invoke(request);
            operation = originalRequest.getClass().getSimpleName().replace("Request", "");
        } catch (Exception e) {
            log.warn("Disco(AWSv1) failed to retrieve operation name from AWS client request", e);
        }

        ServiceDownstreamRequestEvent requestEvent = new AwsV1ServiceDownstreamRequestEventImpl(AWS_V1_ORIGIN, service, operation);
        requestEvent.withRequest(request);
        EventBus.publish(requestEvent);

        return requestEvent;
    }