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

[es] Add index rollover mode that can choose day and hour #2965

Merged
merged 13 commits into from
May 17, 2021
Merged

[es] Add index rollover mode that can choose day and hour #2965

merged 13 commits into from
May 17, 2021

Conversation

WalkerWang731
Copy link
Contributor

@WalkerWang731 WalkerWang731 commented Apr 28, 2021

Which problem is this PR solving?

Short description of the changes

  • Add two parameters index-rollover-frequency-spans and index-rollover-frequency-services, default is day mode, will not affect existing usage
  • Minimize changes to ensure compatibility with previous code

Parameter config of collector ingester query (SPAN_STORAGE_TYPE=elasticsearch)

--es-archive.index-rollover-frequency-services string   Rotates jaeger-service indices over the given period. For example "day" creates "jaeger-service-yyyy-MM-dd" every day after UTC 12AM. Valid options: [hour, day]. Jaeger additionally supports manual and automated (via ILM) index management. Reference: https://www.jaegertracing.io/docs/deployment/#elasticsearch-rollover. (default "day")
--es-archive.index-rollover-frequency-spans string      Rotates jaeger-span indices over the given period. For example "day" creates "jaeger-span-yyyy-MM-dd" every day after UTC 12AM. Valid options: [hour, day]. Jaeger additionally supports manual and automated (via ILM) index management. Reference: https://www.jaegertracing.io/docs/deployment/#elasticsearch-rollover. (default "day")
--es.index-rollover-frequency-services string           Rotates jaeger-service indices over the given period. For example "day" creates "jaeger-service-yyyy-MM-dd" every day after UTC 12AM. Valid options: [hour, day]. Jaeger additionally supports manual and automated (via ILM) index management. Reference: https://www.jaegertracing.io/docs/deployment/#elasticsearch-rollover. (default "day")
--es.index-rollover-frequency-spans string              Rotates jaeger-span indices over the given period. For example "day" creates "jaeger-span-yyyy-MM-dd" every day after UTC 12AM. Valid options: [hour, day]. Jaeger additionally supports manual and automated (via ILM) index management. Reference: https://www.jaegertracing.io/docs/deployment/#elasticsearch-rollover. (default "day")

@WalkerWang731 WalkerWang731 requested a review from a team as a code owner April 28, 2021 02:21
@codecov
Copy link

codecov bot commented Apr 28, 2021

Codecov Report

Merging #2965 (e8e5388) into master (d43af83) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2965      +/-   ##
==========================================
+ Coverage   95.95%   95.97%   +0.02%     
==========================================
  Files         224      224              
  Lines        9747     9773      +26     
==========================================
+ Hits         9353     9380      +27     
+ Misses        325      324       -1     
  Partials       69       69              
Impacted Files Coverage Δ
plugin/storage/es/factory.go 97.75% <100.00%> (+0.10%) ⬆️
plugin/storage/es/options.go 100.00% <100.00%> (ø)
plugin/storage/es/spanstore/reader.go 100.00% <100.00%> (ø)
plugin/storage/es/spanstore/writer.go 100.00% <100.00%> (ø)
plugin/storage/badger/spanstore/reader.go 95.37% <0.00%> (-0.72%) ⬇️
plugin/storage/integration/integration.go 77.34% <0.00%> (-0.56%) ⬇️
cmd/query/app/static_handler.go 96.77% <0.00%> (+1.61%) ⬆️
pkg/config/tlscfg/cert_watcher.go 94.80% <0.00%> (+2.59%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d43af83...e8e5388. Read the comment docs.

@WalkerWang731
Copy link
Contributor Author

WalkerWang731 commented Apr 28, 2021

Hi @albertteoh
Sorry for the trouble with you. I have recreated a new PR that repair the signoff issue (here) and repair CI issue (here), let us continue on here

albertteoh
albertteoh previously approved these changes Apr 28, 2021
@@ -199,9 +200,16 @@ func timeRangeIndices(indexName, indexDateLayout string, startTime time.Time, en
var indices []string
firstIndex := indexWithDate(indexName, indexDateLayout, startTime)
currentIndex := indexWithDate(indexName, indexDateLayout, endTime)

reduce := -24 * time.Hour
if strings.HasSuffix(indexDateLayout, "15") {
Copy link
Contributor

Choose a reason for hiding this comment

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

It's a shame time.stdHour isn't exported.

Copy link
Member

Choose a reason for hiding this comment

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

A cleaner way is to pass freq directly as parameter, not infer it back from format string

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I also thought previously, but if pass freq directly then will also judge this variable too(if freq == "day" or move this judgment to ClientBuilder of config.go ), basically it same as currently.

And another side, other functions will be become more complicated include NewSpanReader SpanReaderParams SpanReader addRemoteReadClusters timeRangeIndices createSpanWriter and reader relevant factory functions and all of unit test functions. and change the ClientBuilder of config.go.

Actually, I always thought this commit should be small and should not change more code, but if we need, I can do it

Copy link
Member

@yurishkuro yurishkuro Apr 28, 2021

Choose a reason for hiding this comment

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

fair enough. As Albert said, it would be good to at least use a named constant shared between config and span reader

Copy link
Contributor Author

@WalkerWang731 WalkerWang731 Apr 28, 2021

Choose a reason for hiding this comment

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

ok, I see, now that we decide to add the new constant, I want to separate rollover jaeger-span and jaeger-service incidentally. How about?
Because the reason can refer here
I will add two params index-rollover-span-frequency and index-rollover-span-frequency, do you have any suggestions?

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good. I would suggest these names index-rollover-frequency-spans and index-rollover-frequency-services

nsConfig.namespace+suffixIndexRolloverFrequency,
defaultIndexRolloverFrequency,
"Rotates Jaeger indices over the given period. For example \"day\" creates \"jaeger-span-yyyy-MM-dd\" every day after UTC 12AM. Valid options: [hour, day]. "+
"Jaeger additionally supports manual and automated (via ILM) index management. Reference: https://www.jaegertracing.io/docs/deployment/#elasticsearch-rollover.")
Copy link
Member

Choose a reason for hiding this comment

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

Didn't we decide to change this msg?

Copy link
Contributor

Choose a reason for hiding this comment

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

@WalkerWang731 I believe we suggested to reword this to (@yurishkuro please correct if I'm wrong):

This does not delete old indices. For details on complete index management solutions supported by Jaeger, refer to: https://www.jaegertracing.io/docs/deployment/#elasticsearch-rollover

…hub.com:WalkerWang731/jaeger into walkerwang731/add_index_rollover_for_es_storage

Signed-off-by: WalkerWang731 <[email protected]>
@mergify mergify bot dismissed albertteoh’s stale review April 29, 2021 16:33

Pull request has been modified.

…defaultIndexRolloverFrequency

Signed-off-by: WalkerWang731 <[email protected]>
@WalkerWang731
Copy link
Contributor Author

Hi @yurishkuro @albertteoh,
I had updated and added two params index-rollover-frequency-spans and index-rollover-frequency-services

@albertteoh albertteoh merged commit 19cbe35 into jaegertracing:master May 17, 2021
@albertteoh
Copy link
Contributor

Thanks @WalkerWang731!

@jpkrohling jpkrohling added this to the Release 1.23.0 milestone Jun 4, 2021
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.

ES index rotation mode can choice with day and hour
4 participants