Skip to content

Commit

Permalink
shortlink-link: improve tracing
Browse files Browse the repository at this point in the history
Signed-off-by: Victor Login <batazor@evrone.com>
  • Loading branch information
batazor committed Apr 5, 2023
1 parent b5981a3 commit dfbef75
Show file tree
Hide file tree
Showing 24 changed files with 246 additions and 52,019 deletions.
5 changes: 3 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ STORE_SQLITE_PATH=/tmp/links.sqlite

### gRPC ===============================================================================================================
GRPC_CLIENT_TLS_ENABLED=true
GRPC_SERVER_TLS_ENABLED=true
GRPC_SERVER_TLS_ENABLED=false
GRPC_CLIENT_PORT=443

### Logger =============================================================================================================

Expand All @@ -69,7 +70,7 @@ LOG_TIME_FORMAT=2006-01-02T15:04:05.999999999Z07:00

### TRACER_URI
### Default: localhost:14268/api/traces
TRACER_URI=http://localhost:14268/api/traces
TRACER_URI=http://grafana-tempo.grafana:14268/api/traces
### AUTH ===============================================================================================================

### Keycloak -----------------------------------------------------------------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion .run/link.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<module name="shortlink" />
<working_directory value="$PROJECT_DIR$" />
<envs>
<env name="GRPC_CLIENT_PORT" value="443" />
<env name="GRPC_SERVER_PORT" value="50053" />
<env name="STORE_TYPE" value="postgres" />
</envs>
Expand Down
4 changes: 2 additions & 2 deletions docs/env.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ File generated by cli. DO NOT EDIT.
| "GRPC_CLIENT_PORT" | 50051 | gRPC port |
| "GRPC_CLIENT_HOST" | 0.0.0.0 | gRPC host |
| "GRPC_CLIENT_CERT_PATH" | ops/cert/intermediate_ca.pem | gRPC client cert |
| "GRPC_CLIENT_LOGGER_ENABLE" | true | Enable logging for gRPC-client |
| "GRPC_CLIENT_LOGGER_ENABLED" | true | Enable logging for gRPC-client |
| "GRPC_SERVER_ENABLED" | true | gRPC server enable |
| "GRPC_SERVER_TLS_ENABLED" | false | gRPC tls |
| "GRPC_SERVER_PORT" | 50051 | gRPC port |
| "GRPC_SERVER_HOST" | 0.0.0.0 | gRPC host |
| "GRPC_SERVER_CERT_PATH" | ops/cert/shortlink-server.pem | gRPC server cert |
| "GRPC_SERVER_KEY_PATH" | ops/cert/shortlink-server-key.pem | gRPC server key |
| "GRPC_SERVER_LOGGER_ENABLE" | true | Enable logging for gRPC-client |
| "GRPC_SERVER_LOGGER_ENABLED" | true | Enable logging for gRPC-client |
| "SHORTDB_DEFAULT_DATABASE" | public | ShortDB default database |
| "SHORTDB_PAGE_SIZE" | | ShortDB default page of size |
3 changes: 1 addition & 2 deletions go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,7 @@ github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0 h1:nvj0OLI3YqYXe
github.com/casbin/casbin/v2 v2.1.2 h1:bTwon/ECRx9dwBy2ewRVr5OiqjeXSGiTUY74sDPQi/g=
github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4=
github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw=
github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
github.com/checkpoint-restore/go-criu/v4 v4.1.0 h1:WW2B2uxx9KWF6bGlHqhm8Okiafwwx7Y2kcpn8lCpjgo=
github.com/chzyer/logex v1.1.10 h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8=
Expand Down Expand Up @@ -1042,7 +1043,6 @@ github.com/onsi/gomega v1.23.0/go.mod h1:Z/NWtiqwBrwUt4/2loMmHL63EDLnYHmVbuBpDr2
github.com/onsi/gomega v1.26.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM=
github.com/onsi/gomega v1.27.1/go.mod h1:aHX5xOykVYzWOV4WqQy0sy8BQptgukenXpCXfadcIAw=
github.com/onsi/gomega v1.27.3/go.mod h1:5vG284IBtfDAmDyrK+eGyZmUgUlmi+Wngqo557cZ6Gw=
github.com/onsi/gomega v1.27.6/go.mod h1:PIQNjfQwkP3aQAH7lf7j87O/5FiNr+ZR8+ipb+qQlhg=
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 h1:lDH9UUVJtmYCjyT0CI4q8xvlXPxeZ0gYCVvWbmPlp88=
github.com/opencontainers/runtime-tools v0.0.0-20181011054405-1d69bd0f9c39 h1:H7DMc6FAjgwZZi8BRqjrAAHWoqEr5e5L6pS4V0ezet4=
github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492 h1:lM6RxxfUMrYL/f8bWEUqdXrANWtrL7Nndbm9iFN0DlU=
Expand Down Expand Up @@ -1096,7 +1096,6 @@ github.com/soheilhy/cmux v0.1.5 h1:jjzc5WVemNEDTLwv9tlmemhC73tI08BNOIGwBOo10Js=
github.com/sony/gobreaker v0.4.1 h1:oMnRNZXX5j85zso6xCPRNPtmAycat+WcoKbklScLDgQ=
github.com/spf13/cobra v1.6.0/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY=
github.com/stefanberger/go-pkcs11uri v0.0.0-20201008174630-78d3cae3a980 h1:lIOOHPEbXzO3vnmx2gok1Tfs31Q8GQqKLc8vVqyQq/I=
github.com/stoewer/go-strcase v1.2.0 h1:Z2iHWqGXH00XYgqDmNgQbIBxf3wrNq0F3feEy0ainaU=
github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271 h1:WhxRHzgeVGETMlmVfqhRn8RIeeNoPr2Czh33I4Zdccw=
github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a h1:AhmOdSHeswKHBjhsLs/7+1voOxT+LLrSk/Nxvk35fug=
github.com/supranational/blst v0.3.8-0.20220526154634-513d2456b344 h1:m+8fKfQwCAy1QjzINvKe/pYtLjo2dl59x2w9YSEJxuY=
Expand Down
7 changes: 3 additions & 4 deletions internal/services/link/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ Service for work with link-domain (CRUD)

### Example request

##### Add new link
```
grpcurl -cacert ./ops/cert/intermediate_ca.pem -d '{"url": "http://google.com"}' localhost:50052 link_rpc.Link/Add
```
We support reflection for request. You can use [Postman](https://www.postman.com/) or [grpcurl](https://github.com/fullstorydev/grpcurl) for test.

![postman](https://blog.postman.com/wp-content/uploads/2022/01/grpc-author-msg.gif)

### Changelog

Expand Down
2 changes: 1 addition & 1 deletion internal/services/link/application/link/link.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func (s *Service) Add(ctx context.Context, in *v1.Link) (*v1.Link, error) {
_, errs = sagaAddLink.AddStep(SAGA_STEP_METADATA_GET).
Then(func(ctx context.Context) error {
_, err := s.MetadataClient.Set(ctx, &metadata_rpc.MetadataServiceSetRequest{
Id: in.Url,
Url: in.Url,
})
if err != nil {
return err
Expand Down
36 changes: 22 additions & 14 deletions internal/services/link/domain/link/v1/link.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 28 additions & 20 deletions internal/services/link/domain/link_cqrs/v1/link.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 15 additions & 13 deletions internal/services/link/domain/sitemap/v1/sitemap.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit dfbef75

Please sign in to comment.