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

Stats API: implement the "kibana status" spec from the Monitoring data model for stats #20577

Merged
merged 46 commits into from
Jul 18, 2018

Conversation

tsullivan
Copy link
Member

@tsullivan tsullivan commented Jul 9, 2018

Addresses #20393

  1. The /api/stats?extended=true API endpoint returns data in the same model as the kibana_stats documents in the .monitoring-kibana-* indices
  2. The API data shares some metrics modules with the /api/status API endpoint, which will be marked as "deprecated" in 7.0 and removed in 8.0
  3. Where the stats API needs data in a different format than the shared modules are providing, the workarounds to fix the format are done in the older status API code to continue legacy backwards compatibility

No release notes yet, but there should documentation for this API in the next major version.

Usage:

  1. Get Kibana server system status metrics:

    GET /api/stats
    
  2. Get Kibana server system status metrics, along with the Elasticsearch clusterUuid, and plugin usage metrics. This will require authentication if Elasticsearch requires it:

    GET /api/stats?extended=true
    

},
response_times: {
// TODO: rename to use `_ms` suffix per beats naming conventions
Copy link
Member Author

@tsullivan tsullivan Jul 10, 2018

Choose a reason for hiding this comment

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

collectorSet.toApiFieldNames() takes care of this TODO

@tsullivan tsullivan force-pushed the usage/stats-api-fixes branch 2 times, most recently from 503ac41 to ca5f2fa Compare July 10, 2018 23:58
- constantly accumulating stats over time does not align with the existing behavior, which is to reset the stats to 0 whenever they are pulled
@elastic elastic deleted a comment from elasticmachine Jul 12, 2018
@@ -69,11 +69,13 @@ const getInitial = () => {
];
};

// TODO use jest snapshotting
Copy link
Member Author

@tsullivan tsullivan Jul 12, 2018

Choose a reason for hiding this comment

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

This TODO will not be done in this PR to avoid extra lines of code change. This PR does change this from a Mocha test to a Jest test though.

@elastic elastic deleted a comment from elasticmachine Jul 18, 2018
@elastic elastic deleted a comment from elasticmachine Jul 18, 2018
@elastic elastic deleted a comment from elasticmachine Jul 18, 2018
@tsullivan
Copy link
Member Author

CI passing and going green looks like a fluke. Jenkins has downtime right now. I'll run it when I hear that it's ready.

@tsullivan
Copy link
Member Author

jenkins, test this

@tsullivan
Copy link
Member Author

Had a failed build from:

 └- ✖ fail: "discover app discover app query save query should show toast message and display query name"
21:28:34    │ proc  [ftr]        │        Error: expected '' to equal 'Query # 1'
21:28:34    │ proc  [ftr]       

@elastic elastic deleted a comment from elasticmachine Jul 18, 2018
Copy link
Contributor

@ycombinator ycombinator left a comment

Choose a reason for hiding this comment

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

LGTM!

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@tsullivan tsullivan merged commit 274617d into elastic:master Jul 18, 2018
@tsullivan tsullivan deleted the usage/stats-api-fixes branch July 18, 2018 23:37
@tsullivan
Copy link
Member Author

Thanks 1,000,000 @ycombinator and @chrisronline for helping me review and test this!

tsullivan added a commit that referenced this pull request Jul 18, 2018
…a model for stats (#20577)

* [Stats API] Set API field names per spec

* fix jest tests

* fix api integration test

* trash the original metrics collector

- constantly accumulating stats over time does not align with the existing behavior, which is to reset the stats to 0 whenever they are pulled

* move some logic out of the collector types combiner into inline

- change the signature of sourceKibana

* Make a new stats collector for the API

- to not clear the data when pulling via the api
- fetching is a read-only thing

* isolate data transforms for api data and upload data

* no static methods

* remove external in bytes

* remove the _stats prefix for kibana and reporting

* update jest test snapshot

* fix collector_types_combiner test

* fix usage api

* add test suite todo comment

* reduce some loc change

* roll back mysterious change

* reduce some more loc change

* comment correction

* reduce more loc change

* whitespace

* comment question

* fix cluster_uuid

* fix stats integration test

* fix bulk uploader test, combineTypes is no longer external

* very important comments about the current nature of stats represented and long-term goals

* add stats api tests with/without authentication

* fix more fields to match data model

* fix more tests

* fix jest test

* remove TODO

* remove sockets

* use snake_case for api field names

* restore accidental removal + copy/paste error

* sourceKibana -> getKibanaInfoForStats

* skip usage test on legacy endpoint

* fix api tests

* more comment

* stop putting a field in that used to be omitted

* fix the internal type to ID the usage data for bulk uploader

* correct the kibana usage type value, which is shown as-is in the API

* more fixes for the constants identifying collector types + test against duplicates

* add a comment on a hack, and a whitespace fix
@tsullivan
Copy link
Member Author

6.x/6.4.0: #20956

@elastic elastic deleted a comment from elasticmachine Jul 19, 2018
@elastic elastic deleted a comment from elasticmachine Jul 19, 2018
@elastic elastic deleted a comment from elasticmachine Jul 19, 2018
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

tsullivan added a commit to tsullivan/kibana that referenced this pull request Jul 19, 2018
…a model for stats (elastic#20577)

* [Stats API] Set API field names per spec

* fix jest tests

* fix api integration test

* trash the original metrics collector

- constantly accumulating stats over time does not align with the existing behavior, which is to reset the stats to 0 whenever they are pulled

* move some logic out of the collector types combiner into inline

- change the signature of sourceKibana

* Make a new stats collector for the API

- to not clear the data when pulling via the api
- fetching is a read-only thing

* isolate data transforms for api data and upload data

* no static methods

* remove external in bytes

* remove the _stats prefix for kibana and reporting

* update jest test snapshot

* fix collector_types_combiner test

* fix usage api

* add test suite todo comment

* reduce some loc change

* roll back mysterious change

* reduce some more loc change

* comment correction

* reduce more loc change

* whitespace

* comment question

* fix cluster_uuid

* fix stats integration test

* fix bulk uploader test, combineTypes is no longer external

* very important comments about the current nature of stats represented and long-term goals

* add stats api tests with/without authentication

* fix more fields to match data model

* fix more tests

* fix jest test

* remove TODO

* remove sockets

* use snake_case for api field names

* restore accidental removal + copy/paste error

* sourceKibana -> getKibanaInfoForStats

* skip usage test on legacy endpoint

* fix api tests

* more comment

* stop putting a field in that used to be omitted

* fix the internal type to ID the usage data for bulk uploader

* correct the kibana usage type value, which is shown as-is in the API

* more fixes for the constants identifying collector types + test against duplicates

* add a comment on a hack, and a whitespace fix
tsullivan added a commit that referenced this pull request Jul 19, 2018
…a model for stats (#20577) (#20956)

* [Stats API] Set API field names per spec

* fix jest tests

* fix api integration test

* trash the original metrics collector

- constantly accumulating stats over time does not align with the existing behavior, which is to reset the stats to 0 whenever they are pulled

* move some logic out of the collector types combiner into inline

- change the signature of sourceKibana

* Make a new stats collector for the API

- to not clear the data when pulling via the api
- fetching is a read-only thing

* isolate data transforms for api data and upload data

* no static methods

* remove external in bytes

* remove the _stats prefix for kibana and reporting

* update jest test snapshot

* fix collector_types_combiner test

* fix usage api

* add test suite todo comment

* reduce some loc change

* roll back mysterious change

* reduce some more loc change

* comment correction

* reduce more loc change

* whitespace

* comment question

* fix cluster_uuid

* fix stats integration test

* fix bulk uploader test, combineTypes is no longer external

* very important comments about the current nature of stats represented and long-term goals

* add stats api tests with/without authentication

* fix more fields to match data model

* fix more tests

* fix jest test

* remove TODO

* remove sockets

* use snake_case for api field names

* restore accidental removal + copy/paste error

* sourceKibana -> getKibanaInfoForStats

* skip usage test on legacy endpoint

* fix api tests

* more comment

* stop putting a field in that used to be omitted

* fix the internal type to ID the usage data for bulk uploader

* correct the kibana usage type value, which is shown as-is in the API

* more fixes for the constants identifying collector types + test against duplicates

* add a comment on a hack, and a whitespace fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Team:Monitoring Stack Monitoring team v6.4.0 v7.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants