Skip to content

Commit

Permalink
Merge pull request #429 from streamdal/blinktag/server_plaintext
Browse files Browse the repository at this point in the history
server: Plaintext support
  • Loading branch information
blinktag committed May 15, 2024
2 parents 9fa0dfd + 2014ba9 commit bf6924c
Show file tree
Hide file tree
Showing 13 changed files with 593 additions and 347 deletions.
2 changes: 1 addition & 1 deletion apps/server/assets/wasm/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.1.39
v0.1.42
2 changes: 1 addition & 1 deletion apps/server/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ require (
github.com/relistan/go-director v0.0.0-20200406104025-dbbf5d95248d
github.com/sirupsen/logrus v1.9.3
github.com/slack-go/slack v0.12.3
github.com/streamdal/streamdal/libs/protos v0.1.54
github.com/streamdal/streamdal/libs/protos v0.1.57
github.com/tidwall/gjson v1.16.0
golang.org/x/crypto v0.19.0
google.golang.org/grpc v1.60.1
Expand Down
4 changes: 2 additions & 2 deletions apps/server/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIK
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/streamdal/streamdal/libs/protos v0.1.54 h1:PX7u3m1wDwZtER77m7YvjRcBWvcKFiaRZ+yN7Xw+uJw=
github.com/streamdal/streamdal/libs/protos v0.1.54/go.mod h1:1rQ250ydoKeRoJftIV9qGrR28Iqdb9+7Jcnoxber/eQ=
github.com/streamdal/streamdal/libs/protos v0.1.57 h1:WcdPA6d/jSBbr4BF07q5bgnoA7NaadL1rccQbvLXer8=
github.com/streamdal/streamdal/libs/protos v0.1.57/go.mod h1:1rQ250ydoKeRoJftIV9qGrR28Iqdb9+7Jcnoxber/eQ=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
Expand Down
12 changes: 12 additions & 0 deletions apps/server/test-utils/demo-client/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,18 @@ run/async-sampling:
--data-source-type file \
--data-source-file ./assets/sample.json

.PHONY: run/plaintext
run/plaintext: description = Plaintext Logs
run/plaintext:
go run *.go -d \
--message-rate 1,10 \
--service-name "plaintext-logs" \
--operation-type 2 \
--operation-name "logs" \
--component-name "plaintext-logger" \
--display-exec-time \
--data-source-type file \
--data-source-file ./assets/plaintext-logs.txt

### Build

Expand Down
5 changes: 5 additions & 0 deletions apps/server/test-utils/demo-client/assets/plaintext-logs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
2024-04-29T15:59:41.289946276Z stdout Hello World!
2024-04-29T15:59:41.60221245Z stdout F - using code: gin.SetMode(gin.ReleaseMode)
2024-04-29T15:59:41.60221514Z stdout Found user with email test@streamdal.com
2024-04-29T15:59:41.60221515Z stdout Exporting data {"user": {"ccnum": "4111111111111111"}} to billing service
2024-04-29T15:59:41.60221516Z stdout Run Completed
11 changes: 11 additions & 0 deletions apps/server/test-utils/demo-client/demo.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
gopretty "github.com/jedib0t/go-pretty/v6/table"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"

"github.com/streamdal/streamdal/libs/protos/build/go/protos"

streamdal "github.com/streamdal/streamdal/sdks/go"
Expand Down Expand Up @@ -295,6 +296,16 @@ func (r *Demo) display(pre []byte, post *streamdal.ProcessResponse, err error, t
}

func generateDataDiff(tw gopretty.Writer, pre []byte, post *streamdal.ProcessResponse) {
// Plaintext
// TODO: can we add syntax highlighting to changed val?
if pre[0] != '{' {
tw.AppendSeparator()
tw.AppendRow(gopretty.Row{bold("Before"), bold("After")})
tw.AppendSeparator()
tw.AppendRow(gopretty.Row{string(pre), string(post.Data)})
return
}

// Format pre data
preFormatted, err := prettyjson.Format(pre)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions apps/server/test-utils/demo-client/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ require (
github.com/joho/godotenv v1.5.1
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.9.3
github.com/streamdal/streamdal/libs/protos v0.1.56
github.com/streamdal/streamdal/sdks/go v0.1.26
github.com/streamdal/streamdal/libs/protos v0.1.57
github.com/streamdal/streamdal/sdks/go v0.1.27
)

require (
Expand Down
14 changes: 6 additions & 8 deletions apps/server/test-utils/demo-client/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,12 @@ github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykE
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/streamdal/streamdal/libs/protos v0.1.54 h1:PX7u3m1wDwZtER77m7YvjRcBWvcKFiaRZ+yN7Xw+uJw=
github.com/streamdal/streamdal/libs/protos v0.1.54/go.mod h1:1rQ250ydoKeRoJftIV9qGrR28Iqdb9+7Jcnoxber/eQ=
github.com/streamdal/streamdal/libs/protos v0.1.56 h1:JyaUN939Sb+Jspx0g55fDy8VKUnyCOJ7yIsW2GMCos0=
github.com/streamdal/streamdal/libs/protos v0.1.56/go.mod h1:1rQ250ydoKeRoJftIV9qGrR28Iqdb9+7Jcnoxber/eQ=
github.com/streamdal/streamdal/sdks/go v0.1.23 h1:9jkqsnVnNhcTkuBuqeqQrts1fkUXOMXmOxH4oXh/424=
github.com/streamdal/streamdal/sdks/go v0.1.23/go.mod h1:c0BnT4skXHZ5hteMqZCadb4dZiQd5lPqNOn3GxQ21eo=
github.com/streamdal/streamdal/sdks/go v0.1.26 h1:OgCE2ZhoIoDhk0kzhVaxqnRyL7OFbpt3HUnRK4HDdVs=
github.com/streamdal/streamdal/sdks/go v0.1.26/go.mod h1:Qst/7V4lw3k9/55uClt2WS9OXyCl7l+/LqcWcdU14SI=
github.com/streamdal/streamdal/libs/protos v0.1.57 h1:WcdPA6d/jSBbr4BF07q5bgnoA7NaadL1rccQbvLXer8=
github.com/streamdal/streamdal/libs/protos v0.1.57/go.mod h1:1rQ250ydoKeRoJftIV9qGrR28Iqdb9+7Jcnoxber/eQ=
github.com/streamdal/streamdal/sdks/go v0.1.27-0.20240515175518-a12289e89d4e h1:O+Dr9Noa25093sJ50iA2piYDBvRpbU6U+3c0G1JpYoU=
github.com/streamdal/streamdal/sdks/go v0.1.27-0.20240515175518-a12289e89d4e/go.mod h1:Rf7Jc8I7Qtsy/wF7mvOR0a3btvdaNaJ2R/nIgMM0BRQ=
github.com/streamdal/streamdal/sdks/go v0.1.27 h1:yafqN36MW4RMHOY510cruYvRHPpizmreBi0tCqRoz9g=
github.com/streamdal/streamdal/sdks/go v0.1.27/go.mod h1:Rf7Jc8I7Qtsy/wF7mvOR0a3btvdaNaJ2R/nIgMM0BRQ=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
Expand Down

0 comments on commit bf6924c

Please sign in to comment.