Skip to content
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

Chore: Batch reporting for Graphite #26

Merged
merged 16 commits into from
Feb 3, 2022
Merged

Conversation

ysa23
Copy link
Owner

@ysa23 ysa23 commented Feb 1, 2022

Add batch reporting to graphite reporter.

TL;DR: Extract statsd logic and re-use it in both graphite and datadog, thus gaining batch reporting from the current datadog implementation

Since DD and Graphite both use statsd to report metrics, there were two options here:

  1. Create a single reporter for statsd - replacing both reporters
  2. Extract statsd reporting logic to a different module and reuse it in both reporters.

Option 2 was more viable at this point since there are slight differences in the actual reporting format between DataDog and Graphite. It will also give more flexibility to modify the reporters according to the specific target instead of trying to over generalize and pay the cost. Furthermore, with composition we still gain re-use of the major parts and allowing other reporters to re-use it as well without creating hard dependencies between them.

resolves #21

@ysa23 ysa23 requested a review from igor-dv February 1, 2022 13:37
@ysa23 ysa23 self-assigned this Feb 1, 2022

function validate({ name, value, type }) {
if (value === undefined || value === null) throw new TypeError(`${name} is missing`);
// eslint-disable-next-line valid-typeof
Copy link
Collaborator

Choose a reason for hiding this comment

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

what's wrong with this one ?

Copy link
Owner Author

Choose a reason for hiding this comment

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

this rule requires a comparison to a literal string, Since I'm comparing to a parameter it fails the lint. In this specific case I want to use the parameter (thats the point of this function)

describe('constructor', () => {
it('should create socket with given host and default values', () => {
// eslint-disable-next-line no-new
new StatsdSocket({
Copy link
Collaborator

Choose a reason for hiding this comment

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

so you still want to use constructor for this function ?

Copy link
Owner Author

Choose a reason for hiding this comment

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

In the meantime yes - I don't want to confuse different standards in the repo. We will change it as a single PR all across the repository (its backward compatible so its not a must for version 1)

space.js Show resolved Hide resolved
@ysa23 ysa23 merged commit 417d711 into master Feb 3, 2022
@ysa23 ysa23 deleted the chore/graphite-batching branch February 3, 2022 09:37
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.

Batch for Graphite reporter
2 participants