Skip to content
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

Create an Inmemory Exporter for test #2776

Merged
merged 14 commits into from
Apr 24, 2022

Conversation

MadVikingGod
Copy link
Contributor

This change creates an in-memory exporter for use in tests.

Closes: #2722

This affects a number of instruments in the contrib repo. An example of what this can re-enable is: MadVikingGod/opentelemetry-go-contrib@1e9dd43

sdk/metric/metrictest/exporter.go Outdated Show resolved Hide resolved
sdk/metric/metrictest/exporter_test.go Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Apr 11, 2022

Codecov Report

Merging #2776 (fea1be2) into main (c05c3e2) will increase coverage by 0.0%.
The diff coverage is 70.5%.

Impacted file tree graph

@@          Coverage Diff           @@
##            main   #2776    +/-   ##
======================================
  Coverage   75.7%   75.7%            
======================================
  Files        178     180     +2     
  Lines      11707   11818   +111     
======================================
+ Hits        8864    8951    +87     
- Misses      2618    2634    +16     
- Partials     225     233     +8     
Impacted Files Coverage Δ
sdk/metric/metrictest/exporter.go 68.0% <68.0%> (ø)
sdk/metric/metrictest/config.go 82.3% <82.3%> (ø)
sdk/metric/aggregator/aggregatortest/test.go 81.0% <100.0%> (ø)
sdk/trace/batch_span_processor.go 81.1% <0.0%> (+0.9%) ⬆️
sdk/metric/sdkapi/wrap.go 92.8% <0.0%> (+8.3%) ⬆️

@MrAlias MrAlias added this to the Release v1.7.0 milestone Apr 14, 2022
sdk/metric/metrictest/exporter.go Outdated Show resolved Hide resolved
sdk/metric/metrictest/exporter.go Outdated Show resolved Hide resolved
sdk/metric/metrictest/exporter.go Outdated Show resolved Hide resolved
sdk/metric/metrictest/exporter.go Show resolved Hide resolved
sdk/metric/aggregator/aggregatortest/test.go Show resolved Hide resolved
sdk/metric/metrictest/exporter.go Outdated Show resolved Hide resolved
sdk/metric/metrictest/exporter.go Outdated Show resolved Hide resolved
sdk/metric/metrictest/exporter.go Outdated Show resolved Hide resolved
sdk/metric/metrictest/exporter.go Outdated Show resolved Hide resolved
sdk/metric/metrictest/exporter.go Outdated Show resolved Hide resolved
Copy link
Contributor

@dashpole dashpole left a comment

Choose a reason for hiding this comment

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

This looks good, and is definitely a useful starting point.

Having used prometheus a bunch for metrics, i've come to really like the GatherAndCompare (to a file) approach for testing. Its nice to have metrics represented in files if I need to do a large number of assertions about my metrics. It would be neat to be able to make assertions against a json OTLP file or something. Or, I guess, I can just use the prom exporter with GatherAndCompare to meet my use-case :)...

CHANGELOG.md Outdated Show resolved Hide resolved
sdk/metric/metrictest/config.go Outdated Show resolved Hide resolved
sdk/metric/metrictest/exporter.go Outdated Show resolved Hide resolved
sdk/metric/metrictest/exporter.go Outdated Show resolved Hide resolved
sdk/metric/metrictest/exporter_test.go Outdated Show resolved Hide resolved
sdk/metric/metrictest/exporter_test.go Outdated Show resolved Hide resolved
sdk/metric/aggregator/aggregatortest/test.go Show resolved Hide resolved
sdk/metric/metrictest/exporter.go Show resolved Hide resolved
sdk/metric/metrictest/exporter.go Outdated Show resolved Hide resolved
MadVikingGod and others added 2 commits April 22, 2022 07:44
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
CHANGELOG.md Outdated Show resolved Hide resolved
@MrAlias MrAlias merged commit 8982a14 into open-telemetry:main Apr 24, 2022
This was referenced Apr 26, 2022
@MadVikingGod MadVikingGod deleted the mvg/inmemeory branch February 21, 2023 19:57
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.

In-memory metrics exporter for tests
5 participants