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

server: record ach_files_deleted metric #408

Merged
merged 2 commits into from
Dec 14, 2018
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ Examples: [Go](examples/http/main.go) | [Ruby](https://github.com/moov-io/ruby-a
## Getting Started

- [Running ACH Server](https://docs.moov.io/en/latest/ach-server/)
- [ACH Server metrics](documentation/metrics.md)

### From Source

Expand Down
8 changes: 8 additions & 0 deletions documentation/metrics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## ACH Server metrics

The following Prometheus metrics are recorded and emitted by the ACH server.

| Name | Description |
|---|---|
| `ach_files_created` | The number of ACH files created |
| `ach_files_deleted` | The number of ACH files deleted |
7 changes: 7 additions & 0 deletions server/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ var (
Name: "ach_files_created",
Help: "The number of ACH files created",
}, []string{"destination", "origin"})

filesDeleted = prometheus.NewCounterFrom(stdprometheus.CounterOpts{
Name: "ach_files_deleted",
Help: "The number of ACH files deleted",
}, nil)
)

type createFileRequest struct {
Expand Down Expand Up @@ -185,6 +190,8 @@ func (r deleteFileResponse) error() error { return r.Err }
func deleteFileEndpoint(s Service, logger log.Logger) endpoint.Endpoint {
return func(_ context.Context, request interface{}) (interface{}, error) {
req := request.(deleteFileRequest)
filesDeleted.Add(1)

err := s.DeleteFile(req.ID)

if req.requestId != "" && logger != nil {
Expand Down