Skip to content

Preserve pre-existing rally-metrics index templates by default#1912

Merged
fressi-elastic merged 1 commit intoelastic:masterfrom
fressi-elastic:issue/1900
Mar 6, 2025
Merged

Preserve pre-existing rally-metrics index templates by default#1912
fressi-elastic merged 1 commit intoelastic:masterfrom
fressi-elastic:issue/1900

Conversation

@fressi-elastic
Copy link
Copy Markdown
Contributor

@fressi-elastic fressi-elastic commented Feb 5, 2025

It handles issue #1900: Rally should not overwrite pre existing templates by default

When opening an EsMetricsStore, it creates the index template if any of following is true:

  • the index template doesn't exist
  • reporting/datastore.overwrite_existing_templates option is true and there are differences
    between existing and requested template.

It will preserve existing template on all the other cases.
It logs a warning when an existing index template is being replaced.
It logs index template differences between the existing one (if any) and configured one.

@gareth-ellis gareth-ellis requested a review from a team February 5, 2025 14:02
@fressi-elastic fressi-elastic changed the title Issue/1900 Preserve pre-existing index templates (#1900). Feb 5, 2025
@gareth-ellis
Copy link
Copy Markdown
Member

Could we get an update to the docs done too, to explain this feature? Obviously we want to have it tested too before we merge

@gareth-ellis gareth-ellis added enhancement Improves the status quo highlight A substantial improvement that is worth mentioning separately in release notes labels Feb 6, 2025
@fressi-elastic
Copy link
Copy Markdown
Contributor Author

Could we get an update to the docs done too, to explain this feature? Obviously we want to have it tested too before we merge

I did tested and it works as expected in all cases except one: one the overwrite_existing_templates is false it looks like it act as it is true. I guess the code is parsing it as string instead of a boolean. I am investigating on it.

@fressi-elastic fressi-elastic force-pushed the issue/1900 branch 5 times, most recently from 6e1cffa to 2ed976a Compare February 7, 2025 15:32
@fressi-elastic fressi-elastic force-pushed the issue/1900 branch 4 times, most recently from 9ed48b4 to c0c373a Compare February 13, 2025 09:29
@gareth-ellis gareth-ellis requested a review from a team February 13, 2025 09:47
@fressi-elastic fressi-elastic force-pushed the issue/1900 branch 2 times, most recently from 1fa76d8 to d1e7004 Compare February 13, 2025 14:47
@gbanasiak
Copy link
Copy Markdown
Contributor

In addition to documentation I would also try adding new modules in here to enable full scope of mypy checks:

rally/pyproject.toml

Lines 200 to 206 in 2ef33eb

[[tool.mypy.overrides]]
module = [
"esrally.mechanic.team",
"esrally.utils.modules",
"esrally.utils.io",
"esrally.utils.process",
]

Context: Until #1798, so recently on Rally timescale, we had no annotations. They were introduced very surgically to reduce the scope. Then in #1859 we introduced mypy overrides that restore full set of checks for selected modules - either new ones, or the ones we are revisiting. As we're planning to broaden annotations it would be best if all new modules were added there. Ultimately the overrides should be removed.

@gbanasiak
Copy link
Copy Markdown
Contributor

CI failure will be addressed by elastic/rally-tracks#748.

@fressi-elastic fressi-elastic force-pushed the issue/1900 branch 4 times, most recently from 95de3dd to fef436a Compare February 23, 2025 05:27
@fressi-elastic
Copy link
Copy Markdown
Contributor Author

fressi-elastic commented Mar 1, 2025

I am still processing pending comments. I am going to split this PR.

@fressi-elastic fressi-elastic force-pushed the issue/1900 branch 8 times, most recently from 5ea8073 to 7eb55d2 Compare March 3, 2025 13:50
@fressi-elastic
Copy link
Copy Markdown
Contributor Author

fressi-elastic commented Mar 3, 2025

@fressi-elastic fressi-elastic force-pushed the issue/1900 branch 6 times, most recently from 79b3907 to 92b190d Compare March 4, 2025 14:04
@gbanasiak
Copy link
Copy Markdown
Contributor

@fressi-elastic Many thanks for the split. As mentioned earlier, I'm happy with how this works for rally-metrics. The only remaining concern is:

I think the same logic should apply to remaining templates - rally-results, rally-races, and rally-annotations, for consistency. WDYT?

The rationale is the datastore.overwrite_existing_templates setting name is generic, and we have multiple templates, see EsResultsStore and EsRaceStore classes in metrics.py. We can address this in a follow-up PR if you prefer.

@fressi-elastic
Copy link
Copy Markdown
Contributor Author

I already started working in a follow-up PR address @gbanasiak comments. Thank you for addressing this point I didn't catch earlier.

@fressi-elastic fressi-elastic changed the title Preserve pre-existing index templates (#1900). Preserve pre-existing index templates Mar 6, 2025
@fressi-elastic fressi-elastic force-pushed the issue/1900 branch 3 times, most recently from f323bd6 to fe2d1bb Compare March 6, 2025 05:05
@fressi-elastic fressi-elastic changed the title Preserve pre-existing index templates Preserve pre-existing rally-metrics index templates by default Mar 6, 2025
@fressi-elastic fressi-elastic enabled auto-merge (squash) March 6, 2025 05:06
It handles issue elastic#1900: Rally should not overwrite pre existing templates by default

When opening an EsMetricsStore, it creates the index template if any of following is true:

- the index template doesn't exist
- `reporting/datastore.overwrite_existing_templates` option is true and there are differences
  between existing and requested template.

It will preserve existing template on all the other cases.
It logs a warning when an existing index template is being replaced.
It logs index template differences between the existing one (if any) and configured one.
@fressi-elastic fressi-elastic merged commit 136c423 into elastic:master Mar 6, 2025
15 checks passed
@dpifke-elastic dpifke-elastic added this to the 2.12.0 milestone Mar 28, 2025
@fressi-elastic fressi-elastic deleted the issue/1900 branch July 3, 2025 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improves the status quo highlight A substantial improvement that is worth mentioning separately in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants