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

fix(stats): Parse Event objects into structured POJOs for Telemetry events #660

Merged
merged 1 commit into from
Sep 25, 2019

Conversation

ttomsu
Copy link
Member

@ttomsu ttomsu commented Sep 24, 2019

Fixes spinnaker/spinnaker#4885

I tried (a lot) to make this broader - to change Event.content from a Map to a proper POJO Content object - but I couldn't get Jackson deserialization to work as expected and not have to change large amounts of both prod and test code (access like event.content.something.somethingElse is pervasive across this codebase).

So instead I opted to fix it locally - grabbing the Map and converting it locally to known fields and setting reasonable defaults for those fields, should they be absent.

One thing to note also is the wrapper TEL object - because there are a lot of duplicate names here, I wrapped the local objects in a wrapper so I wouldn't have to use long, fully qualified names everywhere.

Copy link
Contributor

@ezimanyi ezimanyi left a comment

Choose a reason for hiding this comment

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

Overall looks good, really like the reduction in casts and null checks! Just a few inline comments.

Copy link
Contributor

@ezimanyi ezimanyi left a comment

Choose a reason for hiding this comment

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

Changes look good, two small comments about adding private/final markers.

public static class Stage {
@Builder.Default private String status = "UNKNOWN";
@Builder.Default private String type = "UNKNOWN";
@Builder.Default Context context = Context.builder().build();
Copy link
Contributor

Choose a reason for hiding this comment

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

This (and the next var) can/should be private.

@Builder
@JsonDeserialize(builder = Content.ContentBuilder.class)
public static class Content {
@Builder.Default private Execution execution = Execution.builder().build();
Copy link
Contributor

Choose a reason for hiding this comment

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

Now that these classes are immutable 🎉 🎉 , all the member variables can/should be made final.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants