Skip to content

Conversation

@dimitris-athanasiou
Copy link
Contributor

This commit populates the _stats API response with sensible "empty"
data_counts and memory_usage objects when the job itself
has not started reporting them.

This commit populates the _stats API response with sensible "empty"
`data_counts` and `memory_usage` objects when the job itself
has not started reporting them.
@elasticmachine
Copy link
Collaborator

Pinging @elastic/ml-core (:ml)

Comment on lines 322 to 325
Map<String, DataFrameAnalyticsConfig> configById = new HashMap<>();
for (DataFrameAnalyticsConfig config : configs) {
configById.put(config.getId(), config);
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Map<String, DataFrameAnalyticsConfig> configById = new HashMap<>();
for (DataFrameAnalyticsConfig config : configs) {
configById.put(config.getId(), config);
}
Map<String, DataFrameAnalyticsConfig> configById = configs.stream().collect(Collectors.toMap(DataFrameAnalyticsConfig::getId, Function.identity()));

statsItem.getState(),
statsItem.getFailureReason(),
statsItem.getProgress(),
statsItem.getDataCounts() == null ? new DataCounts(config.getId()) : statsItem.getDataCounts(),
Copy link
Member

Choose a reason for hiding this comment

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

Why can't this and the memory usage be initialized in the stats ctor?

this.memoryUsage = memoryUsage == null ? new MemoryUsage(config.getId(), Instant.now(), 0) : memoryUsage;
this.dataCounts = dataCounts == null ? new DataCounts(config.getId()) : dataCounts;

Why do we need to set memory_usage create time to the config's create time? Is that adding value for the added complexity?

Or maybe I am misunderstanding the Stats#getId() value...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree that's too much complexity for the gain. I'll make MemoryUsage.timestamp nullable.

@dimitris-athanasiou
Copy link
Contributor Author

@elasticmachine update branch

@dimitris-athanasiou dimitris-athanasiou merged commit ae7da16 into elastic:master Mar 26, 2020
@dimitris-athanasiou dimitris-athanasiou deleted the df-analytics-always-display-operational-stats branch March 26, 2020 16:56
dimitris-athanasiou added a commit to dimitris-athanasiou/elasticsearch that referenced this pull request Mar 26, 2020
…ic#54210)

This commit populates the _stats API response with sensible "empty"
`data_counts` and `memory_usage` objects when the job itself
has not started reporting them.

Backport of elastic#54210
dimitris-athanasiou added a commit that referenced this pull request Mar 26, 2020
… (#54291)

This commit populates the _stats API response with sensible "empty"
`data_counts` and `memory_usage` objects when the job itself
has not started reporting them.

Backport of #54210
dimitris-athanasiou added a commit that referenced this pull request Mar 26, 2020
… (#54290)

This commit populates the _stats API response with sensible "empty"
`data_counts` and `memory_usage` objects when the job itself
has not started reporting them.

Backport of #54210
dimitris-athanasiou added a commit to dimitris-athanasiou/elasticsearch that referenced this pull request Mar 26, 2020
Copy link
Contributor

@przemekwitek przemekwitek left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants