Skip to content

ReplaceStatsd class by several smaller components. #123

Merged
ogaca-dd merged 13 commits intomasterfrom
olivierg/SplitsStatsd
Jul 29, 2020
Merged

ReplaceStatsd class by several smaller components. #123
ogaca-dd merged 13 commits intomasterfrom
olivierg/SplitsStatsd

Conversation

@ogaca-dd
Copy link
Copy Markdown
Contributor

This PR replaces Statsd class by several smaller components to make code easier to maintain.
Statsd is now unused but it is kept for backward compatibility reasons.

For reviewer:

  • Reviewing commit by commit is recommended.
  • The class MetricSerializer contains a lot of code from the class Statsd that could be improved, but MetricSerializer is going to be refactored in a later PR.

Copy link
Copy Markdown
Member

@truthbk truthbk left a comment

Choose a reason for hiding this comment

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

Looks great, just a couple of comments! Some of my comments may be rendere moot by the work you had on the other PRs that were stacked on top.

Comment thread src/StatsdClient/MetricType.cs Outdated

public class Event
{
private const int MaxSize = 8 * 1024;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we make MaxSize configurable? I think I mentioned elsewhere, this 8Kb limit might not work well with remote UDP as it will likely require fragmentation which might be a bad idea.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is a very good comment.
MaxSize could be StatsdMaxUDPPacketSize from https://github.com/DataDog/dogstatsd-csharp-client/blob/master/src/StatsdClient/StatsdConfig.cs#L83, but if the message size cannot be reduced, the code throws an exception which is not caught (I can addtry / catch).

I am wondering if the logic of trying reducing the message size is really useful.
Indeed https://github.com/DataDog/dogstatsd-csharp-client/blob/master/src/StatsdClient/Bufferize/StatsBufferize.cs#L67-L70 already handle too long message. Adding an exception handler as in Java client will let the user know when something is wrong.

I think this change should be done in a separate PR, but I would love to hear your opinion about this topic.

Comment thread src/StatsdClient/MetricSerializer.cs
@ogaca-dd ogaca-dd merged commit 8ecb50c into master Jul 29, 2020
@ogaca-dd ogaca-dd deleted the olivierg/SplitsStatsd branch July 29, 2020 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants