Skip to content

Commit efd450f

Browse files
authored
send block creation events for sub-blocks as well (#3247)
need to understand vdom usage
1 parent c2a17e7 commit efd450f

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ aiplans/
2121
manifests/
2222
.env
2323
out
24+
.kilocode/package-lock.json
2425

2526
# Yarn Modern
2627
.pnp.*

pkg/telemetry/telemetrydata/telemetrydata.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ type TEventProps struct {
122122

123123
BlockView string `json:"block:view,omitempty"`
124124
BlockController string `json:"block:controller,omitempty"`
125+
BlockSubBlock bool `json:"block:subblock,omitempty"`
125126

126127
AiBackendType string `json:"ai:backendtype,omitempty"`
127128
AiLocal bool `json:"ai:local,omitempty"`

pkg/wcore/block.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ func CreateSubBlock(ctx context.Context, blockId string, blockDef *waveobj.Block
3232
if err != nil {
3333
return nil, fmt.Errorf("error creating sub block: %w", err)
3434
}
35+
blockView := blockDef.Meta.GetString(waveobj.MetaKey_View, "")
36+
blockController := blockDef.Meta.GetString(waveobj.MetaKey_Controller, "")
37+
go recordBlockCreationTelemetry(blockView, blockController, true)
3538
return blockData, nil
3639
}
3740

@@ -100,12 +103,12 @@ func CreateBlockWithTelemetry(ctx context.Context, tabId string, blockDef *waveo
100103
if recordTelemetry {
101104
blockView := blockDef.Meta.GetString(waveobj.MetaKey_View, "")
102105
blockController := blockDef.Meta.GetString(waveobj.MetaKey_Controller, "")
103-
go recordBlockCreationTelemetry(blockView, blockController)
106+
go recordBlockCreationTelemetry(blockView, blockController, false)
104107
}
105108
return blockData, nil
106109
}
107110

108-
func recordBlockCreationTelemetry(blockView string, blockController string) {
111+
func recordBlockCreationTelemetry(blockView string, blockController string, subBlock bool) {
109112
defer func() {
110113
panichandler.PanicHandler("CreateBlock:telemetry", recover())
111114
}()
@@ -122,6 +125,7 @@ func recordBlockCreationTelemetry(blockView string, blockController string) {
122125
Props: telemetrydata.TEventProps{
123126
BlockView: blockView,
124127
BlockController: blockController,
128+
BlockSubBlock: subBlock,
125129
},
126130
})
127131
}

0 commit comments

Comments
 (0)