tangerineyu opened a new pull request, #3665:
URL: https://github.com/apache/dubbo-go/pull/3665
## Description
This PR improves the comments and test coverage of metrics/options.go and
metrics/rpc/error_classifier.go.
- Comments the Options type and all the WithXxx option functions with their
effect and default behavior:
- aggregation (bucketNum, timeWindowSeconds)
- prometheus protocol, exporter, pushgateway (baseUrl, job, username,
password, pushInterval)
- config-center/metadata/registry metrics switches
- port, path
- probe (liveness/readiness/startup paths, useInternalState)
- Refactors the option tests to table-driven subtests (TestNewOptions,
TestBoolFlagOptions, TestStringFieldOptions, TestIntFieldOptions,
TestWithProbeUseInternalState)
- Adds Go doc comments for the error classifier explaining the
classification semantics (each ErrorType mapped from triple protocol error
codes, fallback to ErrorTypeUnknown)
- Adds table-driven tests for the error classifier covering:
- nil errors (including typed nil)
- boundary errors (context errors, errors without Unwrap, unmapped codes,
empty message)
- wrapped errors (single/multi-level %w)
Refs [OSPP] 补齐 Dubbo-Go 注释与单测覆盖 #3644 (task1)
## 本地验证
~/gogogo/dubbo-go$ gofmt -l metrics/ # 无输出
~/gogogo/dubbo-go$ go vet ./metrics/...
~/gogogo/dubbo-go$ go test ./metrics/...
ok dubbo.apache.org/dubbo-go/v3/metrics 0.005s
? dubbo.apache.org/dubbo-go/v3/metrics/app_info [no test files]
ok dubbo.apache.org/dubbo-go/v3/metrics/config_center 0.003s
ok dubbo.apache.org/dubbo-go/v3/metrics/metadata 0.003s
ok dubbo.apache.org/dubbo-go/v3/metrics/probe 0.021s
ok dubbo.apache.org/dubbo-go/v3/metrics/prometheus 2.033s
ok dubbo.apache.org/dubbo-go/v3/metrics/registry 0.006s
ok dubbo.apache.org/dubbo-go/v3/metrics/rpc 0.013s
ok dubbo.apache.org/dubbo-go/v3/metrics/util/aggregate 4.510s
## Checklist
- [ ] I confirm the target branch is develop
- [ ] Code has passed local testing
- [ ] I have added tests that prove my fix is effective or that my feature
works
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]