Skip to content

Commit

Permalink
Add isCompose file metrics to analytics (#1431)
Browse files Browse the repository at this point in the history
* Add isCompose file metrics to analytics

Signed-off-by: Javier López Barba <javier@okteto.com>

* Add isCompose to deploy stack event

Signed-off-by: Javier López Barba <javier@okteto.com>

* Add isCompose to deploy stack event

Signed-off-by: Javier López Barba <javier@okteto.com>
  • Loading branch information
jLopezbarb committed Apr 21, 2021
1 parent 99c6f2f commit 1562497
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cmd/stack/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func Deploy(ctx context.Context) *cobra.Command {
}

err = stack.Deploy(ctx, s, forceBuild, wait, noCache)
analytics.TrackDeployStack(err == nil)
analytics.TrackDeployStack(err == nil, s.IsCompose)
if err == nil {
log.Success("Stack '%s' successfully deployed", s.Name)
}
Expand Down
7 changes: 5 additions & 2 deletions pkg/analytics/analytics.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,11 @@ func TrackBuildTransientError(oktetoBuilkitURL string, success bool) {
}

// TrackDeployStack sends a tracking event to mixpanel when the user deploys a stack
func TrackDeployStack(success bool) {
track(deployStackEvent, success, nil)
func TrackDeployStack(success, isCompose bool) {
props := map[string]interface{}{
"isCompose": isCompose,
}
track(deployStackEvent, success, props)
}

// TrackDestroyStack sends a tracking event to mixpanel when the user destroys a stack
Expand Down
4 changes: 2 additions & 2 deletions pkg/model/stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var (
type Stack struct {
Manifest []byte `yaml:"-"`
Warnings []string `yaml:"-"`
isCompose bool `yaml:"-"`
IsCompose bool `yaml:"-"`
Name string `yaml:"name"`
Namespace string `yaml:"namespace,omitempty"`
Services map[string]*Service `yaml:"services,omitempty"`
Expand Down Expand Up @@ -167,7 +167,7 @@ func GetStack(name, stackPath string, isCompose bool) (*Stack, error) {
func ReadStack(bytes []byte, isCompose bool) (*Stack, error) {
s := &Stack{
Manifest: bytes,
isCompose: isCompose,
IsCompose: isCompose,
}

if err := yaml.UnmarshalStrict(bytes, s); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/model/stack_serializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func (s *Stack) UnmarshalYAML(unmarshal func(interface{}) error) error {

s.Services = make(map[string]*Service)
for svcName, svcRaw := range stackRaw.Services {
s.Services[svcName], err = svcRaw.ToService(svcName, s.isCompose)
s.Services[svcName], err = svcRaw.ToService(svcName, s.IsCompose)
if err != nil {
return err
}
Expand Down

0 comments on commit 1562497

Please sign in to comment.