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

[Cases] Make metrics routes internals and limit features #162406

Closed
adcoelho opened this issue Jul 24, 2023 · 2 comments · Fixed by #162506
Closed

[Cases] Make metrics routes internals and limit features #162406

adcoelho opened this issue Jul 24, 2023 · 2 comments · Fixed by #162506
Assignees
Labels
Feature:Cases Cases feature Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams)

Comments

@adcoelho
Copy link
Contributor

Connected with #153726

As the title says we should make the metrics routes in cases internals. Additionally, the features should be limited only to known values.

@adcoelho adcoelho added Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) Feature:Cases Cases feature labels Jul 24, 2023
@adcoelho adcoelho self-assigned this Jul 24, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops-cases (Feature:Cases)

adcoelho added a commit that referenced this issue Aug 1, 2023
Fixes #162406

## Summary

- Made `getCaseMetrics` and `getCasesMetrics` internal APIs.
- There was no documentation to begin with so there was none to remove.
- The allowed/available `features` now come from the
`CaseMetricsFeature` _enum_ instead of being hardcoded everywhere.
- We now **also** check for the values passed to the `features` field in
case metrics requests using io-ts.
- There was already some validation before which I decided to leave.
When doing `buildHandlers` the function `checkAndThrowIfInvalidFeatures`
is always called. Right now, this is only used by `getCasesMetrics` and
`getCaseMetrics` where we already decode the params so that validation
is redundant, but if it starts being used somewhere else it will be nice
to have this extra security guarantee.

### Release Notes

The get case metrics APIs are now internal.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
ThomThomson pushed a commit to ThomThomson/kibana that referenced this issue Aug 1, 2023
Fixes elastic#162406

## Summary

- Made `getCaseMetrics` and `getCasesMetrics` internal APIs.
- There was no documentation to begin with so there was none to remove.
- The allowed/available `features` now come from the
`CaseMetricsFeature` _enum_ instead of being hardcoded everywhere.
- We now **also** check for the values passed to the `features` field in
case metrics requests using io-ts.
- There was already some validation before which I decided to leave.
When doing `buildHandlers` the function `checkAndThrowIfInvalidFeatures`
is always called. Right now, this is only used by `getCasesMetrics` and
`getCaseMetrics` where we already decode the params so that validation
is redundant, but if it starts being used somewhere else it will be nice
to have this extra security guarantee.

### Release Notes

The get case metrics APIs are now internal.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Cases Cases feature Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants