Closed rvez7 closed 3 months ago
Hi @rvez7, you are right, this can be annoying when using tools like Dynatrace that monitor all thrown exceptions. Unfortunately, there is a tradeoff here between a few aspects like usability, error handling, convenience, modularity etc., which lead to the current approach.
You can avoid these exceptions by directly using new DestinationService()
, which is the relevant implementation for loading destinations from the BTP Destination Service. However, then you'd have to implement a fallback to env vars manually, in case you are using that e.g. for local testing.
Issue Description
The exception
com.sap.cloud.sdk.cloudplatform.connectivity.exception.DestinationNotFoundException
with textCould not find environment variable for name 'destinations'.
is being raise when destination is found via CF service.Important information:
final Try<Destination> tryDestination = DestinationAccessor.tryGetDestination(destinationName);
DestinationNotFoundException
instances shall be allocated.EnvVarDestinationLoader.class
would not loaded at all if the environment variable is missing.EnvVarDestinationLoader.class
from the loading chain was found.Impact / Priority
The outcome is Dynatrace reporting this Exception as top occurrences creating noise to investigate more relevant Exceptions. Slowing down troubleshooting of issues in production by falsely reporting destination errors. Due to long calling stack, generating this exception unnecessarily is expensive memory wise.
Affected development phase: Production
Impact: e.g. Inconvenience
Timeline: Live.
Error Message
Project Details
5.9.0
<groupId>com.sap.cloud.sdk</groupId>
<artifactId>sdk-core</artifactId>
Checklist