-
Notifications
You must be signed in to change notification settings - Fork 654
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
Conversation
There was a problem hiding this 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.
echo-telemetry/src/main/java/com/netflix/spinnaker/echo/config/TelemetryConfig.java
Show resolved
Hide resolved
echo-telemetry/src/main/java/com/netflix/spinnaker/echo/telemetry/TelemetryEventListener.java
Outdated
Show resolved
Hide resolved
echo-telemetry/src/main/java/com/netflix/spinnaker/echo/telemetry/TelemetryEventListener.java
Outdated
Show resolved
Hide resolved
echo-telemetry/src/main/java/com/netflix/spinnaker/echo/telemetry/TelemetryEventListener.java
Show resolved
Hide resolved
echo-telemetry/src/main/java/com/netflix/spinnaker/echo/telemetry/TelemetryEventListener.java
Outdated
Show resolved
Hide resolved
echo-telemetry/src/main/java/com/netflix/spinnaker/echo/telemetry/TelemetryEventListener.java
Outdated
Show resolved
Hide resolved
echo-telemetry/src/main/java/com/netflix/spinnaker/echo/telemetry/TelemetryEventListener.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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(); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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
.
Fixes spinnaker/spinnaker#4885
I tried (a lot) to make this broader - to change Event.content from a
Map
to a proper POJOContent
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 likeevent.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.