-
Notifications
You must be signed in to change notification settings - Fork 1.1k
add zone to GAE Flex logging enhancer #1589
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
add zone to GAE Flex logging enhancer #1589
Conversation
@garrettjonesgoogle Can you please take a look? |
There is a release going out on Tuesday that I don't want to destabilize; I'll take a look after that goes out. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, someone pointed out that LoggingHandler.Enhancer is package-private. Could you make it public in this PR?
try { | ||
HttpURLConnection metadata = (HttpURLConnection) new URL( | ||
"http://metadata.google.internal/computeMetadata/v1/instance/zone").openConnection(); | ||
metadata.setRequestProperty("Metadata-Flavor", "Google"); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Handler initialization may now call user supplied code in enhancers during initialization and logging. This commit catches any exceptions thrown and uses the existing error reporting mechanism to log the exception the stderr. The GaeFlexEnhancer now separately logs any exception when obtaining the zone, but does not throw it as having the zone is only optional and should be non fatal to the logger.
Changes Unknown when pulling 881e75f on jetty-project:enhance-zone into ** on GoogleCloudPlatform:master**. |
Changes Unknown when pulling b661c62 on jetty-project:enhance-zone into ** on GoogleCloudPlatform:master**. |
Changes Unknown when pulling 744ca64 on jetty-project:enhance-zone into ** on GoogleCloudPlatform:master**. |
@garrettjonesgoogle Would this make into the next release, and when is it scheduled to go out? |
MonitoredResource resource = monitoredResource != null ? monitoredResource : getDefaultResource(resourceType); | ||
writeOptions = new WriteOption[]{WriteOption.logName(logName), WriteOption.resource(resource)}; | ||
} | ||
catch (Exception ex) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
try { | ||
HttpURLConnection metadata = (HttpURLConnection) new URL( | ||
"http://metadata.google.internal/computeMetadata/v1/instance/zone").openConnection(); | ||
metadata.setRequestProperty("Metadata-Flavor", "Google"); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This should make it into the next release. I'm intending on doing a release tomorrow (Friday). |
@garrettjonesgoogle I have fixed those issues. Note the unit tests are not passing, but neither are they in master (for me). I'll try to investigate later today. |
LGTM - once you figure out the tests I will merge it. |
The google stackdriver logging console requires that the zone label be set in the monitored resource before it can aggregate logs by trace ID.