Skip to content

[Streams 🌊] Enable /api/streams/{id}/_group endpoints for GroupStreams#210114

Merged
simianhacker merged 14 commits intoelastic:mainfrom
simianhacker:streams/_group-endpoint
Feb 20, 2025
Merged

[Streams 🌊] Enable /api/streams/{id}/_group endpoints for GroupStreams#210114
simianhacker merged 14 commits intoelastic:mainfrom
simianhacker:streams/_group-endpoint

Conversation

@simianhacker
Copy link
Copy Markdown
Member

@simianhacker simianhacker commented Feb 6, 2025

Summary

This PR implements 2 endpoints as a follow up to #208126 for working directly with the group object for GroupStreamDefinition:

  • PUT /api/streams/{id}/_group
  • GET /api/streams/{id}/_group

@simianhacker simianhacker added release_note:enhancement v9.0.0 backport:version Backport to applied version labels Feature:Streams This is the label for the Streams Project v9.1.0 v8.19.0 labels Feb 6, 2025
@simianhacker simianhacker marked this pull request as ready for review February 6, 2025 22:20
@simianhacker simianhacker requested a review from a team as a code owner February 6, 2025 22:20
@simianhacker simianhacker changed the title [Streams 🌊] Enable _group endpoint for GroupStreams [Streams 🌊] Enable /api/streams/{id}/_group endpoints for GroupStreams Feb 6, 2025
Copy link
Copy Markdown
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

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

The _group endpoint allows to overwrite any stream to a group stream:

Screenshot 2025-02-07 at 10 55 09

We should have some validation in there to make sure the type isn't changed.

@simianhacker
Copy link
Copy Markdown
Member Author

Oops... good catch. Did we miss that before?

@flash1293
Copy link
Copy Markdown
Contributor

There is a check that prevents wired/unwired switches somewhere, but I think we did for group<->ingest streams. We should probaly also update the _ingest endpoint in a similar way. This also goes back a bit to https://github.com/elastic/streams-program/discussions/147 , but let's not block on a decision on that :)

Copy link
Copy Markdown
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

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

The particular case that's mentioned is fixed, but I found a new one... if there is a classic stream occupying a name already, it will still save the group stream:

POST metrics-test-test/_doc
{
  "@timestamp": "2025"
}

# unwired stream
GET kbn:/api/streams/metrics-test-test

# create as group stream
PUT kbn:/api/streams/metrics-test-test
{
  "stream": {
    "group": {
      "members": ["logs.child1"]
    }
  },
  "dashboards": []
}

# returns group stream, unwired stream unaccessible
GET kbn:/api/streams/metrics-test-test

@elasticmachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Jest Integration Tests #3 / unrecognized task types should be no workload aggregator errors when there are removed task types

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/streams-schema 266 269 +3

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
streamsApp 287.4KB 287.4KB +24.0B
Unknown metric groups

API count

id before after diff
@kbn/streams-schema 269 273 +4

History

Copy link
Copy Markdown
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -166,11 +166,23 @@ export const editStreamRoute = createServerRoute({

if (
isGroupStreamDefinition({ ...params.body.stream, name: params.path.name }) &&
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

To make sure I get it right - this branch is just to make typescript happy, right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes

@simianhacker simianhacker merged commit 8c90076 into elastic:main Feb 20, 2025
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 8.x, 9.0

https://github.com/elastic/kibana/actions/runs/13439488930

@kibanamachine
Copy link
Copy Markdown
Contributor

💔 All backports failed

Status Branch Result
8.x Backport failed because of merge conflicts

You might need to backport the following PRs to 8.x:
- [Streams 🌊] Ensure the members array is unique for GroupStreamDefinitions (#210089)
9.0 Backport failed because of merge conflicts

You might need to backport the following PRs to 9.0:
- [Streams 🌊] Ensure the members array is unique for GroupStreamDefinitions (#210089)

Manual backport

To create the backport manually run:

node scripts/backport --pr 210114

Questions ?

Please refer to the Backport tool documentation

@simianhacker
Copy link
Copy Markdown
Member Author

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

simianhacker added a commit to simianhacker/kibana that referenced this pull request Feb 21, 2025
…ams (elastic#210114)

## Summary

This PR implements 2 endpoints as a follow up to
elastic#208126 for working directly with
the `group` object for `GroupStreamDefinition`:

- `PUT /api/streams/{id}/_group`
- `GET /api/streams/{id}/_group`

---------

Co-authored-by: Joe Reuter <johannes.reuter@elastic.co>
(cherry picked from commit 8c90076)
@kibanamachine
Copy link
Copy Markdown
Contributor

Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync.

@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Feb 21, 2025
@kibanamachine
Copy link
Copy Markdown
Contributor

Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync.

simianhacker added a commit that referenced this pull request Feb 25, 2025
…upStreams (#210114) (#212114)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Streams 🌊] Enable `/api/streams/{id}/_group` endpoints for
GroupStreams (#210114)](#210114)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Chris
Cowan","email":"chris@elastic.co"},"sourceCommit":{"committedDate":"2025-02-20T16:03:06Z","message":"[Streams
🌊] Enable `/api/streams/{id}/_group` endpoints for GroupStreams
(#210114)\n\n## Summary\n\nThis PR implements 2 endpoints as a follow up
to\nhttps://github.com//pull/208126 for working directly
with\nthe `group` object for `GroupStreamDefinition`:\n\n- `PUT
/api/streams/{id}/_group`\n- `GET
/api/streams/{id}/_group`\n\n---------\n\nCo-authored-by: Joe Reuter
<johannes.reuter@elastic.co>","sha":"8c90076d803177b0c1a9d17d00e78b242d5758ef","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","backport:version","Feature:Streams","v9.1.0","v8.19.0"],"title":"[Streams
🌊] Enable `/api/streams/{id}/_group` endpoints for
GroupStreams","number":210114,"url":"https://github.com/elastic/kibana/pull/210114","mergeCommit":{"message":"[Streams
🌊] Enable `/api/streams/{id}/_group` endpoints for GroupStreams
(#210114)\n\n## Summary\n\nThis PR implements 2 endpoints as a follow up
to\nhttps://github.com//pull/208126 for working directly
with\nthe `group` object for `GroupStreamDefinition`:\n\n- `PUT
/api/streams/{id}/_group`\n- `GET
/api/streams/{id}/_group`\n\n---------\n\nCo-authored-by: Joe Reuter
<johannes.reuter@elastic.co>","sha":"8c90076d803177b0c1a9d17d00e78b242d5758ef"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/210114","number":210114,"mergeCommit":{"message":"[Streams
🌊] Enable `/api/streams/{id}/_group` endpoints for GroupStreams
(#210114)\n\n## Summary\n\nThis PR implements 2 endpoints as a follow up
to\nhttps://github.com//pull/208126 for working directly
with\nthe `group` object for `GroupStreamDefinition`:\n\n- `PUT
/api/streams/{id}/_group`\n- `GET
/api/streams/{id}/_group`\n\n---------\n\nCo-authored-by: Joe Reuter
<johannes.reuter@elastic.co>","sha":"8c90076d803177b0c1a9d17d00e78b242d5758ef"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Feb 25, 2025
SoniaSanzV pushed a commit to SoniaSanzV/kibana that referenced this pull request Mar 4, 2025
…upStreams (elastic#210114) (elastic#212114)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Streams 🌊] Enable `/api/streams/{id}/_group` endpoints for
GroupStreams (elastic#210114)](elastic#210114)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Chris
Cowan","email":"chris@elastic.co"},"sourceCommit":{"committedDate":"2025-02-20T16:03:06Z","message":"[Streams
🌊] Enable `/api/streams/{id}/_group` endpoints for GroupStreams
(elastic#210114)\n\n## Summary\n\nThis PR implements 2 endpoints as a follow up
to\nhttps://github.com/elastic/pull/208126 for working directly
with\nthe `group` object for `GroupStreamDefinition`:\n\n- `PUT
/api/streams/{id}/_group`\n- `GET
/api/streams/{id}/_group`\n\n---------\n\nCo-authored-by: Joe Reuter
<johannes.reuter@elastic.co>","sha":"8c90076d803177b0c1a9d17d00e78b242d5758ef","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","backport:version","Feature:Streams","v9.1.0","v8.19.0"],"title":"[Streams
🌊] Enable `/api/streams/{id}/_group` endpoints for
GroupStreams","number":210114,"url":"https://github.com/elastic/kibana/pull/210114","mergeCommit":{"message":"[Streams
🌊] Enable `/api/streams/{id}/_group` endpoints for GroupStreams
(elastic#210114)\n\n## Summary\n\nThis PR implements 2 endpoints as a follow up
to\nhttps://github.com/elastic/pull/208126 for working directly
with\nthe `group` object for `GroupStreamDefinition`:\n\n- `PUT
/api/streams/{id}/_group`\n- `GET
/api/streams/{id}/_group`\n\n---------\n\nCo-authored-by: Joe Reuter
<johannes.reuter@elastic.co>","sha":"8c90076d803177b0c1a9d17d00e78b242d5758ef"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/210114","number":210114,"mergeCommit":{"message":"[Streams
🌊] Enable `/api/streams/{id}/_group` endpoints for GroupStreams
(elastic#210114)\n\n## Summary\n\nThis PR implements 2 endpoints as a follow up
to\nhttps://github.com/elastic/pull/208126 for working directly
with\nthe `group` object for `GroupStreamDefinition`:\n\n- `PUT
/api/streams/{id}/_group`\n- `GET
/api/streams/{id}/_group`\n\n---------\n\nCo-authored-by: Joe Reuter
<johannes.reuter@elastic.co>","sha":"8c90076d803177b0c1a9d17d00e78b242d5758ef"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Mar 22, 2025
…ams (elastic#210114)

## Summary

This PR implements 2 endpoints as a follow up to
elastic#208126 for working directly with
the `group` object for `GroupStreamDefinition`:

- `PUT /api/streams/{id}/_group`
- `GET /api/streams/{id}/_group`

---------

Co-authored-by: Joe Reuter <johannes.reuter@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels Feature:Streams This is the label for the Streams Project release_note:enhancement v8.19.0 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants