forked from flyteorg/flyte
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A new metrics scope per plugin is created (flyteorg#393)
* A new metrics scope per plugin is created Signed-off-by: Ketan Umare <[email protected]> * updated setup context Signed-off-by: Ketan Umare <[email protected]> * added unit test Signed-off-by: Ketan Umare <[email protected]>
- Loading branch information
Showing
3 changed files
with
36 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package task | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/flyteorg/flyteplugins/go/tasks/pluginmachinery/core/mocks" | ||
"github.com/flyteorg/flytepropeller/pkg/controller/nodes/handler" | ||
"github.com/flyteorg/flytestdlib/promutils" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
type dummySetupCtx struct { | ||
handler.SetupContext | ||
testScopeName string | ||
} | ||
|
||
func (d dummySetupCtx) MetricsScope() promutils.Scope { | ||
return promutils.NewScope(d.testScopeName) | ||
} | ||
|
||
func Test_nameSpacedSetupCtx_MetricsScope(t *testing.T) { | ||
r := &mocks.ResourceRegistrar{} | ||
ns := newNameSpacedSetupCtx(&setupContext{SetupContext: &dummySetupCtx{testScopeName: "test-scope-1"}}, r, "p1") | ||
scope := ns.MetricsScope() | ||
assert.NotNil(t, scope) | ||
assert.Equal(t, "test-scope-1:p1:", scope.CurrentScope()) | ||
} |