Skip to content
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

chore: stop v1 analytics - cli-569 #5568

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions cliv2/cmd/cliv2/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,29 +227,6 @@ func getErrorFromWorkFlowData(engine workflow.Engine, data []workflow.Data) erro
return nil
}

func sendAnalytics(analytics analytics.Analytics, debugLogger *zerolog.Logger) {
debugLogger.Print("Sending Analytics")

res, err := analytics.Send()
if err != nil {
debugLogger.Err(err).Msg("Failed to send Analytics")
return
}
defer res.Body.Close()

successfullySend := 200 <= res.StatusCode && res.StatusCode < 300
if successfullySend {
debugLogger.Print("Analytics successfully send")
} else {
var details string
if res != nil {
details = res.Status
}

debugLogger.Print("Failed to send Analytics:", details)
}
}

func sendInstrumentation(eng workflow.Engine, instrumentor analytics.InstrumentationCollector, logger *zerolog.Logger) {
// Avoid duplicate data to be sent for IDE integrations that use the CLI
if !shallSendInstrumentation(eng.GetConfiguration(), instrumentor) {
Expand Down Expand Up @@ -577,10 +554,6 @@ func MainWithErrorCode() int {
if exitCode == 2 {
cliAnalytics.GetInstrumentation().SetStatus(analytics.Failure)
}

if !globalConfiguration.GetBool(configuration.ANALYTICS_DISABLED) {
sendAnalytics(cliAnalytics, globalLogger)
}
sendInstrumentation(globalEngine, cliAnalytics.GetInstrumentation(), globalLogger)

// cleanup resources in use
Expand Down
9 changes: 3 additions & 6 deletions src/lib/analytics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import stripAnsi = require('strip-ansi');
import { getAuthHeader, someTokenExists } from '../api-token';
import config from '../config';
import { makeRequest } from '../request';
import { config as userConfig } from '../user-config';
// import { config as userConfig } from '../user-config';
sandor-trombitas marked this conversation as resolved.
Show resolved Hide resolved
import { getStandardData } from './getStandardData';

// Add flags whose values should be redacted in analytics here.
Expand Down Expand Up @@ -56,11 +56,8 @@ export function addDataAndSend(
}

export function allowAnalytics(): boolean {
if (userConfig.get('disable-analytics') || config.DISABLE_ANALYTICS) {
return false;
} else {
return true;
}
// Analytics disabled until we can migrate to v2 analytics
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: I'm not sure this comment makes sense :) maybe just remove it

return false;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion test/jest/acceptance/analytics.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { getServerPort } from '../util/getServerPort';

jest.setTimeout(1000 * 30);

describe('analytics module', () => {
describe.skip('analytics module', () => {
let server;
let env: Record<string, string>;
const port = getServerPort(process);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { getServerPort } from '../../util/getServerPort';

jest.setTimeout(1000 * 30);

describe('analytics module', () => {
describe.skip('analytics module', () => {
let server;
let env: Record<string, string>;

Expand Down
2 changes: 1 addition & 1 deletion test/jest/unit/lib/analytics/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as request from '../../../../../src/lib/request';
import { argsFrom } from './utils';
import * as apiTokenModule from '../../../../../src/lib/api-token';

describe('analytics module', () => {
describe.skip('analytics module', () => {
sandor-trombitas marked this conversation as resolved.
Show resolved Hide resolved
afterEach(() => {
jest.restoreAllMocks();
});
Expand Down
Loading