-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
No error handling / logging in MetadataConfig #4479
Comments
My issue actually seems to be caused by #4269 . |
@dietervdw-spotify can you please provide sample of code where its failing for you? |
@ajaaym This was happening on version However just swallowing errors is just bad. In my case apparently due to bug #4269 the I guess it depends on Google's logging policy, but at least logging something on DEBUG or a one-line warning would help immensely! |
@dietervdw-spotify do you mean http://metadata.google.internal is not getting resolved in GCE/GKE? error is getting silently ignored to avoid printing noise when not running in GCE/GKE mode and http://metadata.google.internal should always get resolved from GCE/GKE. |
@ajaaym : In a previous version the metadata hostname was specified as I personally don't agree with suppressing errors and I think it's bad practice. There's a lot that can go wrong on a network, and it would be great to have a trace afterwards if something breaks. For example in the Logback Stackdriver appender: if the automatic resolution fails for some reason, logs will get sent to resource 'global' instead of using the right resource type and metadata tags.
So if there's a small network glitch during startup, my application is now running with a completely wrong configuration. I'd rather have startup fail and print a big fat error in that case. Maybe the Stackdriver Logback appender is not using this class in the right way then? |
@dietervdw-spotify This can not be done bcz if logback is used outside GCE/GKE then it becomes reentrant and can not fail startup as well in that case. Closing this for now as upgrading to latest version resolves this. Please feel free to reopen if you think otherwise. |
google-cloud-java/google-cloud-clients/google-cloud-core/src/main/java/com/google/cloud/MetadataConfig.java
Line 83 in 44db769
Calls to metadata service can fail. This causes a NPE a little further.
This is a prime example of crappy error handling.
So now this is failing for some reason for me (while I can perfectly curl the service), and I don't have a clue. Logging the actual error would be much appreciated!
Not making a PR for this since I don't know what your error handling policy is.
I'd just throw this up all the way?
The text was updated successfully, but these errors were encountered: