-
Notifications
You must be signed in to change notification settings - Fork 557
fix: [1122][EA]send installation event to posthog #1200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| EventMessage string `json:"eventMessage,omitempty"` | ||
| EventType TelemetryEventType `json:"eventType"` | ||
| Summary *SummaryDto `json:"summary,omitempty"` | ||
| Summary SummaryEA `json:"summary,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use pointer
| return nil, err | ||
| } | ||
|
|
||
| client, err := impl.K8sUtil.GetClientForInCluster() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix it for local dev
|
|
||
| if impl.PosthogClient.Client == nil { | ||
| impl.logger.Warn("no posthog client found, creating new") | ||
| client, err := impl.retryPosthogClient(PosthogApiKey, PosthogEndpoint) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add error handling
| if err != nil { | ||
| impl.logger.Warnw("config map update failed for install event", "err", err) | ||
| } | ||
| if err == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use else
cmd/external-app/wire.go
Outdated
| dashboard.DashboardWireSet, | ||
| client.HelmAppWireSet, | ||
| k8s.K8sApplicationWireSet, | ||
| //telemetry.NewTelemetryEventClientWireSet, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
create wire set
internal/util/K8sUtil.go
Outdated
| if err != nil { | ||
| return nil | ||
| } | ||
| kubeconfig := flag.String("kubeconfig-authenticator-xyz", filepath.Join(usr.HomeDir, ".kube", "config"), "(optional) absolute path to the kubeconfig file") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
create kubeconfig only when runTimeConfig is localDev
cmd/external-app/externalApp.go
Outdated
|
|
||
| server *http.Server | ||
| server *http.Server | ||
| telemetry *telemetry.TelemetryEventClientImpl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use interface as dependency not the impl
cmd/external-app/externalApp.go
Outdated
| _, err := app.telemetry.SendTelemtryInstallEventEA() | ||
|
|
||
| if err != nil { | ||
| app.Logger.Infow("telemetry installation success event failed", "err", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log it as warn
| type SummaryEA struct { | ||
| UserCount int `json:"userCount,omitempty"` | ||
| ClusterCount int `json:"clusterCount,omitempty"` | ||
| DevtronVersion string `json:"devtronVersion,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DevtronVersion and DevtronMode are more suitable in outer object
Description
Sending installation event and summary for EA mode also
Cause: For EA mode there is no inception which handles and pushes this events to PostHog server
CounterMeasure: We have added events which will be called on installation, periodically(for summary events)
Fixes # (issue) 1122
Type of change
How Has This Been Tested?
Test case A: Tested it by installing EA mode (Updated PostHog API key value to send events to mine) and have seen the events send to my PostHog server and also checked again re-running the pod which will not send the event as we store the value in config map and ignore if it is already sent
Test case B: Tested by sending Summary Events also, those events were also sent to the server
Checklist: