-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
The elastic search report is getting the version of the elastic search server during the construction:
public ElasticSearchReport(ElasticReportsConfig reportConfig)
{
var uri = new Uri($"http://{reportConfig.Host}:{reportConfig.Port}/_bulk");
var nodeInfoUri = new Uri($"http://{reportConfig.Host}:{reportConfig.Port}");
_reportConfig = reportConfig;
this.elasticSearchUri = uri;
using (var client = new WebClient())
{
try
{
var json = client.DownloadString(nodeInfoUri);
var deserializer = new DataContractJsonSerializer(typeof(ElasticSearchNodeInfo));
using (MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(json)))
{
var nodeInfo = (ElasticSearchNodeInfo)deserializer.ReadObject(stream);
replaceDotsOnFieldNames = nodeInfo.MajorVersionNumber >= 2;
}
}
catch (Exception ex)
{
log.WarnException("Unable to get ElasticSearch version. Field names with dots won't be replaced.", ex);
replaceDotsOnFieldNames = false;
}
}
}
So in case of any exception here all the following report attempts are broken.
Possible solutions:
- Have the version of the elastic search configurable
- Make the init lazy by moving to the actual reporting reporting and keep trying to init until it's initialized with every report attempt.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels