Skip to content

Commit

Permalink
Bump dependency versions (#25)
Browse files Browse the repository at this point in the history
* bump go version to 1.18

* bumping deps

* bumping deps + some fixes
  • Loading branch information
marcinbudny authored Apr 14, 2022
1 parent b42c583 commit 718f5cd
Show file tree
Hide file tree
Showing 13 changed files with 68 additions and 68 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
name: tests on ES ${{ matrix.esVersion }}

runs-on: ubuntu-latest
container: golang:1.17.0-buster
container: golang:1.18-buster

services:
eventstore:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
go-version: 1.18
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.17-alpine as build
FROM golang:1.18-alpine as build

WORKDIR /go/src/github.com/marcinbudny/eventstore_exporter
COPY . ./
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ docker run -d -p 9448:9448 \

### From source

You need to have a Go 1.17+ environment configured.
You need to have a Go 1.18+ environment configured.

```bash
go install github.com/marcinbudny/eventstore_exporter@latest
Expand Down
18 changes: 8 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,33 +1,31 @@
module github.com/marcinbudny/eventstore_exporter

go 1.17
go 1.18

require (
github.com/EventStore/EventStore-Client-Go v1.0.2
github.com/EventStore/EventStore-Client-Go/v2 v2.0.2
github.com/buger/jsonparser v1.1.1
github.com/gofrs/uuid v4.2.0+incompatible
github.com/google/go-cmp v0.5.7
github.com/hashicorp/go-version v1.4.0
github.com/namsral/flag v1.7.4-pre
github.com/prometheus/client_golang v1.12.1
github.com/prometheus/client_model v0.2.0
github.com/prometheus/common v0.32.1
github.com/prometheus/common v0.33.0
github.com/sirupsen/logrus v1.8.1
)

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/opencontainers/image-spec v1.0.2 // indirect
github.com/opencontainers/runc v1.1.0 // indirect
github.com/opencontainers/runc v1.1.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect
golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5 // indirect
golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6 // indirect
google.golang.org/genproto v0.0.0-20220413183235-5e96e2839df9 // indirect
google.golang.org/grpc v1.45.0 // indirect
google.golang.org/protobuf v1.27.1 // indirect
google.golang.org/protobuf v1.28.0 // indirect
)
66 changes: 28 additions & 38 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion internal/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"net/url"
"time"

"github.com/EventStore/EventStore-Client-Go/esdb"
"github.com/EventStore/EventStore-Client-Go/v2/esdb"
"github.com/marcinbudny/eventstore_exporter/internal/config"
log "github.com/sirupsen/logrus"
)
Expand Down
4 changes: 3 additions & 1 deletion internal/client/stream_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"sync"
"time"

"github.com/EventStore/EventStore-Client-Go/esdb"
"github.com/EventStore/EventStore-Client-Go/v2/esdb"
log "github.com/sirupsen/logrus"
)

Expand Down Expand Up @@ -91,6 +91,7 @@ func getAllStreamStats(grpcClient *esdb.Client, timeout time.Duration) (StreamSt

read, err := grpcClient.ReadAll(ctx, esdb.ReadAllOptions{Direction: esdb.Backwards, From: esdb.EndPosition}, 1)
if err == nil {
defer read.Close()
event, err := read.Recv()
if err == nil {
return StreamStats{
Expand All @@ -114,6 +115,7 @@ func getRegularStreamStats(grpcClient *esdb.Client, stream string, timeout time.

read, err := grpcClient.ReadStream(ctx, stream, esdb.ReadStreamOptions{Direction: esdb.Backwards, From: esdb.End{}}, 1)
if err == nil {
defer read.Close()
event, err := read.Recv()
if err == nil {
return StreamStats{
Expand Down
12 changes: 11 additions & 1 deletion internal/client/subscription_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package client
import (
"context"
"fmt"
"io"
"strconv"
"strings"
"sync"
"time"

"github.com/EventStore/EventStore-Client-Go/esdb"
"github.com/EventStore/EventStore-Client-Go/v2/esdb"
jp "github.com/buger/jsonparser"
log "github.com/sirupsen/logrus"
)
Expand Down Expand Up @@ -117,6 +118,7 @@ func (client *EventStoreStatsClient) addParkedMessagesStats(subscriptions []Subs
}

grpcClient, err := client.getGrpcClient()

if err != nil {
log.WithFields(log.Fields{
"error": err,
Expand Down Expand Up @@ -171,14 +173,18 @@ func getOldestParkedMessageAgeInSeconds(grpcClient *esdb.Client, eventStreamID s

read, err := grpcClient.ReadStream(ctx, parkedStreamID(eventStreamID, groupName), esdb.ReadStreamOptions{Direction: esdb.Forwards, From: esdb.Revision(oldestMessagePosition)}, 1)
if err == nil {
defer read.Close()
event, err := read.Recv()

if err == nil {
created := event.Event.CreatedDate
loc, _ := time.LoadLocation("UTC")
timeNow := time.Now().In(loc)
age := float64(timeNow.Sub(created) / time.Second)

return age, nil
} else if err == io.EOF {
return -1, nil
}
}

Expand All @@ -197,9 +203,13 @@ func getParkedMessagesLastEventNumber(grpcClient *esdb.Client, eventStreamID str

read, err := grpcClient.ReadStream(ctx, parkedStreamID(eventStreamID, groupName), esdb.ReadStreamOptions{Direction: esdb.Backwards, From: esdb.End{}}, 1)
if err == nil {
defer read.Close()
event, err := read.Recv()

if err == nil {
return true, event.Event.EventNumber, nil
} else if err == io.EOF {
return false, 0, nil
}
}

Expand Down
2 changes: 1 addition & 1 deletion internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func Load(args []string, suppressOutput bool) (*Config, error) {
fs.BoolVar(&config.InsecureSkipVerify, "insecure-skip-verify", false, "Skip TLS certificatte verification for EventStore HTTP client")
fs.BoolVar(&config.EnableParkedMessagesStats, "enable-parked-messages-stats", false, "Enable parked messages stats scraping")
streamsString := fs.String("streams", "", "List of streams to get metrics for")
fs.StringVar(&config.StreamsSeparator, "streams-separator", ",", "Separator for streams list")
fs.StringVar(&config.StreamsSeparator, "streams-separator", ",", "Separator for streams list (default: ',')")

if suppressOutput {
fs.Usage = func() {}
Expand Down
10 changes: 5 additions & 5 deletions internal/server/server_all_subscriptions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"testing"
"time"

"github.com/EventStore/EventStore-Client-Go/esdb"
"github.com/EventStore/EventStore-Client-Go/v2/esdb"
)

func Test_Basic_SubscriptionAllMetrics(t *testing.T) {
Expand Down Expand Up @@ -152,17 +152,17 @@ func prepareSubscriptionToAllEnvironmentWithReplayedMessages(t *testing.T, parkC
}

func createSubscriptionToAll(t *testing.T, groupName string, client *esdb.Client) {
if err := client.CreatePersistentSubscriptionAll(context.Background(), groupName, esdb.PersistentAllSubscriptionOptions{
From: esdb.Start{},
if err := client.CreatePersistentSubscriptionToAll(context.Background(), groupName, esdb.PersistentAllSubscriptionOptions{
StartFrom: esdb.Start{},
}); err != nil {
t.Fatal(err)
}
}

func connectToSubscriptionToAll(t *testing.T, groupName string, client *esdb.Client) *esdb.PersistentSubscription {
subscription, err := client.ConnectToPersistentSubscriptionToAll(
subscription, err := client.SubscribeToPersistentSubscriptionToAll(

context.Background(), groupName, esdb.ConnectToPersistentSubscriptionOptions{BatchSize: 1})
context.Background(), groupName, esdb.SubscribeToPersistentSubscriptionOptions{BufferSize: 1})

if err != nil {
t.Fatal(err)
Expand Down
8 changes: 4 additions & 4 deletions internal/server/server_subscriptions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"testing"
"time"

"github.com/EventStore/EventStore-Client-Go/esdb"
"github.com/EventStore/EventStore-Client-Go/v2/esdb"
)

func Test_Basic_SubscriptionMetrics(t *testing.T) {
Expand Down Expand Up @@ -151,16 +151,16 @@ func prepareSubscriptionEnvironmentWithReplayedMessages(t *testing.T, parkCount

func createSubscription(t *testing.T, streamID string, groupName string, client *esdb.Client) {
if err := client.CreatePersistentSubscription(context.Background(), streamID, groupName, esdb.PersistentStreamSubscriptionOptions{
From: esdb.Start{},
StartFrom: esdb.Start{},
}); err != nil {
t.Fatal(err)
}
}

func connectToSubscription(t *testing.T, streamID string, groupName string, client *esdb.Client) *esdb.PersistentSubscription {
subscription, err := client.ConnectToPersistentSubscription(
subscription, err := client.SubscribeToPersistentSubscription(

context.Background(), streamID, groupName, esdb.ConnectToPersistentSubscriptionOptions{BatchSize: 1})
context.Background(), streamID, groupName, esdb.SubscribeToPersistentSubscriptionOptions{BufferSize: 1})

if err != nil {
t.Fatal(err)
Expand Down
6 changes: 3 additions & 3 deletions internal/server/utils_eventstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"os"
"testing"

"github.com/EventStore/EventStore-Client-Go/esdb"
"github.com/EventStore/EventStore-Client-Go/v2/esdb"
jp "github.com/buger/jsonparser"
"github.com/gofrs/uuid"
"github.com/marcinbudny/eventstore_exporter/internal/client"
Expand Down Expand Up @@ -143,14 +143,14 @@ func writeTestEvents(t *testing.T, eventCount int, streamID string, client *esdb
func ackMessages(t *testing.T, ackCount int, subscription *esdb.PersistentSubscription) {
for i := 0; i < ackCount; i++ {
event := subscription.Recv().EventAppeared
subscription.Ack(event)
subscription.Ack(event.Event)
}
}

func parkMessages(t *testing.T, parkCount int, subscription *esdb.PersistentSubscription) {

for i := 0; i < parkCount; i++ {
event := subscription.Recv().EventAppeared
subscription.Nack("reason", esdb.Nack_Park, event)
subscription.Nack("reason", esdb.Nack_Park, event.Event)
}
}

0 comments on commit 718f5cd

Please sign in to comment.