Skip to content

Commit 7d49206

Browse files
committed
updating entity name to include proto pkg prefix
1 parent 8c85b70 commit 7d49206

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

core/services/workflows/engine.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1550,6 +1550,9 @@ func emitProtoMessage(ctx context.Context, msg proto.Message) error {
15501550
return fmt.Errorf("unknown message type: %T", msg)
15511551
}
15521552

1553+
// entity must be prefixed with the proto package name
1554+
entity = fmt.Sprintf("%s.%s", EventsProtoPkg, entity)
1555+
15531556
return beholder.GetEmitter().Emit(ctx, b,
15541557
"beholder_data_schema", schema, // required
15551558
"beholder_domain", "platform", // required

core/services/workflows/engine_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,8 @@ func newTestEngine(t *testing.T, reg *coreCap.Registry, sdkSpec sdk.WorkflowSpec
259259
detail := report.Description()
260260
bClient := beholder.GetClient()
261261
// kvAttrs is what the test client matches on, view pkg/utils/test in common for more detail
262-
kvAttrs := []any{"beholder_data_schema", detail.Schema, "beholder_domain", detail.Domain, "beholder_entity", detail.Entity,
262+
kvAttrs := []any{"beholder_data_schema", detail.Schema, "beholder_domain", detail.Domain,
263+
"beholder_entity", fmt.Sprintf("%s.%s", MeteringProtoPkg, detail.Entity),
263264
platform.KeyWorkflowName, name, platform.KeyWorkflowID, ID, platform.KeyWorkflowExecutionID, execID}
264265

265266
data, mErr := proto.Marshal(report.Message())
@@ -399,11 +400,11 @@ func TestEngineWithHardcodedWorkflow(t *testing.T) {
399400

400401
assert.Equal(t, store.StatusCompleted, state.Status)
401402

402-
assert.Equal(t, 1, beholderTester.Len(t, "beholder_entity", MeteringReportEntity))
403-
assert.Equal(t, 1, beholderTester.Len(t, "beholder_entity", EventWorkflowExecutionStarted))
404-
assert.Equal(t, 1, beholderTester.Len(t, "beholder_entity", EventWorkflowExecutionFinished))
405-
assert.Equal(t, 3, beholderTester.Len(t, "beholder_entity", EventCapabilityExecutionStarted))
406-
assert.Equal(t, 3, beholderTester.Len(t, "beholder_entity", EventCapabilityExecutionFinished))
403+
assert.Equal(t, 1, beholderTester.Len(t, "beholder_entity", fmt.Sprintf("%s.%s", MeteringProtoPkg, MeteringReportEntity)))
404+
assert.Equal(t, 1, beholderTester.Len(t, "beholder_entity", fmt.Sprintf("%s.%s", EventsProtoPkg, EventWorkflowExecutionStarted)))
405+
assert.Equal(t, 1, beholderTester.Len(t, "beholder_entity", fmt.Sprintf("%s.%s", EventsProtoPkg, EventWorkflowExecutionFinished)))
406+
assert.Equal(t, 3, beholderTester.Len(t, "beholder_entity", fmt.Sprintf("%s.%s", EventsProtoPkg, EventCapabilityExecutionStarted)))
407+
assert.Equal(t, 3, beholderTester.Len(t, "beholder_entity", fmt.Sprintf("%s.%s", EventsProtoPkg, EventCapabilityExecutionFinished)))
407408
}
408409

409410
const (

core/services/workflows/events.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package workflows
22

33
const (
4+
EventsProtoPkg = "pb"
45
// EventWorkflowExecutionStarted represents a workflow execution started event
56
EventWorkflowExecutionStarted string = "WorkflowExecutionStarted"
67
// EventWorkflowExecutionFinished represents a workflow execution finished event

core/services/workflows/metering.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const (
1515
MeteringReportSchema string = "github.com/smartcontractkit/chainlink-common/pkg/capabilities/pb/capabilities.proto"
1616
MeteringReportDomain string = "platform"
1717
MeteringReportEntity string = "MeteringReport"
18+
MeteringProtoPkg string = "pb"
1819
)
1920

2021
type MeteringReportStepRef string

0 commit comments

Comments
 (0)