Skip to content
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

[Telemetry] Share promise for concurrent telemetry report generation #122572

Closed
Tracked by #119466
afharo opened this issue Jan 10, 2022 · 5 comments
Closed
Tracked by #119466

[Telemetry] Share promise for concurrent telemetry report generation #122572

afharo opened this issue Jan 10, 2022 · 5 comments
Labels
Feature:Telemetry impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. loe:small Small Level of Effort performance resilience Issues related to Platform resilience in terms of scale, performance & backwards compatibility Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc

Comments

@afharo
Copy link
Member

afharo commented Jan 10, 2022

As identified in the Load Testing PR elastic/kibana-load-testing#211, we could improve the performance of Kibana if we'd handle concurrent Telemetry Report Generation together in one promise.

This way, if a new request comes in while the Report Generation is taking place due to a previous request, they'll await the same promise. This way we'll reduce the load on both ES and Kibana, and it will reduce response times for any new incoming request.

Once it's served, the caching mechanism that's already in place, will ensure that we don't generate the report again for a few hours (currently 4h).

@botelastic botelastic bot added the needs-team Issues missing a team label label Jan 10, 2022
@afharo afharo added Feature:Telemetry performance resilience Issues related to Platform resilience in terms of scale, performance & backwards compatibility Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc labels Jan 10, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core (Team:Core)

@pgayvallet
Copy link
Contributor

Mind sharing a few pointers regarding where the reports are generated from?

@afharo
Copy link
Member Author

afharo commented Jan 11, 2022

Good point! We generate the report here:

private async getStats(config: StatsGetterConfig) {
if (!this.usageCollection) {
return [];
}
const collection = this.collectionStrategy;
if (collection) {
// Build the context (clients and others) to send to the CollectionStrategies
const statsCollectionConfig = this.getStatsCollectionConfig(config, this.usageCollection);
if (statsCollectionConfig) {
try {
const usageData = await this.getUsageForCollection(collection, statsCollectionConfig);
this.logger.debug(`Received Usage using ${collection.title} collection.`);
return await Promise.all(
usageData.map(async (clusterStats) => {
const { cluster_uuid: clusterUuid } = clusterStats.cluster_stats as Record<
string,
string
>;
return {
clusterUuid,
stats: config.unencrypted
? clusterStats
: await encryptTelemetry(clusterStats, {
useProdKey: this.isDistributable,
}),
};
})
);
} catch (err) {
this.logger.debug(
`Failed to collect any usage with registered collection ${collection.title}.`
);
}
}
}
return [];
}

@exalate-issue-sync exalate-issue-sync bot added impact:needs-assessment Product and/or Engineering needs to evaluate the impact of the change. loe:small Small Level of Effort labels Jan 18, 2022
@exalate-issue-sync exalate-issue-sync bot added impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. and removed impact:needs-assessment Product and/or Engineering needs to evaluate the impact of the change. labels Feb 8, 2022
@afharo
Copy link
Member Author

afharo commented Feb 8, 2022

I think that it will be easier if we implement #96538 first. Because we can share the response to all users and do not bear in mind the permissions of each one of them.

@afharo
Copy link
Member Author

afharo commented Apr 19, 2022

Grooming outcome: we are closing this as we think the improvement will only cover a very niche scenario. Especially after all the improvements we've done in the report generation after we created this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Telemetry impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. loe:small Small Level of Effort performance resilience Issues related to Platform resilience in terms of scale, performance & backwards compatibility Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc
Projects
None yet
Development

No branches or pull requests

3 participants