Skip to content
This repository has been archived by the owner on Dec 14, 2021. It is now read-only.

Commit

Permalink
Merge pull request #33 from TheThingsNetwork/fix/versions
Browse files Browse the repository at this point in the history
Update Go to 1.11 and Alpine to 3.8; fix fmt/vet issues
  • Loading branch information
htdvisser authored Sep 26, 2018
2 parents edc5fb8 + 9f3d157 commit 8b4a1ff
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 19 deletions.
6 changes: 3 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ before_script:

tests:
stage: test
image: golang:1.8
image: golang:1.11
services:
- thethingsnetwork/rabbitmq
- redis
Expand All @@ -33,7 +33,7 @@ tests:

binaries:
stage: build
image: golang:latest
image: golang:1.11
script:
- mkdir release
- export CI_BUILD_DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ)
Expand All @@ -58,7 +58,7 @@ sign:
- master@thethingsnetwork/gateway-connector-bridge
- develop@thethingsnetwork/gateway-connector-bridge
stage: sign
image: golang:latest
image: golang:1.11
script:
- pushd release
- shasum -a 256 $(ls) > checksums
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
- docker

go:
- 1.8
- "1.11"

cache:
directories:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine
FROM alpine:3.8
RUN apk --update --no-cache add ca-certificates
ADD ./release/gateway-connector-bridge-linux-amd64 /usr/local/bin/gateway-connector-bridge
ADD ./assets ./assets
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ The Things Network's `gateway-connector` protocol sends protocol buffers over MQ

## Development

- Make sure you have [Go](https://golang.org) installed (version 1.7 or later).
- Make sure you have [Go](https://golang.org) installed (recommended version 1.11, version 1.8 or later is known to work).
- Set up your [Go environment](https://golang.org/doc/code.html#GOPATH).
- Make sure you have [Redis](http://redis.io/download) **installed** and **running**.
- Make sure you have [RabbitMQ](https://www.rabbitmq.com/download.html) and its [MQTT plugin](https://www.rabbitmq.com/mqtt.html) **installed** and **running**.
Expand Down
14 changes: 7 additions & 7 deletions backend/pktfwd/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -554,14 +554,14 @@ func newRXPacketFromRXPK(mac lorawan.EUI64, rxpk RXPK) (*types.UplinkMessage, er
rxPacket.Message.GatewayMetadata.RSSI = float32(sig.RSSIS)
}
antenna := &pb_gateway.RxMetadata_Antenna{
Antenna: uint32(sig.Ant),
Channel: uint32(sig.Chan),
ChannelRSSI: float32(sig.RSSIC),
RSSI: float32(sig.RSSIS),
Antenna: uint32(sig.Ant),
Channel: uint32(sig.Chan),
ChannelRSSI: float32(sig.RSSIC),
RSSI: float32(sig.RSSIS),
RSSIStandardDeviation: float32(sig.RSSISD),
SNR: float32(sig.LSNR),
FrequencyOffset: int64(sig.FOff),
FineTime: sig.FTime,
SNR: float32(sig.LSNR),
FrequencyOffset: int64(sig.FOff),
FineTime: sig.FTime,
}
if eTime, err := base64.StdEncoding.DecodeString(sig.ETime); err == nil && len(eTime) > 0 {
antenna.EncryptedTime = eTime
Expand Down
12 changes: 6 additions & 6 deletions backend/pktfwd/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,9 @@ func TestBackend(t *testing.T) {
},
},
GatewayConfiguration: pb_gateway.TxConfiguration{
Timestamp: 12345,
Frequency: 868100000,
Power: 14,
Timestamp: 12345,
Frequency: 868100000,
Power: 14,
PolarizationInversion: true,
},
Payload: []byte{1, 2, 3, 4},
Expand Down Expand Up @@ -444,9 +444,9 @@ func TestNewTXPKFromTXPacket(t *testing.T) {
},
},
GatewayConfiguration: pb_gateway.TxConfiguration{
Timestamp: 12345,
Frequency: 868100000,
Power: 14,
Timestamp: 12345,
Frequency: 868100000,
Power: 14,
PolarizationInversion: true,
},
Payload: []byte{1, 2, 3, 4},
Expand Down
2 changes: 2 additions & 0 deletions exchange/exchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/TheThingsNetwork/gateway-connector-bridge/types"
"github.com/apex/log"
"github.com/deckarep/golang-set"
"github.com/spf13/viper"
)

// Exchange routes messages between northbound backends (servers that are up the chain)
Expand Down Expand Up @@ -75,6 +76,7 @@ func New(ctx log.Interface, killWhenIdleFor time.Duration) *Exchange {
gateways: mapset.NewSet(),
killWhenIdleFor: killWhenIdleFor,
}
info.WithLabelValues(viper.GetString("buildDate"), viper.GetString("gitCommit"), viper.GetString("id"), viper.GetString("version")).Set(1)
if killWhenIdleFor > 0 {
e.idleWatchdog = time.AfterFunc(killWhenIdleFor, func() {
ctx.Fatalf("Exchange was idle for more than %v", killWhenIdleFor)
Expand Down
12 changes: 12 additions & 0 deletions exchange/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ import (
"github.com/prometheus/client_golang/prometheus"
)

var info = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: "ttn",
Subsystem: "bridge",
Name: "info",
Help: "Information about the TTN environment.",
}, []string{
"build_date", "git_commit", "id", "version",
},
)

var connectedGateways = prometheus.NewGauge(
prometheus.GaugeOpts{
Namespace: "ttn",
Expand Down Expand Up @@ -73,6 +84,7 @@ func registerStatus() {
}

func init() {
prometheus.MustRegister(info)
prometheus.MustRegister(connectedGateways)
prometheus.MustRegister(handledCounter)
for mType := lorawan.MType(0); mType < 8; mType++ {
Expand Down

0 comments on commit 8b4a1ff

Please sign in to comment.