Skip to content

Commit

Permalink
Merge pull request #6 from kubefirst/fix-transmit
Browse files Browse the repository at this point in the history
fix transmit from metrics client
  • Loading branch information
jarededwards authored Oct 22, 2023
2 parents 3e17c84 + fd9ee65 commit 1a46f5c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
10 changes: 0 additions & 10 deletions .github/workflows/public-ecr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,3 @@ jobs:
context: "{{defaultContext}}"
push: true
tags: public.ecr.aws/kubefirst/metrics-client:${{ github.ref_name }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
11 changes: 5 additions & 6 deletions cmd/transmit.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ var transmitCmd = &cobra.Command{
Long: `transmit a metric`,
Run: func(cmd *cobra.Command, args []string) {
// Telemetry handler

kubefirstVersion := os.Getenv("KUBEFIRST_VERSION")
if kubefirstVersion == "" {
kubefirstVersion = "development"
Expand All @@ -47,14 +46,14 @@ var transmitCmd = &cobra.Command{
}
machineID, _ := machineid.ID()

segmentClient := telemetry.SegmentClient{
segmentClient := &telemetry.SegmentClient{
TelemetryEvent: telemetry.TelemetryEvent{
CliVersion: os.Getenv("CLI_VERSION"),
CliVersion: os.Getenv("KUBEFIRST_VERSION"),
CloudProvider: os.Getenv("CLOUD_PROVIDER"),
ClusterID: os.Getenv("CLUSTER_ID"),
ClusterType: os.Getenv("CLUSTER_TYPE"),
DomainName: strippedDomainName,
ErrorMessage: err.Error(),
ErrorMessage: "",
GitProvider: os.Getenv("GIT_PROVIDER"),
InstallMethod: os.Getenv("INSTALL_METHOD"),
KubefirstClient: os.Getenv("KUBEFIRST_CLIENT"),
Expand All @@ -72,15 +71,15 @@ var transmitCmd = &cobra.Command{
switch transmitType {
case "cluster-zero":
//started event
err := telemetry.SendEvent(&segmentClient, telemetry.ClusterInstallStarted, "")
err := telemetry.SendEvent(segmentClient, telemetry.ClusterInstallStarted, "")
if err != nil {
log.Error(err)
}
log.Infof("metrics transmitted: %s", segmentClient.TelemetryEvent.MetricName)

//completed event
segmentClient.TelemetryEvent.MetricName = telemetry.ClusterInstallCompleted
err = telemetry.SendEvent(&segmentClient, telemetry.ClusterInstallCompleted, err.Error())
err = telemetry.SendEvent(segmentClient, telemetry.ClusterInstallCompleted, "")
if err != nil {
log.Error(err)
}
Expand Down

0 comments on commit 1a46f5c

Please sign in to comment.