Skip to content

Commit

Permalink
v2.2.0:
Browse files Browse the repository at this point in the history
- init as go module
- remove 10 minutes deadline for incoming connection
- add -version flag
  • Loading branch information
nixargh committed Jun 7, 2022
1 parent 53e250f commit 0a7fb1b
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 7 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,20 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [2.2.0] - 2022-06-07
### Changed
- Init as go module.

### Removed
- `receiver.go` 10 minutes deadline for incoming connections.

### Added
- `main.go` **-version** flag to show **Groxy** version.

## [2.1.0] - 2022-01-30
### Added
- Mutual TLS support.
- New parameter **-forceTenant** that allows to revrite metric tenant if it is already set.
- New parameter **-forceTenant** that allows to rewrite metric tenant if it is already set.

## [2.0.1] - 2022-01-08
### Fixed
Expand Down
10 changes: 10 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module github.com/nixargh/groxy

go 1.17

require (
github.com/gorilla/mux v1.8.0
github.com/sirupsen/logrus v1.8.1
)

require golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 // indirect
12 changes: 12 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
14 changes: 11 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@ package main

import (
"flag"
log "github.com/sirupsen/logrus"
"fmt"
"os"
"strings"
"sync/atomic"
"time"

log "github.com/sirupsen/logrus"
// "github.com/pkg/profile"
)

var version string = "2.1.0"
var version string = "2.2.0"

var clog, slog, rlog, tlog, stlog *log.Entry

Expand Down Expand Up @@ -82,6 +84,7 @@ func main() {
var hostname string
var compressedOutput bool
var compressedInput bool
var showVersion bool

flag.StringVar(&instance, "instance", "default", "Groxy instance name (for log and metrics)")
flag.StringVar(&tenant, "tenant", "", "Graphite project name to store metrics in")
Expand Down Expand Up @@ -114,12 +117,18 @@ func main() {
flag.StringVar(&systemTenant, "systemTenant", "", "Graphite project name to store SELF metrics in. By default is equal to 'tenant'")
flag.StringVar(&systemPrefix, "systemPrefix", "", "Prefix to add to any SELF metric. By default is equal to 'prefix'")
flag.StringVar(&hostname, "hostname", "", "Hostname of a computer running Groxy")
flag.BoolVar(&showVersion, "version", false, "Groxy version")

flag.Parse()

// Setup logging
log.SetOutput(os.Stdout)

if showVersion {
fmt.Println(version)
os.Exit(1)
}

if jsonLog == true {
log.SetFormatter(&log.JSONFormatter{})
} else {
Expand Down Expand Up @@ -214,7 +223,6 @@ func main() {
state.OutBpm = atomic.LoadInt64(&state.OutBytes) - out_bytes

clog.WithFields(log.Fields{"state": state}).Info("Dumping state.")

sendStateMetrics(instance, hostname, systemTenant, systemPrefix, inputChan)
}
}
5 changes: 2 additions & 3 deletions receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import (
"crypto/tls"
"crypto/x509"
"fmt"
log "github.com/sirupsen/logrus"
"io"
"io/ioutil"
"net"
"strconv"
"strings"
"sync/atomic"
"time"

log "github.com/sirupsen/logrus"
// "github.com/pkg/profile"
)

Expand Down Expand Up @@ -104,7 +104,6 @@ func runReceiver(
}

func readMetric(connection net.Conn, inputChan chan *Metric, compress bool) {
connection.SetReadDeadline(time.Now().Add(600 * time.Second))
var uncompressedConn io.ReadCloser
var err error

Expand Down

0 comments on commit 0a7fb1b

Please sign in to comment.