Skip to content

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

Merged
merged 11 commits into from
Feb 9, 2017

Conversation

gregw
Copy link

@gregw gregw commented Feb 3, 2017

The google stackdriver logging console requires that the zone label be set in the monitored resource before it can aggregate logs by trace ID.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Feb 3, 2017
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.04%) to 83.31% when pulling b7c062f on jetty-project:enhance-zone into 2fbb281 on GoogleCloudPlatform:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.03%) to 83.315% when pulling b7c062f on jetty-project:enhance-zone into 2fbb281 on GoogleCloudPlatform:master.

@meltsufin
Copy link
Member

@garrettjonesgoogle Can you please take a look?

@garrettjonesgoogle
Copy link
Member

There is a release going out on Tuesday that I don't want to destabilize; I'll take a look after that goes out.

Copy link
Member

@garrettjonesgoogle garrettjonesgoogle left a 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.

This comment was marked as spam.

gregw added 4 commits February 9, 2017 10:44
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.
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 881e75f on jetty-project:enhance-zone into ** on GoogleCloudPlatform:master**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling b661c62 on jetty-project:enhance-zone into ** on GoogleCloudPlatform:master**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 744ca64 on jetty-project:enhance-zone into ** on GoogleCloudPlatform:master**.

@meltsufin
Copy link
Member

@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.

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.

@garrettjonesgoogle
Copy link
Member

This should make it into the next release. I'm intending on doing a release tomorrow (Friday).

@gregw
Copy link
Author

gregw commented Feb 9, 2017

@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.

@garrettjonesgoogle
Copy link
Member

LGTM - once you figure out the tests I will merge it.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.07%) to 83.382% when pulling b6100dd on jetty-project:enhance-zone into fa0720c on GoogleCloudPlatform:master.

@garrettjonesgoogle garrettjonesgoogle merged commit c04d163 into googleapis:master Feb 9, 2017
@gregw gregw deleted the enhance-zone branch February 12, 2017 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants