Skip to content

dynamic config: enhance update with metrics etc#9366

Open
feiyang3cat wants to merge 2 commits intotemporalio:mainfrom
feiyang3cat:dc/update-metric
Open

dynamic config: enhance update with metrics etc#9366
feiyang3cat wants to merge 2 commits intotemporalio:mainfrom
feiyang3cat:dc/update-metric

Conversation

@feiyang3cat
Copy link
Contributor

@feiyang3cat feiyang3cat commented Feb 19, 2026

What changed?

  1. added metric when update fails
  2. found a potential problem with lastModifiedTime, so enhanced its accuracy to of prevent cases like transient errors will skip next update, etc

Why?

may be a root cause why pods run into crashloop
adding this metric for alert make debugging easier

How did you test it?

  • built
  • run locally and tested manually
  • covered by existing tests
  • added new unit test(s)
  • added new functional test(s)

@feiyang3cat feiyang3cat requested review from a team as code owners February 19, 2026 22:04
@feiyang3cat feiyang3cat changed the title dynamic config: add metric dynamic config: enhance update with metrics etc Feb 19, 2026
fc.lastUpdatedTime = modtime
defer func() {
if updateErr != nil {
fc.lastUpdatedTime = prevModtime
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@yycptt may need a look at this change

tag.Bool("debug-mode", debug.Enabled),
)

metricsHandler, err := metrics.MetricsHandlerFromConfig(logger, cfg.Global.Metrics)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is kind of unfortunate. I would rather see main() use fewer ServerOptions and rely on the defaults more, instead of the opposite. Do you think you could look into what it would take to move initialization of both metrics handler and dc client out of main and use the defaults?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Definitely! I'd love to look into it. how about I create another Jira task for this separately ? so that this refinement doesn't impact an incident fix

fc.lastUpdatedTime = modtime
defer func() {
if updateErr != nil {
fc.lastUpdatedTime = prevModtime
Copy link
Contributor

Choose a reason for hiding this comment

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

this would be cleaner if it updated forward in the defer in the no-error case

Comment on lines 119 to 120
updateErr = fmt.Errorf("dynamic config file: %s: %w", fc.config.Filepath, err)
return
Copy link
Contributor

Choose a reason for hiding this comment

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

you don't have the change this, the one-line return works fine even if you have a named return

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

Comments