Skip to content

Commit

Permalink
Backport uber-go#221 and uber-go#222 to master branch (uber-go#243)
Browse files Browse the repository at this point in the history
* [bug] Ensure that parent scopes do not return closed subscopes (uber-go#221)

* TestScope: don't prune from registry when closed (uber-go#222)

* TestScope: don't prune from registry when closed (uber-go#222)

* lint fix

* move comment

* update go.mod and go.sum

* add license header

---------

Co-authored-by: Matt Way <[email protected]>
  • Loading branch information
brawndou and mway committed Jan 26, 2024
1 parent 6307cc9 commit df7b151
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
23 changes: 21 additions & 2 deletions generate.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
// Copyright (c) 2024 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

package tally

import (
//go:generate mockgen -package tallymock -destination tallymock/stats_reporter.go -imports github.com/uber-go/tally github.com/uber-go/tally StatsReporter
_ "github.com/golang/mock/mockgen/model"
)

//go:generate mockgen -package tallymock -destination tallymock/stats_reporter.go -imports github.com/uber-go/tally github.com/uber-go/tally StatsReporter
4 changes: 3 additions & 1 deletion scope.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,11 @@ type ScopeOptions struct {
Separator string
DefaultBuckets Buckets
SanitizeOptions *SanitizeOptions
registryShardCount uint
OmitCardinalityMetrics bool
CardinalityMetricsTags map[string]string

testScope bool
registryShardCount uint
}

// NewRootScope creates a new root Scope with a set of options and
Expand Down
3 changes: 2 additions & 1 deletion scope_registry_external_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ func TestNoDefunctSubscopes(t *testing.T) {
MinTimes(1)

root, _ := tally.NewRootScope(tally.ScopeOptions{
Reporter: mockreporter,
Reporter: mockreporter,
OmitCardinalityMetrics: true,
}, time.Millisecond)

subscope := root.Tagged(tags)
Expand Down

0 comments on commit df7b151

Please sign in to comment.