Skip to content
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
16 changes: 8 additions & 8 deletions build/deploy/atlas/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
atlas-api:
image: ghcr.io/thingspect/atlas:ed49f0d0
image: ghcr.io/thingspect/atlas:cae556f7
command: atlas-api
restart: on-failure
ports:
Expand All @@ -22,7 +22,7 @@ services:
- API_LORA_DEV_PROF_ID=00000000-0000-0000-0000-000000000000

atlas-mqtt-ingestor:
image: ghcr.io/thingspect/atlas:ed49f0d0
image: ghcr.io/thingspect/atlas:cae556f7
command: atlas-mqtt-ingestor
restart: on-failure
depends_on:
Expand All @@ -34,7 +34,7 @@ services:
- MQTT_INGEST_NSQ_PUB_ADDR=nsqd:4150

atlas-lora-ingestor:
image: ghcr.io/thingspect/atlas:ed49f0d0
image: ghcr.io/thingspect/atlas:cae556f7
command: atlas-lora-ingestor
restart: on-failure
depends_on:
Expand All @@ -47,7 +47,7 @@ services:
- LORA_INGEST_NSQ_PUB_ADDR=nsqd:4150

atlas-decoder:
image: ghcr.io/thingspect/atlas:ed49f0d0
image: ghcr.io/thingspect/atlas:cae556f7
command: atlas-decoder
restart: on-failure
depends_on:
Expand All @@ -60,7 +60,7 @@ services:
- DECODER_NSQ_LOOKUP_ADDRS=nsqlookupd:4161

atlas-validator:
image: ghcr.io/thingspect/atlas:ed49f0d0
image: ghcr.io/thingspect/atlas:cae556f7
command: atlas-validator
restart: on-failure
depends_on:
Expand All @@ -74,7 +74,7 @@ services:
- VALIDATOR_NSQ_LOOKUP_ADDRS=nsqlookupd:4161

atlas-accumulator:
image: ghcr.io/thingspect/atlas:ed49f0d0
image: ghcr.io/thingspect/atlas:cae556f7
command: atlas-accumulator
restart: on-failure
environment:
Expand All @@ -85,7 +85,7 @@ services:
- ACCUMULATOR_NSQ_LOOKUP_ADDRS=nsqlookupd:4161

atlas-eventer:
image: ghcr.io/thingspect/atlas:ed49f0d0
image: ghcr.io/thingspect/atlas:cae556f7
command: atlas-eventer
restart: on-failure
depends_on:
Expand All @@ -98,7 +98,7 @@ services:
- EVENTER_NSQ_LOOKUP_ADDRS=nsqlookupd:4161

atlas-alerter:
image: ghcr.io/thingspect/atlas:ed49f0d0
image: ghcr.io/thingspect/atlas:cae556f7
command: atlas-alerter
restart: on-failure
environment:
Expand Down
6 changes: 3 additions & 3 deletions internal/atlas-api/test/alarm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -659,9 +659,9 @@ func TestListAlarms(t *testing.T) {
t.Logf("createRule, err: %+v, %v", createRule, err)
require.NoError(t, err)

alarmIDs := []string{}
alarmNames := []string{}
alarmStatuses := []api.Status{}
alarmIDs := make([]string, 0, 3)
alarmNames := make([]string, 0, 3)
alarmStatuses := make([]api.Status, 0, 3)
for range 3 {
createAlarm, err := raCli.CreateAlarm(ctx, &api.CreateAlarmRequest{
Alarm: random.Alarm("api-alarm", uuid.NewString(), createRule.GetId()),
Expand Down
2 changes: 1 addition & 1 deletion internal/atlas-api/test/alert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func TestListAlerts(t *testing.T) {
t.Logf("createDev, err: %+v, %v", createDev, err)
require.NoError(t, err)

alerts := []*api.Alert{}
alerts := make([]*api.Alert, 0, 5)

for range 5 {
alert := random.Alert("dao-alert", globalAdminOrgID)
Expand Down
10 changes: 5 additions & 5 deletions internal/atlas-api/test/device_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -711,11 +711,11 @@ func TestListDevices(t *testing.T) {
ctx, cancel := context.WithTimeout(t.Context(), testTimeout)
defer cancel()

devIDs := []string{}
devNames := []string{}
devStatuses := []api.Status{}
devDecoders := []api.Decoder{}
devTags := [][]string{}
devIDs := make([]string, 0, 3)
devNames := make([]string, 0, 3)
devStatuses := make([]api.Status, 0, 3)
devDecoders := make([]api.Decoder, 0, 3)
devTags := make([][]string, 0, 3)
for range 3 {
devCli := api.NewDeviceServiceClient(globalAdminGRPCConn)
createDev, err := devCli.CreateDevice(ctx, &api.CreateDeviceRequest{
Expand Down
4 changes: 2 additions & 2 deletions internal/atlas-api/test/event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func TestListEvents(t *testing.T) {
t.Logf("createDev, err: %+v, %v", createDev, err)
require.NoError(t, err)

events := []*api.Event{}
events := make([]*api.Event, 0, 5)

for range 5 {
event := random.Event("api-event", globalAdminOrgID)
Expand Down Expand Up @@ -169,7 +169,7 @@ func TestLatestEvents(t *testing.T) {
t.Run("Latest events", func(t *testing.T) {
t.Parallel()

events := []*api.Event{}
events := make([]*api.Event, 0, 5)

for range 5 {
event := random.Event("api-event", globalAdminOrgID)
Expand Down
4 changes: 2 additions & 2 deletions internal/atlas-api/test/org_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,8 @@ func TestListOrgs(t *testing.T) {
ctx, cancel := context.WithTimeout(t.Context(), testTimeout)
defer cancel()

orgIDs := []string{}
orgNames := []string{}
orgIDs := make([]string, 0, 3)
orgNames := make([]string, 0, 3)
for range 3 {
orgCli := api.NewOrgServiceClient(secondarySysAdminGRPCConn)
createOrg, err := orgCli.CreateOrg(ctx,
Expand Down
6 changes: 3 additions & 3 deletions internal/atlas-api/test/rule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,9 +442,9 @@ func TestListRules(t *testing.T) {
ctx, cancel := context.WithTimeout(t.Context(), testTimeout)
defer cancel()

ruleIDs := []string{}
ruleNames := []string{}
ruleStatuses := []api.Status{}
ruleIDs := make([]string, 0, 3)
ruleNames := make([]string, 0, 3)
ruleStatuses := make([]api.Status, 0, 3)
for range 3 {
raCli := api.NewRuleAlarmServiceClient(globalAdminGRPCConn)
createRule, err := raCli.CreateRule(ctx, &api.CreateRuleRequest{
Expand Down
6 changes: 3 additions & 3 deletions internal/atlas-api/test/session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,9 @@ func TestListKeys(t *testing.T) {
ctx, cancel := context.WithTimeout(t.Context(), testTimeout)
defer cancel()

keyIDs := []string{}
keyNames := []string{}
keyRoles := []api.Role{}
keyIDs := make([]string, 0, 3)
keyNames := make([]string, 0, 3)
keyRoles := make([]api.Role, 0, 3)
for range 3 {
key := random.Key("api-key", uuid.NewString())
key.Role = api.Role_BUILDER
Expand Down
10 changes: 5 additions & 5 deletions internal/atlas-api/test/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -758,11 +758,11 @@ func TestListUsers(t *testing.T) {
ctx, cancel := context.WithTimeout(t.Context(), testTimeout)
defer cancel()

userIDs := []string{}
userNames := []string{}
userRoles := []api.Role{}
userStatuses := []api.Status{}
userTags := [][]string{}
userIDs := make([]string, 0, 3)
userNames := make([]string, 0, 3)
userRoles := make([]api.Role, 0, 3)
userStatuses := make([]api.Status, 0, 3)
userTags := make([][]string, 0, 3)
for range 3 {
user := random.User("api-user", uuid.NewString())
user.Role = api.Role_BUILDER
Expand Down
8 changes: 4 additions & 4 deletions pkg/dao/alarm/crudl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,10 +405,10 @@ func TestList(t *testing.T) {
t.Logf("createRule, err: %+v, %v", createRule, err)
require.NoError(t, err)

alarmIDs := []string{}
alarmNames := []string{}
alarmTypes := []api.AlarmType{}
alarmTSes := []time.Time{}
alarmIDs := make([]string, 0, 3)
alarmNames := make([]string, 0, 3)
alarmTypes := make([]api.AlarmType, 0, 3)
alarmTSes := make([]time.Time, 0, 3)
for range 3 {
createAlarm, err := globalAlarmDAO.Create(ctx, random.Alarm("dao-alarm",
createOrg.GetId(), createRule.GetId()))
Expand Down
2 changes: 1 addition & 1 deletion pkg/dao/alert/crudl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func TestList(t *testing.T) {
t.Logf("createDev, err: %+v, %v", createDev, err)
require.NoError(t, err)

alerts := []*api.Alert{}
alerts := make([]*api.Alert, 0, 5)

for range 5 {
alert := random.Alert("dao-alert", createOrg.GetId())
Expand Down
12 changes: 6 additions & 6 deletions pkg/dao/device/crudl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -583,12 +583,12 @@ func TestList(t *testing.T) {
t.Logf("createOrg, err: %+v, %v", createOrg, err)
require.NoError(t, err)

devIDs := []string{}
devNames := []string{}
devStatuses := []api.Status{}
devDecoders := []api.Decoder{}
devTags := [][]string{}
devTSes := []time.Time{}
devIDs := make([]string, 0, 3)
devNames := make([]string, 0, 3)
devStatuses := make([]api.Status, 0, 3)
devDecoders := make([]api.Decoder, 0, 3)
devTags := make([][]string, 0, 3)
devTSes := make([]time.Time, 0, 3)
for range 3 {
createDev, err := globalDevDAO.Create(ctx, random.Device("dao-device",
createOrg.GetId()))
Expand Down
4 changes: 2 additions & 2 deletions pkg/dao/event/crudl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func TestList(t *testing.T) {
t.Logf("createDev, err: %+v, %v", createDev, err)
require.NoError(t, err)

events := []*api.Event{}
events := make([]*api.Event, 0, 5)

for range 5 {
event := random.Event("dao-event", createOrg.GetId())
Expand Down Expand Up @@ -230,7 +230,7 @@ func TestLatest(t *testing.T) {
t.Logf("createOrg, err: %+v, %v", createOrg, err)
require.NoError(t, err)

events := []*api.Event{}
events := make([]*api.Event, 0, 5)

for range 5 {
event := random.Event("dao-event", createOrg.GetId())
Expand Down
8 changes: 4 additions & 4 deletions pkg/dao/key/crudl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,10 @@ func TestList(t *testing.T) {
t.Logf("createOrg, err: %+v, %v", createOrg, err)
require.NoError(t, err)

keyIDs := []string{}
keyNames := []string{}
keyRoles := []api.Role{}
keyTSes := []time.Time{}
keyIDs := make([]string, 0, 3)
keyNames := make([]string, 0, 3)
keyRoles := make([]api.Role, 0, 3)
keyTSes := make([]time.Time, 0, 3)
for range 3 {
createKey, err := globalKeyDAO.Create(ctx, random.Key("dao-key",
createOrg.GetId()))
Expand Down
8 changes: 4 additions & 4 deletions pkg/dao/org/crudl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,10 @@ func TestList(t *testing.T) {
ctx, cancel := context.WithTimeout(t.Context(), testTimeout)
defer cancel()

orgIDs := []string{}
orgNames := []string{}
orgEmails := []string{}
orgTSes := []time.Time{}
orgIDs := make([]string, 0, 3)
orgNames := make([]string, 0, 3)
orgEmails := make([]string, 0, 3)
orgTSes := make([]time.Time, 0, 3)
for range 3 {
createOrg, err := globalOrgDAO.Create(ctx, random.Org("dao-org"))
t.Logf("createOrg, err: %+v, %v", createOrg, err)
Expand Down
14 changes: 7 additions & 7 deletions pkg/dao/rule/crudl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,10 @@ func TestList(t *testing.T) {
t.Logf("createOrg, err: %+v, %v", createOrg, err)
require.NoError(t, err)

ruleIDs := []string{}
ruleNames := []string{}
ruleStatuses := []api.Status{}
ruleTSes := []time.Time{}
ruleIDs := make([]string, 0, 3)
ruleNames := make([]string, 0, 3)
ruleStatuses := make([]api.Status, 0, 3)
ruleTSes := make([]time.Time, 0, 3)
for range 3 {
createRule, err := globalRuleDAO.Create(ctx, random.Rule("dao-rule",
createOrg.GetId()))
Expand Down Expand Up @@ -431,9 +431,9 @@ func TestListByTags(t *testing.T) {
t.Logf("createOrg, err: %+v, %v", createOrg, err)
require.NoError(t, err)

ruleIDs := []string{}
ruleDeviceTags := []string{}
ruleAttrs := []string{}
ruleIDs := make([]string, 0, 3)
ruleDeviceTags := make([]string, 0, 3)
ruleAttrs := make([]string, 0, 3)
for range 3 {
rule := random.Rule("dao-rule", createOrg.GetId())
rule.Status = api.Status_ACTIVE
Expand Down
18 changes: 9 additions & 9 deletions pkg/dao/user/crudl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,12 +455,12 @@ func TestList(t *testing.T) {
t.Logf("createOrg, err: %+v, %v", createOrg, err)
require.NoError(t, err)

userIDs := []string{}
userNames := []string{}
userRoles := []api.Role{}
userTags := [][]string{}
userAppKeys := []string{}
userTSes := []time.Time{}
userIDs := make([]string, 0, 3)
userNames := make([]string, 0, 3)
userRoles := make([]api.Role, 0, 3)
userTags := make([][]string, 0, 3)
userAppKeys := make([]string, 0, 3)
userTSes := make([]time.Time, 0, 3)
for range 3 {
createUser, err := globalUserDAO.Create(ctx, random.User("dao-user",
createOrg.GetId()))
Expand Down Expand Up @@ -627,9 +627,9 @@ func TestListByTags(t *testing.T) {
t.Logf("createOrg, err: %+v, %v", createOrg, err)
require.NoError(t, err)

userIDs := []string{}
userNames := []string{}
userTags := [][]string{}
userIDs := make([]string, 0, 3)
userNames := make([]string, 0, 3)
userTags := make([][]string, 0, 3)
for range 3 {
user := random.User("dao-user", createOrg.GetId())
user.Status = api.Status_ACTIVE
Expand Down
9 changes: 7 additions & 2 deletions pkg/decode/chirpstack/gateway/gateway_conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@ func gatewayConn(body []byte) ([]*decode.Point, error) {
return nil, err
}

msgs := make([]*decode.Point, 0, 2)

// Build raw device and data payloads for debugging, with consistent output.
msgs := []*decode.Point{{Attr: "raw_gateway", Value: strings.ReplaceAll(
protojson.MarshalOptions{}.Format(connMsg), " ", "")}}
msgs = append(msgs, &decode.Point{
Attr: "raw_gateway",
Value: strings.ReplaceAll(protojson.MarshalOptions{}.Format(connMsg),
" ", ""),
})

// Parse ConnState.
msgs = append(msgs, &decode.Point{
Expand Down
4 changes: 3 additions & 1 deletion pkg/decode/radiobridge/door.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ func Door(body []byte) ([]*decode.Point, error) {
return nil, decode.FormatErr("door", "bad identifier", body)
}

msgs := make([]*decode.Point, 0, 2)

// Parse count.
count := int32(body[0] & clearProto)
msgs := []*decode.Point{{Attr: "count", Value: count}}
msgs = append(msgs, &decode.Point{Attr: "count", Value: count})

// Parse open status.
msgs = append(msgs, &decode.Point{Attr: "open", Value: body[2] == 0x01})
Expand Down
4 changes: 3 additions & 1 deletion pkg/decode/radiobridge/link_quality.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ func linkQuality(body []byte) ([]*decode.Point, error) {
return nil, decode.FormatErr("link quality", "bad identifier", body)
}

msgs := make([]*decode.Point, 0, 5)

// Parse protocol and count.
proto := int32(body[0] >> 4)
msgs := []*decode.Point{{Attr: "proto", Value: proto}}
msgs = append(msgs, &decode.Point{Attr: "proto", Value: proto})

count := int32(body[0] & clearProto)
msgs = append(msgs, &decode.Point{Attr: "count", Value: count})
Expand Down
4 changes: 3 additions & 1 deletion pkg/decode/radiobridge/reset.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ func reset(body []byte) ([]*decode.Point, error) {
return nil, decode.FormatErr("reset", "bad identifier", body)
}

msgs := make([]*decode.Point, 0, 4)

// Parse protocol, count, and hardware version.
proto := int32(body[0] >> 4)
msgs := []*decode.Point{{Attr: "proto", Value: proto}}
msgs = append(msgs, &decode.Point{Attr: "proto", Value: proto})

count := int32(body[0] & clearProto)
msgs = append(msgs, &decode.Point{Attr: "count", Value: count})
Expand Down
Loading