8000 补充elasticsearch插件num_most_recent_indices参数逻辑&完善indices_include生效范围 by longjun91 · Pull Request #1203 · flashcatcloud/categraf · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

补充elasticsearch插件num_most_recent_indices参数逻辑&完善indice 8000 s_include生效范围 #1203

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

Merged
merged 1 commit into from
Apr 26, 2025

Conversation

longjun91
Copy link
Contributor

1、elasticsearch插件增加num_most_recent_indices参数处理逻辑
2、补充elasticsearch插件ilm_indices、indices_settings、indices_mappings、indices_aliases 参数indices_include生效逻辑以及参数num_most_recent_indices处理逻辑

2、补充elasticsearch插件ilm_indices、indices_settings、indices_mappings、indices_aliases 参数indices_include生效逻辑以及参数num_most_recent_indices处理逻辑
@kongfei605 kongfei605 requested a review from Copilot April 26, 2025 09:09
Copy link
Contributor
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the Elasticsearch plugin by adding logic to process the num_most_recent_indices parameter and extends the indices_include filtering across multiple collectors.

  • Updated configuration and function signatures to pass num_most_recent_indices and indexMatchers for indices, indices settings, mappings, and ILM indices.
  • Adjusted parameter names and updated test cases to match the new logic.

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
inputs/elasticsearch/elasticsearch.go Changed the toml tag for index aliases and updated NewIndices to take new parameters.
inputs/elasticsearch/collector/indices*.go Updated NewIndices, gatherIndividualIndicesStats, and categorization logic to include num_most_recent_indices and indexMatchers.
inputs/elasticsearch/collector/indices_settings*.go Updated NewIndicesSettings and processing logic with additional filtering and sorting based on the new parameters.
inputs/elasticsearch/collector/indices_mappings*.go Modified NewIndicesMappings and related fetch/collect methods to support the new parameters.
inputs/elasticsearch/collector/ilm_indices*.go Extended ILM indices collector with new filtering and num_most_recent_indices processing logic.
Comments suppressed due to low confidence (3)

inputs/elasticsearch/elasticsearch.go:59

  • The configuration key was updated to 'export_indices_aliases' for consistency with plural naming. Please ensure that the documentation and any related configuration samples are updated accordingly.
ExportIndexAliases    bool            `toml:"export_indices_aliases"`

inputs/elasticsearch/collector/indices_settings.go:248

  • Verify that lexicographical sorting using sort.Strings yields the correct ordering for determining the most recent indices, especially if the index names encode timestamps or other non-lexicographic orderings.
sort.Strings(matchingIndices)

inputs/elasticsearch/collector/indices.go:2526

  • Confirm that using sort.Strings for ordering matchingIndices correctly reflects index recency according to the expected naming convention. If index names do not sort chronologically in lexicographical order, consider implementing a custom sorting function.
sort.Strings(matchingIndices)

@@ -56,7 +56,7 @@ type (
ExportIndices bool `toml:"export_indices"`
ExportIndicesSettings bool `toml:"export_indices_settings"`
ExportIndicesMappings bool `toml:"export_indices_mappings"`
ExportIndexAliases bool `toml:"export_index_aliases"`
ExportIndexAliases bool `toml:"export_indices_aliases"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

可以用两个配置,一个配置兼容已有用户的export_index_aliases, 一个配置是新的正确语义的配置export_indices_aliases。 初始化时,老配置的可以给个提示deprecated,然后老的配置赋值给新的配置,后面流程都用新的配置。

Copy link
Collaborator

Choose a reason for hiding this comment

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

这个我来改吧,先merge了

@kongfei605 kongfei605 merged commit dc1338f into flashcatcloud:main Apr 26, 2025
0 of 3 checks passed
@kongfei605
Copy link
Collaborator

Thank you @longjun91

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.

2 participants
0