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

[chore] make update-otel #14702

Merged
merged 5 commits into from
Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove usage of Clone
  • Loading branch information
Alex Boten committed Oct 5, 2022
commit 016d7a2b5f17bd17db43e9478ee30fecbcf4fa06
4 changes: 3 additions & 1 deletion internal/scrapertest/compare.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ type CompareOption interface {
}

func CompareMetrics(expected, actual pmetric.Metrics, options ...CompareOption) error {
expected, actual = expected.Clone(), actual.Clone()
exp, act := pmetric.NewMetrics(), pmetric.NewMetrics()
expected.CopyTo(exp)
actual.CopyTo(act)

for _, option := range options {
option.apply(expected, actual)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,8 @@ type metricsAdjusterTest struct {
func runScript(t *testing.T, ma MetricsAdjuster, job, instance string, tests []*metricsAdjusterTest) {
for _, test := range tests {
t.Run(test.description, func(t *testing.T) {
adjusted := test.metrics.Clone()
adjusted := pmetric.NewMetrics()
test.metrics.CopyTo(adjusted)
// Add the instance/job to the input metrics.
adjusted.ResourceMetrics().At(0).Resource().Attributes().PutString(semconv.AttributeServiceInstanceID, instance)
adjusted.ResourceMetrics().At(0).Resource().Attributes().PutString(semconv.AttributeServiceName, job)
Expand Down