Skip to content

Commit

Permalink
chore(deps): Bumping deps for having more tracing details
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Boutour <[email protected]>
  • Loading branch information
ViBiOh committed Oct 8, 2022
1 parent 469a15d commit 2cdbde5
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 38 deletions.
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ module github.com/ViBiOh/fibr
go 1.19

require (
github.com/ViBiOh/ChatPotte v0.2.16
github.com/ViBiOh/ChatPotte v0.2.18
github.com/ViBiOh/absto v1.0.8
github.com/ViBiOh/auth/v2 v2.14.12
github.com/ViBiOh/exas v0.5.6
github.com/ViBiOh/exas v0.5.8
github.com/ViBiOh/flags v1.2.0
github.com/ViBiOh/httputils/v4 v4.48.2
github.com/ViBiOh/vith v0.5.6
github.com/ViBiOh/httputils/v4 v4.49.0
github.com/ViBiOh/vith v0.5.7
github.com/golang/mock v1.6.0
github.com/prometheus/client_golang v1.13.0
github.com/streadway/amqp v1.0.0
Expand Down Expand Up @@ -44,8 +44,8 @@ require (
github.com/prometheus/procfs v0.8.0 // indirect
github.com/rs/xid v1.4.0 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/tdewolff/minify/v2 v2.12.2 // indirect
github.com/tdewolff/parse/v2 v2.6.3 // indirect
github.com/tdewolff/minify/v2 v2.12.4 // indirect
github.com/tdewolff/parse/v2 v2.6.4 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.36.1 // indirect
go.opentelemetry.io/otel/exporters/jaeger v1.10.0 // indirect
go.opentelemetry.io/otel/metric v0.32.1 // indirect
Expand Down
24 changes: 12 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,20 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/ViBiOh/ChatPotte v0.2.16 h1:bRbdfY1Wo0FQFM2OAZEjR6i1cyGHMFLgPDtnZ0KXepM=
github.com/ViBiOh/ChatPotte v0.2.16/go.mod h1:wbRt0UdGL0KVFd2pRxHgvIqUw80E+SNwKIg8DK6KXZ8=
github.com/ViBiOh/ChatPotte v0.2.18 h1:gBFYmKcaulq2Posktr7FBmvRyn5IEvEJQ4fOMhNvAi8=
github.com/ViBiOh/ChatPotte v0.2.18/go.mod h1:Y1gxxlzWqjv2de2AMd8Uw01h9BGiWpay9Tmf7E3CXWI=
github.com/ViBiOh/absto v1.0.8 h1:v7o4zVZJ1idcSm6VqztSI2joMvTPszjtY3E/3d/4qPc=
github.com/ViBiOh/absto v1.0.8/go.mod h1:PpNf1Ajiwdd2lZ93WEsA09QaGlRFauFRVibeTn0TV54=
github.com/ViBiOh/auth/v2 v2.14.12 h1:ki/2usDHUzF+TFr0PgqXD5vY1ywI8+/fOs2UhuG/0yY=
github.com/ViBiOh/auth/v2 v2.14.12/go.mod h1:KTWHB3udAgg2rmD+eyUKcwYNwYxNTIdos+JFiNdtF3A=
github.com/ViBiOh/exas v0.5.6 h1:GZCUnYJI1PR889pqcQ6GwtT/PJ4faQCzm+qyKZPy22A=
github.com/ViBiOh/exas v0.5.6/go.mod h1:kNjdx+nMHQciRD6X5+6TiH1WRMqB58h+pH+JciUhYZY=
github.com/ViBiOh/exas v0.5.8 h1:FzTyCGel8S6g6M6BJ7XklviPtZkrxRfZuqSMkEnxQRY=
github.com/ViBiOh/exas v0.5.8/go.mod h1:Ti8Ae4csYJPpUH6rFKwkapU5sVu7HFP8TxcPzlrcGIU=
github.com/ViBiOh/flags v1.2.0 h1:DaujjNXzD29KxKyp4eZdn7c9+uBN5DokWgDAe7DcUmc=
github.com/ViBiOh/flags v1.2.0/go.mod h1:UyMB5zeD/aId7Xw3x7577ZNU298JmukzOcV8p/H2W1s=
github.com/ViBiOh/httputils/v4 v4.48.2 h1:jUiYv8PyeoHuZqrZ3r6A5WuhrhRfQBYcYdeBpwrV8W0=
github.com/ViBiOh/httputils/v4 v4.48.2/go.mod h1:ei245Z4X6CKljmFdMlFECtVSwdbvusGzl+wGCy9CpH4=
github.com/ViBiOh/vith v0.5.6 h1:zumm82sUYAHTwSe4lCFP9hMkfOHVhUgBkTOJ8cQVu24=
github.com/ViBiOh/vith v0.5.6/go.mod h1:cEqUtO5bFGGXlFhLxsj1jUDMu0atqKm1H5pm0fZtVfo=
github.com/ViBiOh/httputils/v4 v4.49.0 h1:Y4RqXjMQrCDKGNIzplchnDxBI+Ije2RNMgpMv2iS9Qk=
github.com/ViBiOh/httputils/v4 v4.49.0/go.mod h1:az+bpwxGelymOsvdp0ZUNbGXdkjjjQXTuKIMFT78bmY=
github.com/ViBiOh/vith v0.5.7 h1:2tGyfW9M11iG+EGOpy8+U75UW6HJ2jJF3BsfHKArPak=
github.com/ViBiOh/vith v0.5.7/go.mod h1:cpjxy6KcIzZa1RPypZfjntV4QWDZFM3bqC9W+XtFobo=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
Expand Down Expand Up @@ -263,10 +263,10 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
github.com/tdewolff/minify/v2 v2.12.2 h1:AKIoVwJj/HgBm+d/fPqpEZ31EtCM5FJfJNGagdR9Ecg=
github.com/tdewolff/minify/v2 v2.12.2/go.mod h1:p5pwbvNs1ghbFED/ZW1towGsnnWwzvM8iz8l0eURi9g=
github.com/tdewolff/parse/v2 v2.6.3 h1:O5rshbkaRmpRtD7k2lG65bEJpcfUMNg5Cx2uRKWVsI8=
github.com/tdewolff/parse/v2 v2.6.3/go.mod h1:woz0cgbLwFdtbjJu8PIKxhW05KplTFQkOdX78o+Jgrs=
github.com/tdewolff/minify/v2 v2.12.4 h1:kejsHQMM17n6/gwdw53qsi6lg0TGddZADVyQOz1KMdE=
github.com/tdewolff/minify/v2 v2.12.4/go.mod h1:h+SRvSIX3kwgwTFOpSckvSxgax3uy8kZTSF1Ojrr3bk=
github.com/tdewolff/parse/v2 v2.6.4 h1:KCkDvNUMof10e3QExio9OPZJT8SbdKojLBumw8YZycQ=
github.com/tdewolff/parse/v2 v2.6.4/go.mod h1:woz0cgbLwFdtbjJu8PIKxhW05KplTFQkOdX78o+Jgrs=
github.com/tdewolff/test v1.0.7 h1:8Vs0142DmPFW/bQeHRP3MV19m1gvndjUb1sn8yy74LM=
github.com/tdewolff/test v1.0.7/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
Expand Down
6 changes: 3 additions & 3 deletions pkg/crud/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ func (a App) saveUploadedFile(ctx context.Context, request provider.Request, inp
err = provider.WriteToStorage(ctx, a.storageApp, filePath, size, file)

if err == nil {
go func() {
if info, infoErr := a.storageApp.Info(context.Background(), filePath); infoErr != nil {
go func(ctx context.Context) {
if info, infoErr := a.storageApp.Info(ctx, filePath); infoErr != nil {
logger.Error("get info for upload event: %s", infoErr)
} else {
a.notify(provider.NewUploadEvent(request, info, a.bestSharePath(filePath), a.rendererApp))
}
}()
}(tracer.CopyToBackground(ctx))
}

return fileName, err
Expand Down
6 changes: 3 additions & 3 deletions pkg/crud/upload_chunk.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ func (a App) mergeChunk(w http.ResponseWriter, r *http.Request, request provider
err = provider.WriteToStorage(ctx, a.storageApp, filePath, size, file)

if err == nil {
go func() {
if info, infoErr := a.storageApp.Info(context.Background(), filePath); infoErr != nil {
go func(ctx context.Context) {
if info, infoErr := a.storageApp.Info(ctx, filePath); infoErr != nil {
logger.Error("get info for upload event: %s", infoErr)
} else {
a.notify(provider.NewUploadEvent(request, info, a.bestSharePath(filePath), a.rendererApp))
}
}()
}(tracer.CopyToBackground(ctx))
}

if err = os.RemoveAll(tempFolder); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/exif/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (a App) handleUploadEvent(ctx context.Context, item absto.Item, aggregate b
}

if a.amqpClient != nil {
return a.publishExifRequest(item)
return a.publishExifRequest(ctx, item)
}

exif, err := a.extractAndSaveExif(ctx, item)
Expand Down
4 changes: 2 additions & 2 deletions pkg/exif/exif.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ func (a App) extractExif(ctx context.Context, item absto.Item) (exif exas.Exif,
return
}

func (a App) publishExifRequest(item absto.Item) error {
func (a App) publishExifRequest(ctx context.Context, item absto.Item) error {
a.increaseExif("publish")

return a.amqpClient.PublishJSON(item, a.amqpExchange, a.amqpRoutingKey)
return a.amqpClient.PublishJSON(ctx, item, a.amqpExchange, a.amqpRoutingKey)
}
4 changes: 2 additions & 2 deletions pkg/share/crud.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (a *App) Create(ctx context.Context, filepath string, edit, story bool, pas
}

if a.amqpClient != nil {
if err = a.amqpClient.PublishJSON(share, a.amqpExchange, a.amqpRoutingKey); err != nil {
if err = a.amqpClient.PublishJSON(ctx, share, a.amqpExchange, a.amqpRoutingKey); err != nil {
return fmt.Errorf("publish share creation: %w", err)
}
}
Expand Down Expand Up @@ -102,7 +102,7 @@ func (a *App) delete(ctx context.Context, id string) error {
}

if a.amqpClient != nil {
if err := a.amqpClient.PublishJSON(provider.Share{ID: id}, a.amqpExchange, a.amqpRoutingKey); err != nil {
if err := a.amqpClient.PublishJSON(ctx, provider.Share{ID: id}, a.amqpExchange, a.amqpRoutingKey); err != nil {
return fmt.Errorf("publish share deletion: %w", err)
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/share/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (a *App) renameItem(ctx context.Context, old, new absto.Item) error {
a.shares[id] = share

if a.amqpClient != nil {
if err := a.amqpClient.PublishJSON(share, a.amqpExchange, a.amqpRoutingKey); err != nil {
if err := a.amqpClient.PublishJSON(ctx, share, a.amqpExchange, a.amqpRoutingKey); err != nil {
return fmt.Errorf("publish share rename: %w", err)
}
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/share/share.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func (a *App) refresh(ctx context.Context) error {
return nil
}

func (a *App) purgeExpiredShares() bool {
func (a *App) purgeExpiredShares(ctx context.Context) bool {
now := a.clock.Now()
changed := false

Expand All @@ -175,7 +175,7 @@ func (a *App) purgeExpiredShares() bool {
delete(a.shares, id)

if a.amqpClient != nil {
if err := a.amqpClient.PublishJSON(provider.Share{ID: id}, a.amqpExchange, a.amqpRoutingKey); err != nil {
if err := a.amqpClient.PublishJSON(ctx, provider.Share{ID: id}, a.amqpExchange, a.amqpRoutingKey); err != nil {
logger.WithField("fn", "share.purgeExpiredShares").WithField("item", id).Error("publish share purge: %s", err)
}
}
Expand All @@ -188,7 +188,7 @@ func (a *App) purgeExpiredShares() bool {
}

func (a *App) cleanShares(ctx context.Context) error {
if !a.purgeExpiredShares() {
if !a.purgeExpiredShares(ctx) {
return nil
}

Expand Down
3 changes: 2 additions & 1 deletion pkg/share/share_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package share

import (
"context"
"reflect"
"testing"
"time"
Expand Down Expand Up @@ -64,7 +65,7 @@ func TestPurgeExpiredShares(t *testing.T) {

for intention, tc := range cases {
t.Run(intention, func(t *testing.T) {
tc.instance.purgeExpiredShares()
tc.instance.purgeExpiredShares(context.TODO())
got := tc.instance.shares

if !reflect.DeepEqual(got, tc.want) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/thumbnail/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (a App) requestVith(ctx context.Context, item absto.Item, scale uint64) (*h

if a.amqpClient != nil {
a.increaseMetric(itemType.String(), "publish")
return nil, a.amqpClient.PublishJSON(vith.NewRequest(item.Pathname, outputName, itemType, scale), a.amqpExchange, a.amqpThumbnailRoutingKey)
return nil, a.amqpClient.PublishJSON(ctx, vith.NewRequest(item.Pathname, outputName, itemType, scale), a.amqpExchange, a.amqpThumbnailRoutingKey)
}

a.increaseMetric(itemType.String(), "request")
Expand Down
2 changes: 1 addition & 1 deletion pkg/thumbnail/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (a App) generateStream(ctx context.Context, item absto.Item) error {
if a.amqpClient != nil {
a.increaseMetric("stream", "publish")

err := a.amqpClient.PublishJSON(req, a.amqpExchange, a.amqpStreamRoutingKey)
err := a.amqpClient.PublishJSON(ctx, req, a.amqpExchange, a.amqpStreamRoutingKey)
if err != nil {
a.increaseMetric("stream", "error")
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/webhook/crud.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (a *App) Create(ctx context.Context, pathname string, recursive bool, kind
}

if a.amqpClient != nil {
if err = a.amqpClient.PublishJSON(webhook, a.amqpExchange, a.amqpRoutingKey); err != nil {
if err = a.amqpClient.PublishJSON(ctx, webhook, a.amqpExchange, a.amqpRoutingKey); err != nil {
return fmt.Errorf("publish webhook creation: %w", err)
}
}
Expand All @@ -89,7 +89,7 @@ func (a *App) delete(ctx context.Context, id string) error {
}

if a.amqpClient != nil {
if err := a.amqpClient.PublishJSON(provider.Webhook{ID: id}, a.amqpExchange, a.amqpRoutingKey); err != nil {
if err := a.amqpClient.PublishJSON(ctx, provider.Webhook{ID: id}, a.amqpExchange, a.amqpRoutingKey); err != nil {
return fmt.Errorf("publish webhook deletion: %w", err)
}
}
Expand Down

0 comments on commit 2cdbde5

Please sign in to comment.