-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve metric test helpers for instrumentation #872
Comments
Will take it |
Found quite nice test implemetations here, so it could be just moving things around (to make this hierarchical correct) and small tests refactor to do proper checks On the other hand we could instrument mockMeter with Output, but the more I dig, the more it seems to be unnecessary What you would say @jmacd @Aneurysm9 ? |
@AndrewGrachov are you still working on this? |
Got stuck. Really dont see a good way to implement it via sdk/test.Output - its heavily dependent on counter names, e.g. using suffixes to do aggregation checks, which irrelevant when testing instrumentation So I guess we could just expose test helpers from mock meter, which do assertion, and re-use them. Will send a PR today/tomorrow, for that I have clear view |
left a concept here https://github.com/open-telemetry/opentelemetry-go/pull/1040/files |
* Make metric test helpers public * Move everything metric test related to api/metric/metrictest * Unify metric measurement assertions Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Make metric test helpers public * Move everything metric test related to api/metric/metrictest * Unify metric measurement assertions Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Re-opening this issue for its original purpose, to remove the two TODOs marked #872. |
There is a test helper in
internal/metric
used by a few of the tests in this repository. They're not great tests from a readability standpoint, but this is the only facility provided to test instrumentation with a mock Meter.There is a better test helper used internally in a number of tests,
sdk/metric/processor/test.Output
, which makes for reasonably concise and readable tests. Something similar should be provided for testing metrics, probably outside of theinternal
directory so that it can be used for testing external code.As part of this ticket, improve the testing in
instrumentation/othttp/handler_test.go
as discussed here.The text was updated successfully, but these errors were encountered: