Skip to content

Conversation

@billyang-arch
Copy link

自定义meterProvider,因为默认的provider中会携带service.instance.id属性,上报到prometheus的时候会自动转换为instance属性,为了避免instance属性被覆盖,所以使用自定义的meterProvider

return Globals::meterProvider()
->getMeter(config('otel.meter_name', 'overtrue.laravel-open-telemetry'));
$resourceInfo = (new Sdk)->getResource();
Metric::$meterProvider = (new MeterProviderFactory)->create($resourceInfo);
Copy link
Owner

Choose a reason for hiding this comment

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

可以考虑给 Metric 增加一个 Setter 和 Getter 方法,把属性私有,这么直接改感觉不太好

Copy link
Author

Choose a reason for hiding this comment

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

1

@overtrue overtrue merged commit bcf0a61 into overtrue:main Sep 25, 2025
3 checks passed
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