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

Preserve collection order of dimensions, dimension fields and metrics #25

Merged
merged 2 commits into from
Sep 6, 2016

Conversation

archolewa
Copy link
Contributor

No description provided.

@michael-mclawhorn
Copy link
Contributor

👍
I think I can live without a CHANGELOG entry on this one.

@cdeszaq
Copy link
Collaborator

cdeszaq commented Aug 31, 2016

Changelog needed, since this changes some method signatures.

@@ -46,7 +47,7 @@ public static Response makeJobMetadataResponse(String jobMetadata) {
* @return A PreResponse containing the error information that should be sent to the user
*/
public static PreResponse buildErrorPreResponse(Throwable throwable) {
ResponseContext responseContext = new ResponseContext(Collections.emptyMap());
ResponseContext responseContext = new ResponseContext(new LinkedHashMap<>());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Rather than make a new object each time, it would be good if we could only create 1 object and just re-use that over and over (like what Collections.emptyMap() did).

Copy link
Contributor Author

@archolewa archolewa Sep 1, 2016

Choose a reason for hiding this comment

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

That sounds dangerous to me, unless we take steps to make sure the empty map is immutable. The reason Collections.emptyMap is safe is because it's immutable, so you don't have to worry about someone accidentally modifying the map and spreading the changes all over the system.

Frankly, the overhead of building an empty collection is so tiny that I doubt creating our own custom empty, immutable LinkedHashMapis worth the effort.

@venisa
Copy link

venisa commented Sep 6, 2016

👍

@archolewa archolewa merged commit 873553f into master Sep 6, 2016
@archolewa archolewa deleted the TracingOrderChangeBug branch September 6, 2016 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants