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

HWKMETRICS-728: fetch the namespace id directly if a miss in the namespace listener #875

Merged
merged 1 commit into from Aug 22, 2017

Conversation

mwringe
Copy link
Contributor

@mwringe mwringe commented Aug 18, 2017

@mwringe
Copy link
Contributor Author

mwringe commented Aug 18, 2017

@jsanda @stefannegrea can one of you please take a look?

@@ -70,7 +71,61 @@ public void stop() {
* @return The id of the namespace or null if the namespace does not exist
*/
public String getNamespaceId(String namespaceName) {
return namespaces.get(namespaceName);
String namespaceId = namespaces.get(namespaceName);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

connection.setRequestProperty("Accept", "application/json");
connection.setRequestProperty("Authorization", "Bearer " + token);

connection.connect();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No connection.disconnect() ? Also, inputStream.close() at line 117 is not necessarily called, leaving handler open.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

inputStream.close();

} else {
log.infof("Error getting project metadata. Response code %s", responseCode);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not interested in the error itself with .getErrorStream() ? Or is there any possible payload?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally we are not all that interested with the payload. The messages we are more going to be getting here are going to be related to permissions. For now I think just the error code/message is what we need.

} else {
log.info("Could not determine a namespace id for namespace " + namespaceID + ". Cannot process request. Returning an INTERNAL_SERVER_ERROR.");
log.info("Could not determine a namespace id for namespace. Cannot process request. Returning an INTERNAL_SERVER_ERROR.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

log.info but returning code 500?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the original PR I believe I was told to only use log.info here.
The response to the user has the real error message for this.

Would you prefer this to be another error type? or to have the log be at the warn/error level?

@mwringe
Copy link
Contributor Author

mwringe commented Aug 21, 2017

PR updated with requested changes. Will squash when finally ready.

jsonParser.close();
}
if (inputStream != null) {
inputStream.close();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could still be left open, if jsonParser throws an Exception

@mwringe
Copy link
Contributor Author

mwringe commented Aug 21, 2017

Updated and squashed

@stefannegrea
Copy link
Contributor

Thank you @mwringe!

@stefannegrea stefannegrea merged commit c0244a3 into hawkular:release/0.27.0 Aug 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants