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

Adds nodes usage API to monitor usages of actions #24169

Merged
merged 5 commits into from Jun 2, 2017

Conversation

Projects
None yet
3 participants
@colings86
Copy link
Member

commented Apr 18, 2017

The nodes usage API has 2 main endpoints

/_nodes/usage and /_nodes/{nodeIds}/usage return the usage statistics
for all nodes and the specified node(s) respectively.

At the moment only one type of usage statistics is available, the REST
actions usage. This records the number of times each REST action class is
called and when the nodes usage api is called will return a map of rest
action class name to long representing the number of times each of the action
classes has been called.

Still to do:

  • Create usage service to store usage statistics
  • Record usage in REST layer
  • Add Transport Actions
  • Add REST Actions
  • Tests
  • Documentation
  • Check for references to statistics and replace with "feature usage"

@colings86 colings86 self-assigned this Apr 18, 2017

@clintongormley clintongormley added v6.0.0 and removed v6.0.0-alpha1 labels May 3, 2017

@colings86 colings86 force-pushed the colings86:feature/RESTUsageAPI branch 2 times, most recently May 12, 2017

@colings86 colings86 force-pushed the colings86:feature/RESTUsageAPI branch May 26, 2017

@jaymode jaymode self-requested a review May 30, 2017

@jaymode
Copy link
Member

left a comment

left a few minor comments

core/src/main/java/org/elasticsearch/rest/BaseRestHandler.java Outdated
return usageCount.sum();
}

public abstract String getName();

This comment has been minimized.

Copy link
@jaymode

jaymode May 31, 2017

Member

can you add javadocs about what the name should be

core/src/main/java/org/elasticsearch/rest/BaseRestHandler.java Outdated
protected BaseRestHandler(Settings settings) {
super(settings);
}

public long getUsageCount() {

This comment has been minimized.

Copy link
@jaymode

jaymode May 31, 2017

Member

maybe make this final?

NodesUsageRequest nodesUsageRequest = new NodesUsageRequest(nodesIds);
nodesUsageRequest.timeout(request.param("timeout"));

if (metrics.size() == 1 && metrics.contains("_all")) {

This comment has been minimized.

Copy link
@jaymode

jaymode May 31, 2017

Member

should we handle the case where _all is sent with rest_actions?

core/src/main/java/org/elasticsearch/usage/UsageService.java Outdated
public class UsageService extends AbstractComponent {

private final List<BaseRestHandler> handlers;
private long sinceTime;

This comment has been minimized.

Copy link
@jaymode

jaymode May 31, 2017

Member

this can be final?

@colings86 colings86 force-pushed the colings86:feature/RESTUsageAPI branch Jun 1, 2017

@colings86

This comment has been minimized.

Copy link
Member Author

commented Jun 1, 2017

@jaymode thanks for reviewing, I updated the PR to address your comments

@jaymode

jaymode approved these changes Jun 1, 2017

Copy link
Member

left a comment

LGTM

colings86 added some commits Apr 18, 2017

Adds nodes usage API to monitor usages of actions
The nodes usage API has 2 main endpoints

/_nodes/usage and /_nodes/{nodeIds}/usage return the usage statistics
for all nodes and the specified node(s) respectively.

At the moment only one type of usage statistics is available, the REST
actions usage. This records the number of times each REST action class is
called and when the nodes usage api is called will return a map of rest
action class name to long representing the number of times each of the action
classes has been called.

Still to do:

* [x] Create usage service to store usage statistics
* [x] Record usage in REST layer
* [x] Add Transport Actions
* [x] Add REST Actions
* [x] Tests
* [x] Documentation

@colings86 colings86 force-pushed the colings86:feature/RESTUsageAPI branch to a5bcaaa Jun 1, 2017

@colings86 colings86 merged commit 779fb9a into elastic:master Jun 2, 2017

2 checks passed

CLA Commit author has signed the CLA
Details
elasticsearch-ci Build finished.
Details

@colings86 colings86 deleted the colings86:feature/RESTUsageAPI branch Jun 2, 2017

jasontedor added a commit to s12v/elasticsearch that referenced this pull request Jun 2, 2017

Merge branch 'master' into patch-1
* master: (62 commits)
  Handle already closed while filling gaps
  [DOCS] Clarify behaviour of scripted-metric arg with empty parent buckets
  [DOCS] Clarify connections and gateway nodes selection in cross cluster search docs (elastic#24859)
  Java api: Remove unneeded getTookInMillis method (elastic#23923)
  Adds nodes usage API to monitor usages of actions (elastic#24169)
  Add superset size to Significant Term REST response (elastic#24865)
  Disallow multiple parent-join fields per mapping (elastic#25002)
  [Test] Remove unused test resources in core (elastic#25011)
  Scripting: Add optional context parameter to put stored script requests (elastic#25014)
  Extract a common base class for scroll executions (elastic#24979)
  Build: fix version sorting
  Build: Move verifyVersions to new branchConsistency task (elastic#25009)
  Add backwards compatibility indices
  Build: improve verifyVersions error message (elastic#25006)
  Add version 5.4.2 constant
  Docs: More search speed advices. (elastic#24802)
  Add version 5.3.3 constant
  Reorganize docs of global ordinals. (elastic#24982)
  Provide the TransportRequest during validation of a search context (elastic#24985)
  [TEST] fix SearchIT assertion to also accept took set to 0
  ...

@colings86 colings86 added v6.0.0-beta1 and removed v6.0.0 labels Jul 31, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.