Skip to content

Conversation

pankajagrawal16
Copy link
Contributor

@pankajagrawal16 pankajagrawal16 commented Mar 15, 2021

**Issue #297

Description of changes:

Checklist

Breaking change checklist

RFC issue #:

  • Migration process documented
  • Implement warnings (if it can live side by side)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@pankajagrawal16 pankajagrawal16 requested a review from msailes March 15, 2021 10:23
@pankajagrawal16
Copy link
Contributor Author

@humanzz Have a look


if (hasDefaultDimension()) {
metricsContext.setDefaultDimensions(defaultDimensionSet());
metricsContext.setDefaultDimensions(new DimensionSet());
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is not needed as setDimensions overrides the defaults or is there something am missing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is true.

MetricsUtils.defaultDimensionSet = dimensionSet;

if(dimensionSet.getDimensionKeys().size() > 0) {
MetricsUtils.defaultDimensions = new DimensionSet[]{dimensionSet};
Copy link
Contributor

Choose a reason for hiding this comment

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

I think MetricsUtils.defaultDimensions(dimensionSet) should do the trick here

internalWrapper.when(() -> getenv("_X_AMZN_TRACE_ID")).thenReturn("Root=1-5759e988-bd862e3fe1be46a994272793;Parent=53995c3f42cd8ad8;Sampled=1\"");

MetricsUtils.defaultDimensionSet(new DimensionSet());
MetricsUtils.defaultDimensions(null);
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not quite sure I follow what setting it to null means here? if no dimensions, shouldn't it just be MetricsUtils.defaultDimensions()? or is this because of getter/setter having the same name? If so, then the case for setting no dimensions as a default is a bit complicated UX-wise.

Copy link
Contributor Author

@pankajagrawal16 pankajagrawal16 Mar 15, 2021

Choose a reason for hiding this comment

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

mocked.when(() -> SystemWrapper.getenv("AWS_EMF_ENVIRONMENT")).thenReturn("Lambda");

MetricsUtils.defaultDimensionSet(new DimensionSet());
MetricsUtils.defaultDimensions((DimensionSet) null);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I see other statement not having to use the type casting, is it really needed here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, its not . Just a miss

- name: Build docs website
run: make build-docs-website
run: |
echo "GIT_PYTHON_REFRESH=quiet"
Copy link
Contributor

Choose a reason for hiding this comment

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

what is this for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There was a failing build on docs and some research suggested to use it coz of some git behaviour changes

Copy link
Contributor

@msailes msailes left a comment

Choose a reason for hiding this comment

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

👍

@pankajagrawal16 pankajagrawal16 merged commit b083f76 into master Mar 23, 2021
@pankajagrawal16 pankajagrawal16 deleted the mertics-default-dimensions branch March 23, 2021 16:53
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