Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Fix up pusher logging a bit #4716

Merged
merged 5 commits into from
Feb 22, 2019
Merged

Fix up pusher logging a bit #4716

merged 5 commits into from
Feb 22, 2019

Conversation

erikjohnston
Copy link
Member

No description provided.

@erikjohnston erikjohnston requested a review from a team February 22, 2019 14:51
@richvdh
Copy link
Member

richvdh commented Feb 22, 2019

(attempts to) fix #4710 I guess

@@ -97,6 +97,11 @@ def __init__(self, hs, pusherdict):
pusherdict['pushkey'],
)

if self.data is None:
raise PusherConfigException(
Copy link
Member

Choose a reason for hiding this comment

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

will we actually log any less for a PusherConfigException than for a TypeError or whatever it was?

Copy link
Member Author

Choose a reason for hiding this comment

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

Woops, I missed a code path where it wasn't handled.

@@ -56,7 +56,7 @@ def create_pusher(self, pusherdict):
f = self.pusher_types.get(kind, None)
if not f:
return None
logger.info("creating %s pusher for %r", kind, pusherdict)
logger.debug("creating %s pusher for %r", kind, pusherdict)
Copy link
Member

Choose a reason for hiding this comment

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

I'm not entirely convinced by this. it's the only thing that gets logged during minutes of cpu-spinning, and it's not massively high-volume.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's logging several times a millisecond with a reasonably a non-trivial dict, which feels a bit OTT. There are ~170K pushers, with a log length of ~600 characters, means about 102MB of logs

I could make it so it logs in batches the progress?

Copy link
Member

Choose a reason for hiding this comment

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

fair enough. let's see how it looks.

@codecov-io
Copy link

codecov-io commented Feb 22, 2019

Codecov Report

Merging #4716 into develop will decrease coverage by 0.11%.
The diff coverage is 33.33%.

@@             Coverage Diff             @@
##           develop    #4716      +/-   ##
===========================================
- Coverage    75.14%   75.03%   -0.12%     
===========================================
  Files          340      340              
  Lines        34815    34822       +7     
  Branches      5702     5704       +2     
===========================================
- Hits         26162    26127      -35     
- Misses        7044     7074      +30     
- Partials      1609     1621      +12

Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

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

lgtmish

pusherdict.get('user_name'),
pusherdict.get('app_id'),
pusherdict.get('pushkey'),
e,
Copy link
Member

Choose a reason for hiding this comment

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

I think you generally need the type of the exception as well as the stringification

(mostly because KeyErrors are otherwise extremely confusing:

>>> try:
...     {}['a']
... except Exception as e:
...     print(e)
...
'a'

)

Copy link
Member Author

Choose a reason for hiding this comment

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

Err, we know the type since we're only catching the one PusherConfigException exception?

@@ -56,7 +56,7 @@ def create_pusher(self, pusherdict):
f = self.pusher_types.get(kind, None)
if not f:
return None
logger.info("creating %s pusher for %r", kind, pusherdict)
logger.debug("creating %s pusher for %r", kind, pusherdict)
Copy link
Member

Choose a reason for hiding this comment

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

fair enough. let's see how it looks.

@erikjohnston erikjohnston merged commit d14e94b into develop Feb 22, 2019
@erikjohnston erikjohnston deleted the erikj/pusher_logging branch March 5, 2019 13:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants