99
1010 "github.com/gin-gonic/gin"
1111 "github.com/google/uuid"
12- "github.com/posthog/posthog-go"
1312
1413 "github.com/e2b-dev/infra/packages/api/internal/api"
1514 "github.com/e2b-dev/infra/packages/api/internal/clusters"
@@ -141,6 +140,14 @@ func (a *APIStore) PostVolumes(c *gin.Context) {
141140 return
142141 }
143142
143+ a .posthog .IdentifyAnalyticsTeam (ctx , team .ID .String (), team .Name )
144+ properties := a .posthog .GetPackageToPosthogProperties (& c .Request .Header )
145+ a .posthog .CreateAnalyticsTeamEvent (ctx , team .ID .String (), "created_volume" , properties .
146+ Set ("volume_id" , volume .ID .String ()).
147+ Set ("volume_name" , volume .Name ).
148+ Set ("volume_type" , volumeType ),
149+ )
150+
144151 token , err := generateVolumeContentToken (a .config .VolumesToken , volume , team )
145152 if err != nil {
146153 a .sendAPIStoreError (c , http .StatusInternalServerError , "Volume created, but failed to generate volume content token" )
@@ -149,12 +156,6 @@ func (a *APIStore) PostVolumes(c *gin.Context) {
149156 return
150157 }
151158
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-
158159 result := api.VolumeAndToken {
159160 VolumeID : volume .ID .String (),
160161 Name : volume .Name ,
0 commit comments