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

[WIP] Propose new API for aggregating metrics #54

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

jaredcnance
Copy link
Member

Issue: #46

This PR serves to facilitate further discussion about the shape that the new API discussed in #46 should take.

expect(evt.getDimensions()[0]).toBe([
{ ...DEFAULT_DIMENSIONS, client },
{ ...DEFAULT_DIMENSIONS, pageType },
{ ...DEFAULT_DIMENSIONS, client, pageType },
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the part I'm not certain of. One question I have is what are users most likely to do? Do users prefer the default dimensions are included most of the time or are users overwriting them more often than not.

Copy link

@simonespa simonespa Sep 18, 2020

Choose a reason for hiding this comment

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

This is a tough one 😄

I don't use the default dimensions and having true by default will make me very happy. Nonetheless, this is a personal preference and I guess we should reason in terms of user expectations.

One way to see it could be to keep the same behaviour that putMetric and putDimensions have perhaps? Which means, the default should be false. Also, given the wording of the property is stripDefaultDimensions it entails that by default is disabled and if you want to activate it you must specify true. The opposite would have been keepDefaultDimensions with default set to false, and activation to true.

For people that don't use the default dimensions, I would expect to either set stripDefaultDimensions explicitly to true every time I call putMetricWithDimensions, or call setDimensions() with empty parameter once at the beginning and then regardless of what the value of stripDefaultDimensions is, the default shouldn't be set because they have been removed for the whole session.

Choose a reason for hiding this comment

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

@jaredcnance any thoughts on this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Right now I’m leaning towards the proposal as is. I think it may make sense to offer a global configuration to disable default dimensions entirely. I suspect you either want them or you don’t and you may want that applied uniformly.

@@ -19,6 +19,14 @@ import { IEnvironment } from '../environment/IEnvironment';
import { MetricsContext } from './MetricsContext';
import { Unit } from './Unit';

type Metrics = { [key: string]: number | number[]; };
Copy link

@simonespa simonespa Sep 18, 2020

Choose a reason for hiding this comment

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

This type declaration doesn't allow the definition of the "unit" (e.g. count, milliseconds, etc.).

I was hoping to set something like:

 {
    Name: 'ResponseTime',
    Value: 59,
    Unit: Unit.Milliseconds
}

Also, multiple metrics may apply to the same dimensions, shouldn't we define this as an array of metric items as discussed in #46?

Example:

m.putMetricWithDimensions({
   metrics: [
      {
         Name: 'ResponseTime',
         Value: 322,
         Unit: Unit.Milliseconds
      },
      {
         Name: 'RequestCount',
         Value: 1,
         Unit: Unit.Count
      }
   ],
   namespace: '/example/namespace',
   dimensions: [{ PageType: pageType }],
   stripDefaultDimensions: true
});

Copy link
Member Author

@jaredcnance jaredcnance Sep 19, 2020

Choose a reason for hiding this comment

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

Yeah agree on unit. The idea here was that the key would be used as the metric name which naturally supports multiple distinct metrics. I don’t recall exactly why I proposed it this way, probably because it was less verbose and easier to read but once you add units to the mix it breaks down. Happy to go with this.

@simonespa
Copy link

@jaredcnance any thoughts on the feedbacks?

@jaredcnance
Copy link
Member Author

@jaredcnance any thoughts on the feedbacks?

For full transparency, I’m targeting catching up on this PR in 2-3 weeks.

@simonespa
Copy link

@jaredcnance any thoughts on the feedbacks?

For full transparency, I’m targeting catching up on this PR in 2-3 weeks.

Fantastic, thanks very much @jaredcnance

@simonespa
Copy link

Hi @jaredcnance any update on this PR?

@simonespa
Copy link

Any likelihood for this to proceed?

@simonespa
Copy link

Hi @markkuhn and @Himtanaya just wanted to bring to your attention this old PR to hear your opinion about it and understand a way forward.

For full context, this #46 is the issue that raised this PR.

Thanks for your time.

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.

3 participants