Commit 0dd9a53
fix(spanner): disable metrics tracer when built-in metrics are disabled (#8170)
* fix(spanner): disable metrics tracer when built-in metrics are disabled
Ensure MetricsTracerFactory starts disabled and is synchronized with the built-in metrics configuration. This prevents MetricsTracer instances from being created when metrics are disabled via client options, environment, or insecure credentials.
* fix(spanner): honor disabled built-in metrics per client
Track built-in metrics enablement on each Spanner instance and use it to guard metric interceptors and MetricsTracer creation. This prevents clients that explicitly disable built-in metrics from creating or retaining metrics tracers without mutating global MetricsTracerFactory state for other clients.
* 🦉 Updates from OwlBot post-processor
See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md
* fix(spanner): include insecure credentials in metrics guard
Update the per-instance metrics flag to include insecure credentials so metric interceptors and tracers are not created when built-in metrics are disabled for that client. Keep the mock metrics tests using an explicit in-memory metrics override because they intentionally run against insecure test credentials.
* fix(spanner): simplify disabled metrics guard
Default MetricsTracerFactory.enabled to false so tracer creation stays disabled until metrics configuration explicitly enables the singleton factory.
* Revert "fix(spanner): simplify disabled metrics guard"
This reverts commit 8bc203e.
* fix(spanner): sync metrics factory enablement before setup
Move MetricsTracerFactory.enabled assignment outside the metrics setup branch so explicitly disabled or insecure clients update the singleton guard before any request path can create metrics tracers.
---------
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>1 parent 9e91cc8 commit 0dd9a53
3 files changed
Lines changed: 21 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
325 | 325 | | |
326 | 326 | | |
327 | 327 | | |
| 328 | + | |
328 | 329 | | |
329 | 330 | | |
330 | 331 | | |
| |||
1626 | 1627 | | |
1627 | 1628 | | |
1628 | 1629 | | |
1629 | | - | |
1630 | | - | |
1631 | | - | |
1632 | | - | |
1633 | | - | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
| 1636 | + | |
1634 | 1637 | | |
1635 | 1638 | | |
1636 | 1639 | | |
| |||
1642 | 1645 | | |
1643 | 1646 | | |
1644 | 1647 | | |
1645 | | - | |
1646 | 1648 | | |
1647 | 1649 | | |
1648 | 1650 | | |
| |||
1728 | 1730 | | |
1729 | 1731 | | |
1730 | 1732 | | |
1731 | | - | |
| 1733 | + | |
1732 | 1734 | | |
1733 | 1735 | | |
1734 | 1736 | | |
| |||
1811 | 1813 | | |
1812 | 1814 | | |
1813 | 1815 | | |
1814 | | - | |
| 1816 | + | |
| 1817 | + | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
1815 | 1821 | | |
1816 | 1822 | | |
1817 | 1823 | | |
| |||
1875 | 1881 | | |
1876 | 1882 | | |
1877 | 1883 | | |
1878 | | - | |
| 1884 | + | |
| 1885 | + | |
| 1886 | + | |
| 1887 | + | |
| 1888 | + | |
1879 | 1889 | | |
1880 | 1890 | | |
1881 | 1891 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
339 | 339 | | |
340 | 340 | | |
341 | 341 | | |
342 | | - | |
343 | | - | |
| 342 | + | |
344 | 343 | | |
345 | 344 | | |
346 | 345 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
| 167 | + | |
167 | 168 | | |
168 | 169 | | |
169 | 170 | | |
| |||
0 commit comments