Skip to content
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

A "hello world" using aperture-java-core 2.30.0 is not working as expected #36

Open
jgoeres opened this issue Apr 24, 2024 · 1 comment

Comments

@jgoeres
Copy link

jgoeres commented Apr 24, 2024

Hi,

I am trying to do a "Hello world" with Aperture for a simple Java app. At first I tried to run controller and agent locally and it wouldn't work,so I gave up and signed up for the SaaS trial. I provide my endpoint and key to the ApertureSDK.builder() as it can be found in many examples (although older examples use setAgentAddress()), in particular using the sample code that is shown at .app.fluxninja.com/aperture-system/details (the only thing I left out is the setRootCertificateFile() call - I assume that since this is an official SaaS endpoint, it would have non-self signed cert from a trusted CA).

apertureSDK = ApertureSDK.builder()
    .setAddress("agents.us-central1.gcp.app.fluxninja.com:443")
    .setAPIKey("ababababababababbababa")
    .useInsecureGrpc(false)
    .build();

The call is successful. Next I create feature flow parameters:

Map<String,String> labels = new HashMap<>();
labels.put("a", "xyz");
FeatureFlowParameters params =
        FeatureFlowParameters.newBuilder("awesome-feature")
                .setExplicitLabels(labels)
                .setRampMode(false)
                .setFlowTimeout(Duration.ofMillis(1000))
                .build();

I then start a flow (I just put this into a loop with a delay between each try).

Flow flow = apertureSDK.startFlow(params);
if (flow.shouldRun()) {
    log.info("Flow accepted: "+flow.getDecision());
} else {
    log.info("Flow rejected: "+flow.getRejectionHttpStatusCode() );
}

flow.shouldRun() is always true, but the flow.getDecision()[.toString()] always yields "Unreachable", same result as I had when I ran against my local agent+controller.

When I try to end the flow

EndResponse end = flow.end();
if (end.getError()!= null) {
    log.error("Error ending flow: " + end.getError());
}

end.getError() is always not null and end.getError() reads "java.lang.IllegalStateException: Flow without check response"

I then tried

CheckResponse checkResponse = flow.checkResponse();

before the call to flow.end(), but checkResponse is null.

I guess I am missing something very basic here, any hints appreciated.

@jgoeres
Copy link
Author

jgoeres commented Apr 24, 2024

I debugged into this a bit, noticed that the timeout was maybe a bit short, so I increased it (tried up to 30sec). Alas, it always times out inside startFlow where a StatusRuntimeException is thrown:

io.grpc.StatusRuntimeException: DEADLINE_EXCEEDED: deadline exceeded after 2.999659300s. [closed=[], open=[[remote_addr=agents.us-central1.gcp.app.fluxninja.com/34.111.15.254:443]]]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant