METRON-1599 Allow user to define global property 'source.type.field' in Ambari #1047
Conversation
<name>source_type_field</name> | ||
<display-name>Source Type Field</display-name> | ||
<description>Name of the message field that contains the source type.</description> | ||
<value>source.type</value> |
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.
Shouldn't the default be "source:type"?
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.
Currently the default in the UI, if unspecified, is source:type
, so I'd vote keeping it as that.
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.
Ah, I was a little confused by this. I set it to source.type
based on the value defined in Constants
. The Enrichment and Indexing topologies use MessageUtils.getSensorType(msg)
to get the source type of a message. Right now this will always look for a field called source.type
.
But after digging a little more, it seems that this setting is currently only intended to define where the UI looks for the source type in the search indices, not to where Enrichment or Indexing look. That explains my confusion.
I will update this to use source:type
as you guys have mentioned and also update the description to clarify that this field is only intended for the UI.
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 might also update this so the field only shows up under the "Advanced" settings, since it is not something we expect the user to have to, nor want to change in most cases. I think I can do that easily.
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 addressed this by changing the default to source:type
and improving the description in the latest commit.
@@ -137,4 +137,10 @@ | |||
<value>yyyy.MM.dd.HH</value> | |||
<display-name>Elasticsearch Date Format</display-name> | |||
</property> | |||
<property> |
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.
Do you think It might be more appropriate to have this property in metron-rest-env instead? Now when I change it I'm prompted to restart all Metron components when really the only one that needs to be restarted is REST and the UIs. Both UIs depend on REST so they will also be included in the restart list.
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.
Yes, assuming this field is applicable only to the REST/UI/DAO, then this makes complete sense. Will address this.
from params import params | ||
env.set_params(params) | ||
|
||
metron_service.refresh_configs(params) |
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.
If we move the property to metron-rest-env then I'm not sure this is necessary.
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.
The call to refresh_configs
is the only thing that pushes changes to the global config. I don't see how the setting would be pushed to the global config without it. Let me know if I am misunderstanding something.
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.
You are correct, of course. Doh. I'll drop this.
I tested this in full dev and it worked as advertised. +1 |
The user can specify the name of the message field containing the source type in the global configuration. This is used by the Alerts UI.
Currently this necessitates a user using the CLI to add the field. This property should be exposed to the user via Ambari. The user should be able to define this property directly in Ambari.
Testing
Launch the development environment. Ensure alerts are visible in the Alerts UI and that the Service Check passes.
Open the REPL and validate the current value of the global property 'source.type.field'. The value here, the default value should be
source:type
.Change the value in Ambari by going to Metron > Configs > REST > Source Type Field Name.
After saving the change, Ambari should prompt for the following services to be restarted.
Restart all affected services.
After the services have been restarted, ppen the REPL and validate that the value of the global property 'source.type.field' changed in the global config.
Pull Request Checklist