Skip to content

ESS-4327: Added option to set metric name when using _timer decorator - #156

Merged
branislav-jenco-4ss merged 6 commits into
masterfrom
ESS-4327
Aug 21, 2026
Merged

ESS-4327: Added option to set metric name when using _timer decorator#156
branislav-jenco-4ss merged 6 commits into
masterfrom
ESS-4327

Conversation

@branislav-jenco-4ss

Copy link
Copy Markdown
Contributor

No user facing changes, but this allows us to track egress metrics better by being able to differentiate between .get() and .get_samples_aggregate() methods in Application Insights.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds configurability to the internal latency-metric decorator so the client can emit distinct Application Insights metric names for different read paths, improving observability of egress usage.

Changes:

  • Refactors _timer into a decorator factory that accepts a metric_name.
  • Updates Client.get() and Client.get_samples_aggregate() to emit distinct metric names.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread datareservoirio/client.py
Comment thread datareservoirio/client.py
branislav-jenco-4ss and others added 3 commits August 21, 2026 11:46
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment thread datareservoirio/client.py
"elapsed": elapsed_time,
"number-of-samples": number_of_samples,
}
metric().info(metric_name, extra=properties)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

NIT: another suggestion - put the function name to custom properties. So that the trace name in App Insights will be the same, but the exact function could be extracted from the properties.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah it's a valid point, I'd definitely go that route if there were other "Timer"s but since it's just these two anyway, I'm inclined to keep it as is for now :)

@branislav-jenco-4ss
branislav-jenco-4ss merged commit 2b08e31 into master Aug 21, 2026
12 checks passed
@branislav-jenco-4ss
branislav-jenco-4ss deleted the ESS-4327 branch August 21, 2026 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants