Skip to content

Commit 44bddeb

Browse files
authored
Merge branch 'main' into feat/busybox-download-from-release
2 parents 34ad297 + 705fba8 commit 44bddeb

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

packages/api/internal/handlers/sandbox.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,19 @@ func (a *APIStore) startSandboxInternal(
110110
props = props.Set("mcp_servers", slices.Collect(maps.Keys(mcp)))
111111
}
112112

113+
if len(sbx.VolumeMounts) > 0 {
114+
volumeNames := make([]string, 0, len(sbx.VolumeMounts))
115+
volumeIDs := make([]string, 0, len(sbx.VolumeMounts))
116+
for _, vol := range sbx.VolumeMounts {
117+
volumeNames = append(volumeNames, vol.Name)
118+
volumeIDs = append(volumeIDs, vol.ID)
119+
}
120+
props = props.
121+
Set("volume_names", volumeNames).
122+
Set("volume_ids", volumeIDs).
123+
Set("volume_count", len(sbx.VolumeMounts))
124+
}
125+
113126
a.posthog.CreateAnalyticsTeamEvent(ctx, team.ID.String(), "created_instance", props)
114127
analyticsSpan.End()
115128

packages/api/internal/handlers/volume_create.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99

1010
"github.com/gin-gonic/gin"
1111
"github.com/google/uuid"
12+
"github.com/posthog/posthog-go"
1213

1314
"github.com/e2b-dev/infra/packages/api/internal/api"
1415
"github.com/e2b-dev/infra/packages/api/internal/clusters"
@@ -148,6 +149,12 @@ func (a *APIStore) PostVolumes(c *gin.Context) {
148149
return
149150
}
150151

152+
a.posthog.CreateAnalyticsTeamEvent(ctx, team.ID.String(), "created_volume", posthog.NewProperties().
153+
Set("volume_id", volume.ID.String()).
154+
Set("volume_name", volume.Name).
155+
Set("volume_type", volumeType),
156+
)
157+
151158
result := api.VolumeAndToken{
152159
VolumeID: volume.ID.String(),
153160
Name: volume.Name,

packages/api/internal/handlers/volume_delete.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77

88
"github.com/gin-gonic/gin"
99
"github.com/google/uuid"
10+
"github.com/posthog/posthog-go"
1011

1112
"github.com/e2b-dev/infra/packages/api/internal/api"
1213
"github.com/e2b-dev/infra/packages/api/internal/clusters"
@@ -36,6 +37,11 @@ func (a *APIStore) DeleteVolumesVolumeID(c *gin.Context, volumeID api.VolumeID)
3637
return
3738
}
3839

40+
a.posthog.CreateAnalyticsTeamEvent(ctx, team.ID.String(), "deleted_volume", posthog.NewProperties().
41+
Set("volume_id", volume.ID.String()).
42+
Set("volume_name", volume.Name),
43+
)
44+
3945
go func(ctx context.Context) {
4046
// if this fails, we can clean it up later
4147
if err := a.deleteVolume(ctx, clusterID, volume); err != nil {

0 commit comments

Comments
 (0)