Skip to content

Commit 9670ca4

Browse files
committed
update flag name and config.md
1 parent 72db048 commit 9670ca4

File tree

3 files changed

+28
-26
lines changed

3 files changed

+28
-26
lines changed

config.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
# GITSENSOR CONFIGMAP
22

3-
| Key | Value | Description |
4-
|-----------------------------------|------------------------------------|-------------------------------|
5-
| PG_ADDR | postgresql-postgresql.devtroncd | PostgreSQL Server Address |
6-
| PG_USER | postgres | PostgreSQL User |
7-
| PG_DATABASE | git_sensor | PostgreSQL Database Name |
8-
| SENTRY_ENV | prod | Sentry Environment |
9-
| SENTRY_ENABLED | "false" | Sentry Enabled (boolean) |
10-
| POLL_DURATION | "1" | Polling Duration (in seconds) |
11-
| POLL_WORKER | "2" | Number of Polling Workers |
12-
| PG_LOG_QUERY | "false" | PostgreSQL Query Logging (boolean) |
13-
| COMMIT_STATS_TIMEOUT_IN_SEC | "2" | Commit Stats Timeout (in seconds) |
14-
| ENABLE_FILE_STATS | "false" | Enable File Stats (boolean) |
15-
| GIT_HISTORY_COUNT | "15" | Git History Count |
16-
| CLONING_MODE | FULL | Cloning Mode (Possible values: SHALLOW, FULL) |
3+
| Key | Value | Description |
4+
|-----------------------------|---------------------------------|---------------------------------------------------------------------|
5+
| PG_ADDR | postgresql-postgresql.devtroncd | PostgreSQL Server Address |
6+
| PG_USER | postgres | PostgreSQL User |
7+
| PG_DATABASE | git_sensor | PostgreSQL Database Name |
8+
| SENTRY_ENV | prod | Sentry Environment |
9+
| SENTRY_ENABLED | "false" | Sentry Enabled (boolean) |
10+
| POLL_DURATION | "1" | Polling Duration (in seconds) |
11+
| POLL_WORKER | "2" | Number of Polling Workers |
12+
| PG_LOG_QUERY | "false" | PostgreSQL Query Logging (boolean) |
13+
| COMMIT_STATS_TIMEOUT_IN_SEC | "2" | Commit Stats Timeout (in seconds) |
14+
| ENABLE_FILE_STATS | "false" | Enable File Stats (boolean) |
15+
| GIT_HISTORY_COUNT | "15" | Git History Count |
16+
| CLONING_MODE | FULL | Cloning Mode (Possible values: SHALLOW, FULL) |
17+
| USE_GIT_CLI | "false" | Use git cli commands directly for all git operations |
18+
| USE_GIT_CLI_ANALYTICS | "false" | Use git cli commands directly for getting commit data for analytics |

internals/Configuration.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ package internals
1919
import "github.com/caarlos0/env"
2020

2121
type Configuration struct {
22-
CommitStatsTimeoutInSec int `env:"COMMIT_STATS_TIMEOUT_IN_SEC" envDefault:"2"`
23-
EnableFileStats bool `env:"ENABLE_FILE_STATS" envDefault:"false"`
24-
GitHistoryCount int `env:"GIT_HISTORY_COUNT" envDefault:"15"`
25-
MinLimit int `env:"MIN_LIMIT_FOR_PVC" envDefault:"1"` // in MB
26-
UseGitCli bool `env:"USE_GIT_CLI" envDefault:"false"`
27-
UseAnalyticsCommitDiffGitCli bool `env:"USE_ANALYTICS_COMMIT_DIFF_GIT_CLI" envDefault:"false"`
28-
AnalyticsDebug bool `env:"ANALYTICS_DEBUG" envDefault:"false"`
29-
CliCmdTimeoutGlobal int `env:"CLI_CMD_TIMEOUT_GLOBAL_SECONDS" envDefault:"0"`
30-
CliCmdTimeoutJson string `env:"CLI_CMD_TIMEOUT_JSON" envDefault:""`
31-
GoGitTimeout int `env:"GOGIT_TIMEOUT_SECONDS" envDefault:"10"`
22+
CommitStatsTimeoutInSec int `env:"COMMIT_STATS_TIMEOUT_IN_SEC" envDefault:"2"`
23+
EnableFileStats bool `env:"ENABLE_FILE_STATS" envDefault:"false"`
24+
GitHistoryCount int `env:"GIT_HISTORY_COUNT" envDefault:"15"`
25+
MinLimit int `env:"MIN_LIMIT_FOR_PVC" envDefault:"1"` // in MB
26+
UseGitCli bool `env:"USE_GIT_CLI" envDefault:"false"`
27+
UseGitCliAnalytics bool `env:"USE_GIT_CLI_ANALYTICS" envDefault:"false"` // This flag is used to compute commitDiff using git-cli only for analytics
28+
AnalyticsDebug bool `env:"ANALYTICS_DEBUG" envDefault:"false"`
29+
CliCmdTimeoutGlobal int `env:"CLI_CMD_TIMEOUT_GLOBAL_SECONDS" envDefault:"0"`
30+
CliCmdTimeoutJson string `env:"CLI_CMD_TIMEOUT_JSON" envDefault:""`
31+
GoGitTimeout int `env:"GOGIT_TIMEOUT_SECONDS" envDefault:"10" `
3232
}
3333

3434
func ParseConfiguration() (*Configuration, error) {

pkg/git/RepositoryManagerAnalytics.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,15 +243,15 @@ func (impl RepositoryManagerAnalyticsImpl) ChangesSinceByRepositoryForAnalytics(
243243
func (impl RepositoryManagerAnalyticsImpl) computeCommitDiff(gitCtx GitContext, checkoutPath string, oldHash plumbing.Hash, newHash plumbing.Hash, repository *GitRepository) ([]*Commit, error) {
244244
var commitsCli, commitsGoGit []*Commit
245245
var err error
246-
if impl.configuration.UseGitCli || impl.configuration.UseAnalyticsCommitDiffGitCli || impl.configuration.AnalyticsDebug {
246+
if impl.configuration.UseGitCli || impl.configuration.UseGitCliAnalytics || impl.configuration.AnalyticsDebug {
247247
impl.logger.Infow("Computing commit diff using cli ", "checkoutPath", checkoutPath)
248248
commitsCli, err = impl.gitManager.LogMergeBase(gitCtx, checkoutPath, oldHash.String(), newHash.String())
249249
if err != nil {
250250
impl.logger.Errorw("error in fetching commits for analytics through CLI: ", "err", err)
251251
return nil, err
252252
}
253253
}
254-
if !(impl.configuration.UseGitCli || impl.configuration.UseAnalyticsCommitDiffGitCli) || impl.configuration.AnalyticsDebug {
254+
if !(impl.configuration.UseGitCli || impl.configuration.UseGitCliAnalytics) || impl.configuration.AnalyticsDebug {
255255
impl.logger.Infow("Computing commit diff using go-git ", "checkoutPath", checkoutPath)
256256
ctx, cancel := gitCtx.WithTimeout(impl.configuration.GoGitTimeout)
257257
defer cancel()

0 commit comments

Comments
 (0)