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
Add installation_source field to the host telemetry #728
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.
I had imaged here he would use something like the repo url to identify the installation source, but I guess that what you propose here is more flexible. Looks good to me @arbulu89, thanks!
@@ -16,5 +25,6 @@ defmodule Trento.Integration.Discovery.HostDiscoveryPayload do | |||
field :total_memory_mb, :integer | |||
field :socket_count, :integer | |||
field :os_version, :string | |||
field :installation_source, :string, default: "Unknown" |
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.
Could we limit the possible values here and validate them against a set of values aka :unknown, :community, :premium?
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.
Done in: 6f6c1c7
@@ -18,6 +18,7 @@ defmodule Trento.HostTelemetryReadModel do | |||
field :socket_count, :integer | |||
field :total_memory_mb, :integer | |||
field :sles_version, :string | |||
field :installation_source, :string |
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.
Ecto.Enum here with fixed values as well
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.
Done: 6f6c1c7
6f6c1c7
to
07d159c
Compare
Moving to |
a0e0702
to
99c7260
Compare
Upcasting applied. Waiting for #751 to be rebased |
99c7260
to
ea9ddb9
Compare
Hey @fabriziosestito , |
lib/trento/application/integration/discovery/payloads/host_discovery_payload.ex
Outdated
Show resolved
Hide resolved
lib/trento/application/integration/discovery/payloads/host_discovery_payload.ex
Outdated
Show resolved
Hide resolved
%{} | ||
|> HostDetailsUpdated.upcast(%{}) | ||
|> HostDetailsUpdated.new!() | ||
end |
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.
I would split these tests into two different files with the event module name to reflect the module structure (e.g. domain/hosts/events/host_details_updated.exs`
Also, the test is a bit unclear, we need to upcast a map that is at version 1, not an empty map because this is what we get from the event store when dealing with old events.
Something like
%{
"version" => 1,
# insert all the host details updated events fields that are present in version 1 possibly with a faker
....
}
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.
or event without the version field, since it should default it at version 1
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.
Some minor stuff then good to go
49bebb8
to
3374eac
Compare
Thanks @fabriziosestito , |
@arbulu89 go! |
Add the installation_source field to the host telemetry model.
This field is not required in the agent side, we so it is still backwards compatible with older agent version. In this cases, it is populated with
Unknown
string.Depends on: trento-project/agent#64