Explorar o código

Fix misspelling of instantiate participles (#1759)

Sean Kelly %!s(int64=2) %!d(string=hai) anos
pai
achega
568eb1d4e0

+ 2 - 2
cmd/crowdsec-cli/metrics.go

@@ -173,7 +173,7 @@ func FormatPrometheusMetric(url string, formatType string) ([]byte, error) {
 				if _, ok := buckets_stats[name]; !ok {
 					buckets_stats[name] = make(map[string]int)
 				}
-				buckets_stats[name]["instanciation"] += ival
+				buckets_stats[name]["instantiation"] += ival
 			case "cs_buckets":
 				if _, ok := buckets_stats[name]; !ok {
 					buckets_stats[name] = make(map[string]int)
@@ -296,7 +296,7 @@ func FormatPrometheusMetric(url string, formatType string) ([]byte, error) {
 		}
 		bucketsTable := tablewriter.NewWriter(ret)
 		bucketsTable.SetHeader([]string{"Bucket", "Current Count", "Overflows", "Instantiated", "Poured", "Expired"})
-		keys = []string{"curr_count", "overflow", "instanciation", "pour", "underflow"}
+		keys = []string{"curr_count", "overflow", "instantiation", "pour", "underflow"}
 		if err := metricsToTable(bucketsTable, buckets_stats, keys); err != nil {
 			log.Warningf("while collecting acquis stats : %s", err)
 		}

+ 5 - 5
cmd/crowdsec-cli/utils.go

@@ -432,7 +432,7 @@ func GetParserMetric(url string, itemName string) map[string]map[string]int {
 func GetScenarioMetric(url string, itemName string) map[string]int {
 	stats := make(map[string]int)
 
-	stats["instanciation"] = 0
+	stats["instantiation"] = 0
 	stats["curr_count"] = 0
 	stats["overflow"] = 0
 	stats["pour"] = 0
@@ -467,7 +467,7 @@ func GetScenarioMetric(url string, itemName string) map[string]int {
 
 			switch fam.Name {
 			case "cs_bucket_created_total":
-				stats["instanciation"] += ival
+				stats["instantiation"] += ival
 			case "cs_buckets":
 				stats["curr_count"] += ival
 			case "cs_bucket_overflowed_total":
@@ -544,12 +544,12 @@ func GetPrometheusMetric(url string) []*prom2json.Family {
 }
 
 func ShowScenarioMetric(itemName string, metrics map[string]int) {
-	if metrics["instanciation"] == 0 {
+	if metrics["instantiation"] == 0 {
 		return
 	}
 	table := tablewriter.NewWriter(os.Stdout)
-	table.SetHeader([]string{"Current Count", "Overflows", "Instanciated", "Poured", "Expired"})
-	table.Append([]string{fmt.Sprintf("%d", metrics["curr_count"]), fmt.Sprintf("%d", metrics["overflow"]), fmt.Sprintf("%d", metrics["instanciation"]), fmt.Sprintf("%d", metrics["pour"]), fmt.Sprintf("%d", metrics["underflow"])})
+	table.SetHeader([]string{"Current Count", "Overflows", "Instantiated", "Poured", "Expired"})
+	table.Append([]string{fmt.Sprintf("%d", metrics["curr_count"]), fmt.Sprintf("%d", metrics["overflow"]), fmt.Sprintf("%d", metrics["instantiation"]), fmt.Sprintf("%d", metrics["pour"]), fmt.Sprintf("%d", metrics["underflow"])})
 
 	fmt.Printf(" - (Scenario) %s: \n", itemName)
 	table.Render()

+ 2 - 2
cmd/crowdsec/metrics.go

@@ -158,7 +158,7 @@ func registerPrometheus(config *csconfig.PrometheusCfg) {
 		log.Infof("Loading aggregated prometheus collectors")
 		prometheus.MustRegister(globalParserHits, globalParserHitsOk, globalParserHitsKo,
 			globalCsInfo, globalParsingHistogram, globalPourHistogram,
-			leaky.BucketsUnderflow, leaky.BucketsCanceled, leaky.BucketsInstanciation, leaky.BucketsOverflow,
+			leaky.BucketsUnderflow, leaky.BucketsCanceled, leaky.BucketsInstantiation, leaky.BucketsOverflow,
 			v1.LapiRouteHits,
 			leaky.BucketsCurrentCount)
 	} else {
@@ -167,7 +167,7 @@ func registerPrometheus(config *csconfig.PrometheusCfg) {
 			parser.NodesHits, parser.NodesHitsOk, parser.NodesHitsKo,
 			globalCsInfo, globalParsingHistogram, globalPourHistogram,
 			v1.LapiRouteHits, v1.LapiMachineHits, v1.LapiBouncerHits, v1.LapiNilDecisions, v1.LapiNonNilDecisions, v1.LapiResponseTime,
-			leaky.BucketsPour, leaky.BucketsUnderflow, leaky.BucketsCanceled, leaky.BucketsInstanciation, leaky.BucketsOverflow, leaky.BucketsCurrentCount,
+			leaky.BucketsPour, leaky.BucketsUnderflow, leaky.BucketsCanceled, leaky.BucketsInstantiation, leaky.BucketsOverflow, leaky.BucketsCurrentCount,
 			globalActiveDecisions, globalAlerts)
 
 	}

+ 3 - 3
pkg/leakybucket/bucket.go

@@ -104,10 +104,10 @@ var BucketsUnderflow = prometheus.NewCounterVec(
 	[]string{"name"},
 )
 
-var BucketsInstanciation = prometheus.NewCounterVec(
+var BucketsInstantiation = prometheus.NewCounterVec(
 	prometheus.CounterOpts{
 		Name: "cs_bucket_created_total",
-		Help: "Total buckets were instanciated.",
+		Help: "Total buckets were instantiated.",
 	},
 	[]string{"name"},
 )
@@ -151,7 +151,7 @@ func FromFactory(bucketFactory BucketFactory) *Leaky {
 	} else {
 		limiter = rate.NewLimiter(rate.Every(bucketFactory.leakspeed), bucketFactory.Capacity)
 	}
-	BucketsInstanciation.With(prometheus.Labels{"name": bucketFactory.Name}).Inc()
+	BucketsInstantiation.With(prometheus.Labels{"name": bucketFactory.Name}).Inc()
 
 	//create the leaky bucket per se
 	l := &Leaky{

+ 1 - 1
pkg/leakybucket/manager_load.go

@@ -67,7 +67,7 @@ type BucketFactory struct {
 	output          bool                      //??
 	ScenarioVersion string                    `yaml:"version,omitempty"`
 	hash            string                    `yaml:"-"`
-	Simulated       bool                      `yaml:"simulated"` //Set to true if the scenario instanciating the bucket was in the exclusion list
+	Simulated       bool                      `yaml:"simulated"` //Set to true if the scenario instantiating the bucket was in the exclusion list
 	tomb            *tomb.Tomb                `yaml:"-"`
 	wgPour          *sync.WaitGroup           `yaml:"-"`
 	wgDumpState     *sync.WaitGroup           `yaml:"-"`

+ 1 - 1
pkg/leakybucket/timemachine.go

@@ -46,7 +46,7 @@ func TimeMachinePour(l *Leaky, msg types.Event) {
 
 func NewTimeMachine(g BucketFactory) *Leaky {
 	l := NewLeaky(g)
-	g.logger.Tracef("Instanciating timeMachine bucket")
+	g.logger.Tracef("Instantiating timeMachine bucket")
 	l.Pour = TimeMachinePour
 	l.Mode = TIMEMACHINE
 	return l