Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Resource per metric #224

Merged
merged 5 commits into from
Sep 18, 2019
Merged

Conversation

rghetia
Copy link
Contributor

@rghetia rghetia commented Sep 18, 2019

added test for

  • per metric resource
  • built-in metrics
  • metric prefix.

@codecov-io
Copy link

codecov-io commented Sep 18, 2019

Codecov Report

Merging #224 into master will increase coverage by 0.37%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #224      +/-   ##
==========================================
+ Coverage   73.02%   73.39%   +0.37%     
==========================================
  Files          15       15              
  Lines        1609     1609              
==========================================
+ Hits         1175     1181       +6     
+ Misses        355      351       -4     
+ Partials       79       77       -2
Impacted Files Coverage Δ
stats.go 78.33% <0%> (+0.89%) ⬆️
metrics_proto.go 88.62% <0%> (+0.89%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 76f086b...cbdec48. Read the comment docs.

Copy link
Contributor

@songy23 songy23 left a comment

Choose a reason for hiding this comment

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

Some minor nits, otherwise LGTM.

@@ -85,6 +86,74 @@ func TestVariousCasesFromFile(t *testing.T) {
}
}

func TestMetricsWithPrefix(t *testing.T) {
server, addr, doneFn := createFakeServer(t)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: looks like these few lines appear multiple times. How about having a func createFakeServerAndConn that returns both the server and connection? The returned doneFn can incorporate conn.Close() too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.


tc := readTestCaseFromFiles(t, "SingleMetric")

prefixes := []string{
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: can also test "external.googleapis.com/prometheus/".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

- also modify createFakeServer to return server and connectio
stop := func() {
srv.Stop()
_ = ln.Close()
conn.Close()
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I think conn needs to be closed first.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes. fixed it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants