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

Migrate reporting FTRs from the Stats Usage API #151808

Merged

Conversation

afharo
Copy link
Member

@afharo afharo commented Feb 21, 2023

Summary

Part of #150429. To unblock #151082 we need to migrate the reporting FTRs away from the deprecated Stats API to use the actual telemetry API.

Checklist

For maintainers

@afharo afharo self-assigned this Feb 21, 2023
@afharo afharo added Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Feature:Telemetry Feature:Functional Testing Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience) release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting labels Feb 21, 2023
@afharo afharo added the (Deprecated) Feature:Reporting Use Reporting:Screenshot, Reporting:CSV, or Reporting:Framework instead label Feb 21, 2023
@afharo afharo force-pushed the migrate-reporting-ftrs-to-actual-telemetry-endpoint branch from bf7834b to 0654211 Compare February 21, 2023 23:45
Comment on lines 14 to 21
async function getTelemetryStats(payload: {
unencrypted: true;
refreshCache?: boolean;
}): Promise<Array<{ clusterUuid: string; stats: UsageStatsPayload }>>;
async function getTelemetryStats(payload: {
unencrypted: false;
refreshCache?: boolean;
}): Promise<Array<{ clusterUuid: string; stats: string }>>;
Copy link
Member Author

Choose a reason for hiding this comment

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

adding these overrides to make it easier to consumers to deal with the output data.

Comment on lines -24 to -33
/**
* Public stats API: it returns the usage in camelCase format
*/
async getUsageStats() {
const { body } = await supertest
.get('/api/stats?extended=true')
.set('kbn-xsrf', 'xxx')
.expect(200);
return body.usage;
},
Copy link
Member Author

Choose a reason for hiding this comment

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

Removing the API as it not recommended for its use to fetch usage.

@afharo afharo force-pushed the migrate-reporting-ftrs-to-actual-telemetry-endpoint branch from 0654211 to c418438 Compare February 22, 2023 02:02
@afharo afharo marked this pull request as ready for review February 22, 2023 10:31
@afharo afharo requested review from a team as code owners February 22, 2023 10:31
@elasticmachine
Copy link
Contributor

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

@elasticmachine
Copy link
Contributor

Pinging @elastic/appex-sharedux (Team:SharedUX)

@afharo afharo enabled auto-merge (squash) February 22, 2023 10:34
@tsullivan tsullivan self-requested a review February 23, 2023 00:25
@@ -35,10 +36,11 @@ export default function ({ getService }: FtrProviderContext) {
describe('server', function () {
this.tags('skipCloud');
it('configuration settings of the tests_server', async () => {
const usage = await usageAPI.getUsageStats();
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if this will help resolve #134517

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried unskipping it, but it was still flaky. I can try to debug it on a follow up PR. I wouldn't like to delay this one further because it's blocking a community PR 🧡

Copy link
Member

@tsullivan tsullivan left a comment

Choose a reason for hiding this comment

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

x-pack/test/reporting_api_integration changes LGTM! Thanks for handling this!

stack_stats: object;
// Needed for testing to make fields easier to access
// eslint-disable-next-line @typescript-eslint/no-explicit-any
stack_stats: Record<string, any>;
Copy link
Contributor

Choose a reason for hiding this comment

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

any is a footgun, if we want to use it to avoid real types I think we should rather cast to any in the test. Even if it means we're having to repeat it a bit more.

Copy link
Member Author

Choose a reason for hiding this comment

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

I see your point! I reverted this change and specified this test-friendlier type in the FTR helper in 4c813a5 (#151808)

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @afharo

@afharo afharo merged commit 82191fe into elastic:main Feb 23, 2023
@afharo afharo deleted the migrate-reporting-ftrs-to-actual-telemetry-endpoint branch February 23, 2023 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting (Deprecated) Feature:Reporting Use Reporting:Screenshot, Reporting:CSV, or Reporting:Framework instead Feature:Functional Testing Feature:Telemetry release_note:skip Skip the PR/issue when compiling release notes Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience) v8.8.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants