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

Add subcategories definitions #914

Merged
merged 12 commits into from
Dec 5, 2022
Merged

Conversation

jsoriano
Copy link
Member

@jsoriano jsoriano commented Nov 24, 2022

Subcategories support.

It models the categories with the subcategories, loading them from a yaml file. We can consider later to move this yaml file to the spec so it can be also consumed from other places.

New parent_id and parent_name fields are added to subcategories in the API.

Part of elastic/package-spec#451.

@jsoriano jsoriano requested a review from a team November 24, 2022 09:43
@jsoriano jsoriano self-assigned this Nov 24, 2022
@elasticmachine
Copy link

elasticmachine commented Nov 24, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-12-05T16:14:21.992+0000

  • Duration: 6 min 33 sec

Test stats 🧪

Test Results
Failed 0
Passed 243
Skipped 0
Total 243

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

Copy link
Contributor

@jlind23 jlind23 left a comment

Choose a reason for hiding this comment

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

Should we state somewhere in the code that categories shouldn't have more than 1 nested level for now?

subcategories:
app_search:
title: "Application Search"
connector: # TODO: Do we want three different connector categories?
Copy link
Contributor

Choose a reason for hiding this comment

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

@mukeshelastic @nimarezainia would you be able to weight in here? Do we want three categories?

Choose a reason for hiding this comment

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

yes, let's limit the subcategories to only one level depth.. category -> subcategory. And author can specify only one subcategory

Copy link
Member Author

Choose a reason for hiding this comment

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

And author can specify only one subcategory

Does it mean that a package can have only a subcategory? We don't have this limitation with categories, and this may complicate things.

categories/categories.go Outdated Show resolved Hide resolved
Comment on lines 60 to 61
// TODO: Check for duplicated categories.
return categoriesFile.Categories, nil
Copy link
Contributor

Choose a reason for hiding this comment

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

I was thinking just about those possible duplicated categories. Could a category be defined as a subcategory of more than category?

Copy link
Member Author

@jsoriano jsoriano Nov 24, 2022

Choose a reason for hiding this comment

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

This won't be possible with the current approach. We will need to use conventions (like network_security vs. network_monitoring) if we want something to be a subcategory in two different categories.

Copy link
Member Author

Choose a reason for hiding this comment

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

Another option may be to require the use of subcategories in namespaced names, that would be to require to use subcategories as this for example:

categories:
  - containers
  - security.network

This would be a package that belongs to the containers category and to the security's network subcategory.

This has the limitation that we cannot reorganize categories, like may happen if we decide to move current thread_intel to be a security subcategory.

Btw, notice that using another field for subcategories doesn't solve this problem. If for example we have network as subcategory of security and monitoring, we wouldn't know to what category network would be refering in a case like this one:

categories:
  - security
  - monitoring
subcategories:
  - network

@jsoriano
Copy link
Member Author

Should we state somewhere in the code that categories shouldn't have more than 1 nested level for now?

Current code doesn't support nesting categories. I have added also a comment to the header of the yaml file.

@jsoriano
Copy link
Member Author

Updated list of categories adding the ones I missed.

There are still some open questions, they are as TODOs in the yml, but grouping them:

  1. New subcategories that were main categories before. Options:
    1. Remove main category, leave the subcategory. I'd prefer this option. To avoid breaking changes this would require the API design with the subcategory_of field, what is also fine for me.
    2. Keep main category, add a new subcategory with a different name.
  2. New categories that overlap with old categories (such as datastore vs. database). Options:
    1. Keep old categories, dismiss new ones.
    2. Keep old categories, but change the title to the new one.
    3. Keep both categories. I'd avoid this option as can be confusing.
  3. Duplicated subcategories (such as observability/monitoring vs. infrastructure/monitoring. Options:
    1. Keep subcategories with different suffixes. I have already added suffixes to some categories.
    2. Use a single category. We would need to decide which one to keep.
    3. Decide case by case between the previous options.
    4. Allow subcategories to be in multiple main categories. This can be ambiguous as described in Add subcategories definitions #914 (comment)
  4. Too specific product categories. Such as the one for WebSphere, but Kubernetes could be another one. Options:
    1. Keep them. This is probably fine, but where to draw the line before adding more.
    2. Keep them, but only as subcategories.
    3. Decide case by case.

@jlind23 @mukeshelastic @dborodyansky please take a look to these open questions. I can also take the decision, but I may be overlooking something.

@amitkanfer
Copy link

Maybe we should ask the relevant peers from the solution teams to review and signoff?
Also - i guess it's not a problem to change it later on...? @jsoriano

@jlind23
Copy link
Contributor

jlind23 commented Nov 30, 2022

@jsoriano my answers below

  1. New subcategories that were main categories before. Options:
    1. Remove main category, leave the subcategory. I'd prefer this option. To avoid breaking changes this would require the API design with the subcategory_of field, what is also fine for me.

This one will provide more clarity and avoid duplication problems in the near future.

  1. New categories that overlap with old categories (such as datastore vs. database). Options:
    1. Keep old categories, dismiss new ones.
    2. Keep old categories, but change the title to the new one.
    3. Keep both categories. I'd avoid this option as can be confusing.

Looking at the work done by @dborodyansky I would rather remove the old categories and display the ones. @kpollich could this be a breaking change on the UI end? Don't we have some hard coded featured integration that relies on some categories?

  1. Duplicated subcategories (such as observability/monitoring vs. infrastructure/monitoring. Options:
    1. Keep subcategories with different suffixes. I have already added suffixes to some categories.

Keeping subcategories with different suffixes is the best path forward, we might have observability users eager to find monitoring related integrations under the observability umbrella and who won't take a look under the infrastructure umbrella for example.

  1. Too specific product categories. Such as the one for WebSphere, but Kubernetes could be another one. Options:
    1. Keep them. This is probably fine, but where to draw the line before adding more.

We should keep them for now. The line about adding more categories was already explained by Akshay in this document:
https://docs.google.com/document/d/1pMsELVC4XbGXeFsR2gvELk5HLrLaNCujztogRzKjbOU/edit

@kpollich
Copy link
Member

Looking at the work done by @dborodyansky I would rather remove the old categories and display the ones. @kpollich could this be a breaking change on the UI end? Don't we have some hard coded featured integration that relies on some categories?

There is some hardcoding related to categories in the custom integrations plugin here: https://github.com/elastic/kibana/blob/2c774f536e2cd0b01b8829d842684e67df2c3d57/src/plugins/custom_integrations/common/index.ts

We'll need to align this file to the new categories/subcategories concept in general, but if there are any renames we should tackle those first to avoid breakage.

@jsoriano
Copy link
Member Author

Thanks @jlind23 for your clarifications, a couple of follow ups:

  1. New subcategories that were main categories before. Options:
    1. Remove main category, leave the subcategory. I'd prefer this option. To avoid breaking changes this would require the API design with the subcategory_of field, what is also fine for me.

This one will provide more clarity and avoid duplication problems in the near future.

👍

  1. New categories that overlap with old categories (such as datastore vs. database). Options:
    1. Keep old categories, dismiss new ones.
    2. Keep old categories, but change the title to the new one.
    3. Keep both categories. I'd avoid this option as can be confusing.

Looking at the work done by @dborodyansky I would rather remove the old categories and display the ones. @kpollich could this be a breaking change on the UI end? Don't we have some hard coded featured integration that relies on some categories?

Removing categories is not an option, at least without breaking changes. The closer option would be option two, keeping old categories, but changing the titles.
There could be a similar fourth option, that would be to keep both old and new categories, but both with the new titles.

  1. Duplicated subcategories (such as observability/monitoring vs. infrastructure/monitoring. Options:
    1. Keep subcategories with different suffixes. I have already added suffixes to some categories.

Keeping subcategories with different suffixes is the best path forward, we might have observability users eager to find monitoring related integrations under the observability umbrella and who won't take a look under the infrastructure umbrella for example.

👍

Regarding the current main monitoring category, should we move it under observability, so we have:

  • monitoring as subcategory of observability.
  • monitoring_infrastructure as subcategory of infrastructure.

Or keep the three categories:

  • monitoring main category as the current one.
  • monitoring_observability as subcategory of observability.
  • monitoring_infrastructure as subcategory of infrastructure.
  1. Too specific product categories. Such as the one for WebSphere, but Kubernetes could be another one. Options:
    1. Keep them. This is probably fine, but where to draw the line before adding more.

We should keep them for now. The line about adding more categories was already explained by Akshay in this document: https://docs.google.com/document/d/1pMsELVC4XbGXeFsR2gvELk5HLrLaNCujztogRzKjbOU/edit

👍

@jlind23
Copy link
Contributor

jlind23 commented Nov 30, 2022

Removing categories is not an option, at least without breaking changes. The closer option would be option two, keeping old categories, but changing the titles.
There could be a similar fourth option, that would be to keep both old and new categories, but both with the new titles.

Sorry I meant option 2 only after checking with @kpollich that this doesn't have any impact on the UI.

@jsoriano
Copy link
Member Author

TODOs resolved, and API changed, please review.

@jsoriano jsoriano requested a review from kpollich November 30, 2022 13:43
CHANGELOG.md Show resolved Hide resolved
"count": 14
"title": "Web Server",
"count": 14,
"subcategory_of": "infrastructure"
}
Copy link
Member Author

Choose a reason for hiding this comment

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

These will be the changes in the API:

  • Titles updated for some categories.
  • subcategory_of added in subcategories.

"count": 3
"title": "Web Server",
"count": 3,
"subcategory_of": "infrastructure"
Copy link
Member Author

Choose a reason for hiding this comment

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

@kpollich with this API response, Fleet is not going to be able to get the title of the parent category, should I change this to something like this?

Suggested change
"subcategory_of": "infrastructure"
"parent_id": "infrastructure",
"parent_name": "Infrastructure"

An alternative could be to include the parent category in the response, but this could affect current versions of kibana that would receive categories with count 0.

This also makes me wonder if we want to modify the search APIs, to include packages of subcategories, when searching for a main category. That would for example be to include packages of the web subcategory, when looking for the integration category.

Copy link
Member

Choose a reason for hiding this comment

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

with this API response, Fleet is not going to be able to get the title of the parent category, should I change this to something like this?

It seems like the issue is that integrations can be placed in a subcategory even if there are no integrations placed in the parent category, resulting in a case where the parent category is not included in the response.

So we have a state like this

image

I think returning the parent_name would be most helpful here, as it allows the UI to render the Infrastructure category in this case even if it does not directly contain any integrations.

Copy link
Member Author

Choose a reason for hiding this comment

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

PR updated to include the parent_name in the API response, @kpollich please take another look.

testdata/generated/categories.json Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants