Skip to content

Commit db56a25

Browse files
amulyavaroteAmulya Varoteartursouzapravinpushkar
authored
Added api-log-level flag to log api calls (#903)
* Added api-log-level flag to log api calls Signed-off-by: Amulya Varote <[email protected]> Signed-off-by: Amulya Varote <[email protected]> * Added api-log-level to README Signed-off-by: Amulya Varote <[email protected]> Signed-off-by: Amulya Varote <[email protected]> * Removed the test case for api-log-level Signed-off-by: Amulya Varote <[email protected]> * Removed Readme changes Signed-off-by: Amulya Varote <[email protected]> * Added back all the changes Signed-off-by: Amulya Varote <[email protected]> * Updated dapr RC version Signed-off-by: Amulya Varote <[email protected]> * kind e2e changes Signed-off-by: Amulya Varote <[email protected]> * Changed README file Signed-off-by: Amulya Varote <[email protected]> * Changed dashboard version Signed-off-by: Amulya Varote <[email protected]> * Fixing Go mod tidy. Signed-off-by: Artur Souza <[email protected]> * Reverted dashboard version Signed-off-by: Amulya Varote <[email protected]> * Reverted dashboard version Signed-off-by: Amulya Varote <[email protected]> * Changed dapr dashboard link Signed-off-by: Amulya Varote <[email protected]> * Changed dapr dashboard link Signed-off-by: Amulya Varote <[email protected]> * Changed version extract link for kind Signed-off-by: Amulya Varote <[email protected]> * Changed version extract link for self hosted Signed-off-by: Amulya Varote <[email protected]> * defined variable in kind Signed-off-by: Amulya Varote <[email protected]> * stadalone e2e test for api log level Signed-off-by: Pravin Pushkar <[email protected]> Co-authored-by: Amulya Varote <[email protected]> Co-authored-by: Artur Souza <[email protected]> Co-authored-by: Pravin Pushkar <[email protected]>
1 parent 6262b93 commit db56a25

File tree

11 files changed

+117
-761
lines changed

11 files changed

+117
-761
lines changed

.github/workflows/kind_e2e.yaml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ jobs:
4646
runs-on: ubuntu-latest
4747
env:
4848
GOVER: 1.17
49-
DAPR_RUNTIME_VERSION: 1.6.0
50-
DAPR_DASHBOARD_VERSION: 0.9.0
49+
DAPR_RUNTIME_VERSION: 1.7.0-rc.1
50+
DAPR_DASHBOARD_VERSION: 0.10.0-rc.1
51+
DAPR_TGZ: dapr-1.7.0-rc.1.tgz
5152
strategy:
5253
fail-fast: false # Keep running if one leg fails.
5354
matrix:
@@ -115,10 +116,8 @@ jobs:
115116
- role: worker
116117
image: kindest/node:${{ matrix.k8s-version }}@${{ matrix.kind-image-sha }}
117118
EOF
118-
119119
# Log the generated kind.yaml for easy reference.
120120
cat kind.yaml
121-
122121
- name: Create KinD Cluster
123122
uses: helm/[email protected]
124123
with:
@@ -133,7 +132,6 @@ jobs:
133132
-lkubernetes.io/hostname!=kind-control-plane \
134133
-ojsonpath='{.items[0].status.addresses[?(@.type=="InternalIP")].address}')
135134
echo "MINIKUBE_NODE_IP=$NODE_IP" >> $GITHUB_ENV
136-
137135
- name: Free up some diskspace
138136
run: |
139137
docker image prune -a -f
@@ -147,7 +145,7 @@ jobs:
147145
- name: Determine latest Dapr Dashboard version including Pre-releases
148146
if: github.base_ref == 'master'
149147
run: |
150-
helm pull dapr/dapr --untar && export DASHBOARD_VERSION=$(cat ./dapr/charts/dapr_dashboard/Chart.yaml | grep version | awk '{ print $2; exit }') && rm -rf dapr
148+
curl -L -o dapr.tgz https://github.com/dapr/helm-charts/raw/master/$DAPR_TGZ && tar -xzf dapr.tgz && export DASHBOARD_VERSION=$(cat ./dapr/charts/dapr_dashboard/Chart.yaml | grep version | awk '{ print $2; exit }') && rm -rf dapr
151149
echo "DAPR_DASHBOARD_VERSION=$DASHBOARD_VERSION" >> $GITHUB_ENV
152150
echo "Found $DASHBOARD_VERSION"
153151
shell: bash

.github/workflows/self_hosted_e2e.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ jobs:
3636
GOARCH: ${{ matrix.target_arch }}
3737
GOPROXY: https://proxy.golang.org
3838
ARCHIVE_OUTDIR: dist/archives
39-
DAPR_RUNTIME_VERSION: "1.6.0"
40-
DAPR_DASHBOARD_VERSION: 0.9.0
39+
DAPR_RUNTIME_VERSION: "1.7.0-rc.1"
40+
DAPR_DASHBOARD_VERSION: 0.10.0-rc.1
41+
DAPR_TGZ: dapr-1.7.0-rc.1.tgz
4142
strategy:
4243
matrix:
4344
os: [ubuntu-latest, macos-latest]
@@ -72,7 +73,7 @@ jobs:
7273
- name: Determine latest Dapr Dashboard version including Pre-releases
7374
if: github.base_ref == 'master'
7475
run: |
75-
helm pull dapr/dapr --untar && export DASHBOARD_VERSION=$(cat ./dapr/charts/dapr_dashboard/Chart.yaml | grep version | awk '{ print $2; exit }') && rm -rf dapr
76+
curl -L -o dapr.tgz https://github.com/dapr/helm-charts/raw/master/$DAPR_TGZ && tar -xzf dapr.tgz && export DASHBOARD_VERSION=$(cat ./dapr/charts/dapr_dashboard/Chart.yaml | grep version | awk '{ print $2; exit }') && rm -rf dapr
7677
echo "DAPR_DASHBOARD_VERSION=$DASHBOARD_VERSION" >> $GITHUB_ENV
7778
echo "Found $DASHBOARD_VERSION"
7879
shell: bash

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ e2e-build-run-sh: build test-e2e-sh
188188
################################################################################
189189
.PHONY: go.mod
190190
go.mod:
191-
go mod tidy
191+
go mod tidy -compat=1.17
192192

193193
################################################################################
194194
# Target: check-diff #

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,17 @@ If you want to invoke your app, also use this flag:
586586
$ dapr invoke --app-id nodeapp --unix-domain-socket --method mymethod
587587
```
588588

589+
### Set API log level
590+
591+
In order to set the Dapr runtime API calls log verbosity level, use the `api-log-level` flag:
592+
593+
```bash
594+
dapr run --app-id nodeapp --app-port 3000 node app.js --api-log-level info
595+
```
596+
597+
This sets the Dapr API log level to `info`.
598+
The default is `debug`.
599+
589600
For more details, please run the command and check the examples to apply to your shell.
590601

591602
## Reference for the Dapr CLI

cmd/run.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ var (
4747
metricsPort int
4848
maxRequestBodySize int
4949
unixDomainSocket string
50+
apiLogLevel string
5051
)
5152

5253
const (
@@ -115,6 +116,7 @@ dapr run --app-id myapp --app-port 3000 --app-protocol grpc -- go run main.go
115116
MetricsPort: metricsPort,
116117
MaxRequestBodySize: maxRequestBodySize,
117118
UnixDomainSocket: unixDomainSocket,
119+
APILogLevel: apiLogLevel,
118120
})
119121
if err != nil {
120122
print.FailureStatusEvent(os.Stderr, err.Error())
@@ -363,6 +365,7 @@ func init() {
363365
RunCmd.Flags().BoolP("help", "h", false, "Print this help message")
364366
RunCmd.Flags().IntVarP(&maxRequestBodySize, "dapr-http-max-request-size", "", -1, "Max size of request body in MB")
365367
RunCmd.Flags().StringVarP(&unixDomainSocket, "unix-domain-socket", "u", "", "Path to a unix domain socket dir. If specified, Dapr API servers will use Unix Domain Sockets")
368+
RunCmd.Flags().StringVarP(&apiLogLevel, "api-log-level", "", "debug", "The api calls log verbosity. Valid values are: debug, info, off")
366369

367370
RootCmd.AddCommand(RunCmd)
368371
}

go.mod

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.17
55
require (
66
github.com/Pallinder/sillyname-go v0.0.0-20130730142914-97aeae9e6ba1
77
github.com/briandowns/spinner v1.6.1
8-
github.com/dapr/dapr v1.6.0
8+
github.com/dapr/dapr v1.7.0-rc.1
99
github.com/dapr/go-sdk v1.0.0
1010
github.com/docker/docker v20.10.12+incompatible
1111
github.com/fatih/color v1.13.0
@@ -21,7 +21,7 @@ require (
2121
github.com/spf13/cobra v1.3.0
2222
github.com/spf13/viper v1.10.0
2323
github.com/stretchr/testify v1.7.0
24-
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e
24+
golang.org/x/sys v0.0.0-20220204135822-1c1b9b1eba6a
2525
gopkg.in/yaml.v2 v2.4.0
2626
helm.sh/helm/v3 v3.8.1
2727
k8s.io/api v0.23.4
@@ -99,7 +99,7 @@ require (
9999
github.com/jmoiron/sqlx v1.3.4 // indirect
100100
github.com/josharian/intern v1.0.0 // indirect
101101
github.com/json-iterator/go v1.1.12 // indirect
102-
github.com/klauspost/compress v1.13.6 // indirect
102+
github.com/klauspost/compress v1.14.4 // indirect
103103
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
104104
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
105105
github.com/lib/pq v1.10.4 // indirect
@@ -131,7 +131,7 @@ require (
131131
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
132132
github.com/pkg/errors v0.9.1 // indirect
133133
github.com/pmezard/go-difflib v1.0.0 // indirect
134-
github.com/prometheus/client_golang v1.11.0 // indirect
134+
github.com/prometheus/client_golang v1.11.1 // indirect
135135
github.com/prometheus/client_model v0.2.0 // indirect
136136
github.com/prometheus/common v0.32.1 // indirect
137137
github.com/prometheus/procfs v0.7.3 // indirect
@@ -152,13 +152,13 @@ require (
152152
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
153153
github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca // indirect
154154
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
155-
golang.org/x/crypto v0.0.0-20211117183948-ae814b36b871 // indirect
155+
golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838 // indirect
156156
golang.org/x/net v0.0.0-20220107192237-5cfca573fb4d // indirect
157157
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
158158
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
159159
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
160160
golang.org/x/text v0.3.7 // indirect
161-
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
161+
golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 // indirect
162162
google.golang.org/appengine v1.6.7 // indirect
163163
google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368 // indirect
164164
google.golang.org/grpc v1.43.0 // indirect

0 commit comments

Comments
 (0)