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] Full schema definition #90273

Merged
merged 28 commits into from
Mar 1, 2021

Conversation

afharo
Copy link
Member

@afharo afharo commented Feb 4, 2021

Summary

This PR adds the schema definitions to the full payloads sent from the OSS and X-Pack local collectors.

It also creates some functional tests that validate that the schemas are up-to-date: for now, it primarily checks that we don't report fields that are not detailed in the schema. But it intentionally defines all the fields as optional. We can create additional tests in the future to ensure certain keys are mandatory.

Example of the error thrown during CI:

     │1)    apis
     │       Telemetry
     │         /api/telemetry/v2/clusters/_stats with monitoring disabled
     │           should pass the schema validation:
     │
     │      Error: The telemetry schemas in 'x-pack/plugins/telemetry_collection_xpack/schema/' are out-of-date, please update it as required: [stack_stats.kibana.plugins.spaces.disabledFeatures.savedObjectsTagging]: definition for this key is missing. Received `0`

Last, but not least, it deletes the legacy_oss definition.

TODO: Planned for a follow-up issue: define the monitoring payload (#90795).

Resolves #83704

Code Owners Review

Why am I required to review this? If your team has been asked to review, it is quite likely that we've found some issues when running the functional tests. I've tried to fix it the way I think it makes more sense to me, but please, let me know if a different approach should be taken in your collector.

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@afharo afharo added release_note:skip Skip the PR/issue when compiling release notes v7.12.0 labels Feb 4, 2021
@afharo afharo force-pushed the telemetry/full-schema-definition branch from 65d7788 to 1e17622 Compare February 5, 2021 15:49
Copy link
Member Author

@afharo afharo left a comment

Choose a reason for hiding this comment

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

self-review/comments

}
}
},
"DYNAMIC_KEY": {
Copy link
Member Author

Choose a reason for hiding this comment

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

This comment applies to all the usages of DYNAMIC_KEY int he *_root.json files. Should we be more explicit in these, since we should know in advance all the possible values?

Copy link
Member Author

Choose a reason for hiding this comment

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

cc/ @elastic/infra-telemetry

Copy link

Choose a reason for hiding this comment

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

Should we be more explicit in these, since we should know in advance all the possible values?

+1 for explicit values, if we know them in advance 🙏

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'd like some input from the ES team here to confirm if we'll know them in advance

@afharo afharo marked this pull request as ready for review February 5, 2021 18:33
@afharo afharo requested review from a team as code owners February 5, 2021 18:33
@botelastic botelastic bot added the Team:APM All issues that need APM UI Team support label Feb 5, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/apm-ui (Team:apm)

Copy link
Contributor

@YulNaumenko YulNaumenko left a comment

Choose a reason for hiding this comment

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

Alerting related changes LGTM.

@afharo
Copy link
Member Author

afharo commented Feb 8, 2021

@elasticmachine merge upstream

Copy link
Contributor

@pgayvallet pgayvallet left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@Bamieh Bamieh left a comment

Choose a reason for hiding this comment

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

Code LGTM.

I just want to voice my concerns here for the sake of clarity; As I stated earlier am not super happy baking these tests into our code base (#83704 (comment)). I am ok with merging this since the team feels OK doing that however.

I still believe we should not be having the full schema definition in kibana. We are basically adding tests for elasticsearch in our kibana codebase.

I'm worried that before every release all this will be skipped and marked as a flaky test.
The build priority is higher than fixing telemetry tests that fail from an ES update. This means the burden of updating those will always fall on our shoulders now.

The telemetry_check will not fix the breaking changes in the root schemas (and cannot since there was a lot of manual checking involved to writing those root schemas).

@afharo
Copy link
Member Author

afharo commented Feb 9, 2021

@elasticmachine merge upstream

@afharo afharo requested a review from rjernst February 15, 2021 09:29
@afharo
Copy link
Member Author

afharo commented Feb 15, 2021

Adding @rjernst as a reviewer because we are waiting for the input from the ES team because they'll have to maintain the possible changes coming from the ES APIs passed through.

Related issue elastic/elasticsearch#58198

Copy link
Contributor

@TinaHeiligers TinaHeiligers left a comment

Choose a reason for hiding this comment

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

Adding an LGTM to unblock a review needed from the kibana-telemetry team

@afharo
Copy link
Member Author

afharo commented Feb 17, 2021

@elasticmachine merge upstream

Sorry for the noise, just keeping this up-to-date to test how often will this break in the future as other teams push features and changes :)

@afharo
Copy link
Member Author

afharo commented Feb 19, 2021

@elasticmachine merge upstream

Sorry for the noise (again), just keeping this up-to-date to test how often will this break in the future as other teams push features and changes :)

@afharo
Copy link
Member Author

afharo commented Feb 22, 2021

@elasticmachine merge upstream

Sorry for the noise (again), just keeping this up-to-date to test how often will this break in the future as other teams push features and changes :)

@afharo
Copy link
Member Author

afharo commented Feb 25, 2021

In order to unblock some goodness this PR brings in (especially FTRs to make sure what we actually report matches what we claim in the schema), I've created the pass_through type so we can validate them as schema.any(). It is applied to all the fields we simply pass-through as they are from ES.

#92867 will add the definition of ES fields once we agree on the best way to keep them up-to-sync.

@afharo afharo requested a review from a team February 25, 2021 17:54
@afharo
Copy link
Member Author

afharo commented Mar 1, 2021

@elasticmachine merge upstream

@afharo afharo requested a review from mindbat March 1, 2021 17:25
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

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

Copy link
Contributor

@TinaHeiligers TinaHeiligers left a comment

Choose a reason for hiding this comment

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

The changes since I last reviewed the PR look good to me.
My second review (this one) is a code-review only.
LGTM!

@afharo afharo added auto-backport Deprecated - use backport:version if exact versions are needed v7.13.0 and removed v7.12.0 labels Mar 1, 2021
@afharo afharo merged commit f44916b into elastic:master Mar 1, 2021
@afharo afharo deleted the telemetry/full-schema-definition branch March 1, 2021 18:30
@kibanamachine
Copy link
Contributor

💔 Backport failed

❌ 7.x: Commit could not be cherrypicked due to conflicts

To backport manually, check out the target branch and run:
node scripts/backport --pr 90273

afharo added a commit to afharo/kibana that referenced this pull request Mar 2, 2021
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
# Conflicts:
#	test/api_integration/apis/telemetry/telemetry_local.ts
afharo added a commit that referenced this pull request Mar 2, 2021
* [Telemetry] Full `schema` definition (#90273)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
# Conflicts:
#	test/api_integration/apis/telemetry/telemetry_local.ts

* Normalize test arguments with `master`

* Normalize to `master` the `/api/settings` FTR tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed release_note:skip Skip the PR/issue when compiling release notes Team:APM All issues that need APM UI Team support v7.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Telemetry] [schema] Define schema for the data that is reported by the telemetry plugin
10 participants