Skip to content

Commit

Permalink
Initialize success and error counters (#60)
Browse files Browse the repository at this point in the history
* Initialize success and error counters

We need to initialize success and error counters properly in order
to avoid having undefined metrics.

Closes: #59

* Add release info
  • Loading branch information
adidenko authored Nov 6, 2023
1 parent ee3de08 commit 21b0d68
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.5.1] - 2023-11-06

### Added

- Bugfix for #59

## [0.5.0] - 2023-10-11

### Added
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Minigun

[![Minigun Version](https://img.shields.io/badge/Minigun-0.5.0-7f187f.svg)](https://github.com/wayfair-incubator/minigun/blob/main/CHANGELOG.md)
[![Minigun Version](https://img.shields.io/badge/Minigun-0.5.1-7f187f.svg)](https://github.com/wayfair-incubator/minigun/blob/main/CHANGELOG.md)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.0-4baaaa.svg)](CODE_OF_CONDUCT.md)

## About The Project
Expand Down
4 changes: 1 addition & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (
)

// Constants and vars
const version = "0.5.0"
const version = "0.5.1"
const workersCannelSize = 1024
const errorBadHTTPCode = "Bad HTTP status code"

Expand Down Expand Up @@ -516,9 +516,7 @@ func worker(ctx context.Context, id int, config appConfig, comm chan message, st
}

} else {

config.metrics.requestsSendSuccess.WithLabelValues(config.metrics.labelValues...).Inc()

}
}
}
Expand Down
2 changes: 2 additions & 0 deletions metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@ func initMetrics(config appConfig, labelNames, labelValues []string) appMetrics
am.channelConfigLength.WithLabelValues(labelValues...).Set(float64(workersCannelSize))
am.channelLength.WithLabelValues(labelValues...).Set(float64(0))
am.channelFullEvents.WithLabelValues(labelValues...).Add(0)
am.requestsSendSuccess.WithLabelValues(labelValues...).Add(0)
am.requestsSendErrors.WithLabelValues(labelValues...).Add(0)

return am
}
Expand Down

0 comments on commit 21b0d68

Please sign in to comment.