Skip to content

logging: reduce message size #1721

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 7 commits into from
Mar 16, 2017
Merged

logging: reduce message size #1721

merged 7 commits into from
Mar 16, 2017

Conversation

pongad
Copy link
Contributor

@pongad pongad commented Mar 9, 2017

This commit is based on top of #1720 . Once we merge that, I'll rebase to make this PR easier to review.

This PR fixes #1712 , using the method suggested in the issue.

To un-WIP this PR (in rough dependency-order):

  • 1. Think of a better name for "native level"
  • 2. Native level and setLevel works from the same config. When we know what to call the former, give it its own config.
  • 3. The config is too difficult to test, because it's too difficult to pass value in from test.
    Maybe we need a config class? It can be pre-populated with the property values but let users override.
  • 4. Native level should be documented

@garrettjonesgoogle @michaelbausor What do you think of 1 and 3?

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

Coverage Status

Changes Unknown when pulling f9f862c on pongad:logging-label into ** on GoogleCloudPlatform:master**.

@michaelbausor
Copy link
Contributor

Overall this looks good to me. Re your points:

  1. Naming is hard :-( I don't mind native level. Or perhaps request level?
  2. Does this need its own config? It is strictly for performance optimization, so having it match the Level setting makes sense since this is the most granular level of log that will be processed by the logger. At the least we should discourage users from setting it manually unless they really do know that they generate more logs at a higher level.
  3. In Add async/sync setting to logging handler #1716 I added getters for flush level and size, matching the Handler parent class for its settings. So you could add a getter and setter for native level. I think that pulling these into a config class makes sense in general, but we will still be left with the getters and setters on the Handler parent class.

@garrettjonesgoogle
Copy link
Member

I think "native level" is hard to figure out. "request level" is better, but still potentially confusing. How about "default level"?

@michaelbausor
Copy link
Contributor

I think the problem with "default level" is that it is too similar to "level", which is a property of the Handler object. Maybe "default request level", but it still sounds like this setting has semantic meaning, rather than being just a performance optimization.

@garrettjonesgoogle
Copy link
Member

maybe "common request level".

@pongad
Copy link
Contributor Author

pongad commented Mar 10, 2017

Answers inline

Maybe "default request level", but it still sounds like this setting has semantic meaning, rather than being just a performance optimization

Maybe we should just call it optimizeForLevel? I think "common request level" still implies some kind of default.

Does this need its own config?

You made a good point that since it's purely optimization, it might not need one. We could document the .level config that logs at that severity might be sent more efficiently. Maybe open a tracking issue where users can comment if they need this as a config.

So you could add a getter and setter for native level

Doing this raises a question I don't have a good answer to yet.
Changing label changes the partition key used by bundling. Currently bundling creates a new thread for each partition key. So changing label midway feels a bit like a time bomb waiting to go off. I think we should add getter/setter, but only after we make bundling a little more resilient. (googleapis/gax-java#194 should help some.)

I think we should do is:
For this PR

Later

  • Harden bundling
  • Now that we can change the native level midway, it'd be easier to do items 1 and 2
  • This lets advanced users tweak the settings to fit their app just right

@michaelbausor @garrettjonesgoogle WDYT?

@michaelbausor
Copy link
Contributor

SGTM. Even once we can change do 1 and 2, we may not want to give users that knob until we are sure they want it. I think the tracking issue you suggest is a good idea.

Re googleapis/gax-java#194 I am working on that change - will close out that PR and open a new one once it is ready for review.

pongad added a commit that referenced this pull request Mar 12, 2017
This PR turns the hard coded config string into
a map and a rendering function.
This doesn't do anything straightaway,
but will simplify #1721 .
@pongad pongad changed the title WIP: logging: reduce message size logging: reduce message size Mar 13, 2017
@pongad
Copy link
Contributor Author

pongad commented Mar 13, 2017

@garrettjonesgoogle @michaelbausor PTAL

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling c6139d6 on pongad:logging-label into ** on GoogleCloudPlatform:master**.

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.

LGTM - handle my comments as you see fit.

@@ -67,6 +68,12 @@
* {@code java.log}).
* <li>{@code com.google.cloud.logging.LoggingHandler.level} specifies the default level for the
* handler (defaults to {@code Level.INFO}).
* <p> This configuration also sets the "base severity level".
* Logs with the same severity with the base could be more efficiently sent to Stackdriver.
* The base severity defaults to the level of of handler or {@code Level.FINEST}

This comment was marked as spam.

This comment was marked as spam.

@@ -67,6 +68,12 @@
* {@code java.log}).
* <li>{@code com.google.cloud.logging.LoggingHandler.level} specifies the default level for the
* handler (defaults to {@code Level.INFO}).
* <p> This configuration also sets the "base severity level".

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@@ -149,8 +147,15 @@
.put("resourceType", "testResourceType")
.put("synchronicity", "SYNC")
.build();
private static final ImmutableMap<String, String> NATIVE_SEVERITY_MAP =

This comment was marked as spam.

This comment was marked as spam.

@michaelbausor
Copy link
Contributor

LGTM

@pongad
Copy link
Contributor Author

pongad commented Mar 14, 2017

@garrettjonesgoogle I replied to your comment. Wanted to make sure it's good with you before merging. PTAL.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 72316dc on pongad:logging-label into ** on GoogleCloudPlatform:master**.

@garrettjonesgoogle
Copy link
Member

LGTM

@garrettjonesgoogle
Copy link
Member

ship it

@pongad
Copy link
Contributor Author

pongad commented Mar 16, 2017

I'll hold until CI pass just to make sure :)

@pongad pongad merged commit fad0300 into googleapis:master Mar 16, 2017
@pongad pongad deleted the logging-label branch March 16, 2017 00:20
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling d8d2ca0 on pongad:logging-label into ** on GoogleCloudPlatform:master**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 744391d on pongad:logging-label into ** on GoogleCloudPlatform:master**.

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.

Serialized size is too large
5 participants