Skip to content

Provide debug options in Java SDK Client to monitor the outgoing external calls for OCI resources #644

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ankedia opened this issue Dec 10, 2024 · 0 comments
Labels
SDK Issue pertains to the SDK itself and not specific to any service

Comments

@ankedia
Copy link
Member

ankedia commented Dec 10, 2024

We need the ability to monitor the outgoing external calls for OCI resources such as OCI streams, Object storage, and secrets etc. I'm creating this issue as an enhancement request to add debug messages containing HTTP URL and method for the external calls. These debug messages can be enabled by changing the log level.

As an experiment, I modified the com.oracle.bmc.http.internal.ClientCall class in "bmc-common" module, and added a debug/print message in the callSync method to print the URI and method of the httpRequest. This was helpful to see the external calls. Following is the file and the "callSync"call method that I modified. Thanks.

File modified - https://bitbucket.oci.oraclecorp.com/projects/SDK/repos/java-sdk/browse/bmc-common/src/main/java/com/oracle/bmc/http/internal/ClientCall.java

Modified "callSync" method -

public RESP callSync() {

    waiterScheduler = WaiterScheduler.SYNC;

    SyncFutureWaiter futureWaiter = new SyncFutureWaiter();

    offloadExecutor = futureWaiter;

    httpRequest = httpRequest.offloadExecutor(offloadExecutor);


    logger.debug("DEBUG>> httpRequest is " + httpRequest);



    try {

        if (httpRequest != null && httpRequest.uri() != null)

{ logger.debug("DEBUG>> URL is " + httpRequest.uri().toString()); }

        if (httpRequest != null && httpRequest.method() != null)

{ logger.debug("DEBUG>> Request method is " + httpRequest.method().toString()); }
return futureWaiter.listenForResult(callAsync0(null));

    } catch (BmcException e)

{ throw e; }
catch (Throwable e)

{ throw BmcException.createClientSide("Unknown error", e, null, buildServiceDetails()); }
}

}

@richachugh11 richachugh11 added the SDK Issue pertains to the SDK itself and not specific to any service label Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SDK Issue pertains to the SDK itself and not specific to any service
Projects
None yet
Development

No branches or pull requests

2 participants