Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added api-log-level flag to log api calls #903

Merged
merged 18 commits into from
Mar 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions .github/workflows/kind_e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ jobs:
runs-on: ubuntu-latest
env:
GOVER: 1.17
DAPR_RUNTIME_VERSION: 1.6.0
DAPR_DASHBOARD_VERSION: 0.9.0
DAPR_RUNTIME_VERSION: 1.7.0-rc.1
DAPR_DASHBOARD_VERSION: 0.10.0-rc.1
DAPR_TGZ: dapr-1.7.0-rc.1.tgz
strategy:
fail-fast: false # Keep running if one leg fails.
matrix:
Expand Down Expand Up @@ -115,10 +116,8 @@ jobs:
- role: worker
image: kindest/node:${{ matrix.k8s-version }}@${{ matrix.kind-image-sha }}
EOF

# Log the generated kind.yaml for easy reference.
cat kind.yaml

- name: Create KinD Cluster
uses: helm/kind-action@v1.0.0
with:
Expand All @@ -133,7 +132,6 @@ jobs:
-lkubernetes.io/hostname!=kind-control-plane \
-ojsonpath='{.items[0].status.addresses[?(@.type=="InternalIP")].address}')
echo "MINIKUBE_NODE_IP=$NODE_IP" >> $GITHUB_ENV

- name: Free up some diskspace
run: |
docker image prune -a -f
Expand All @@ -147,7 +145,7 @@ jobs:
- name: Determine latest Dapr Dashboard version including Pre-releases
if: github.base_ref == 'master'
run: |
helm pull dapr/dapr --untar && export DASHBOARD_VERSION=$(cat ./dapr/charts/dapr_dashboard/Chart.yaml | grep version | awk '{ print $2; exit }') && rm -rf dapr
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
echo "DAPR_DASHBOARD_VERSION=$DASHBOARD_VERSION" >> $GITHUB_ENV
echo "Found $DASHBOARD_VERSION"
shell: bash
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/self_hosted_e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ jobs:
GOARCH: ${{ matrix.target_arch }}
GOPROXY: https://proxy.golang.org
ARCHIVE_OUTDIR: dist/archives
DAPR_RUNTIME_VERSION: "1.6.0"
DAPR_DASHBOARD_VERSION: 0.9.0
DAPR_RUNTIME_VERSION: "1.7.0-rc.1"
DAPR_DASHBOARD_VERSION: 0.10.0-rc.1
DAPR_TGZ: dapr-1.7.0-rc.1.tgz
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
Expand Down Expand Up @@ -72,7 +73,7 @@ jobs:
- name: Determine latest Dapr Dashboard version including Pre-releases
if: github.base_ref == 'master'
run: |
helm pull dapr/dapr --untar && export DASHBOARD_VERSION=$(cat ./dapr/charts/dapr_dashboard/Chart.yaml | grep version | awk '{ print $2; exit }') && rm -rf dapr
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
echo "DAPR_DASHBOARD_VERSION=$DASHBOARD_VERSION" >> $GITHUB_ENV
echo "Found $DASHBOARD_VERSION"
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ e2e-build-run-sh: build test-e2e-sh
################################################################################
.PHONY: go.mod
go.mod:
go mod tidy
go mod tidy -compat=1.17

################################################################################
# Target: check-diff #
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,17 @@ If you want to invoke your app, also use this flag:
$ dapr invoke --app-id nodeapp --unix-domain-socket --method mymethod
```

### Set API log level

In order to set the Dapr runtime API calls log verbosity level, use the `api-log-level` flag:

```bash
dapr run --app-id nodeapp --app-port 3000 node app.js --api-log-level info
```

This sets the Dapr API log level to `info`.
The default is `debug`.

For more details, please run the command and check the examples to apply to your shell.

## Reference for the Dapr CLI
Expand Down
3 changes: 3 additions & 0 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ var (
metricsPort int
maxRequestBodySize int
unixDomainSocket string
apiLogLevel string
)

const (
Expand Down Expand Up @@ -115,6 +116,7 @@ dapr run --app-id myapp --app-port 3000 --app-protocol grpc -- go run main.go
MetricsPort: metricsPort,
MaxRequestBodySize: maxRequestBodySize,
UnixDomainSocket: unixDomainSocket,
APILogLevel: apiLogLevel,
})
if err != nil {
print.FailureStatusEvent(os.Stderr, err.Error())
Expand Down Expand Up @@ -363,6 +365,7 @@ func init() {
RunCmd.Flags().BoolP("help", "h", false, "Print this help message")
RunCmd.Flags().IntVarP(&maxRequestBodySize, "dapr-http-max-request-size", "", -1, "Max size of request body in MB")
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")
RunCmd.Flags().StringVarP(&apiLogLevel, "api-log-level", "", "debug", "The api calls log verbosity. Valid values are: debug, info, off")

RootCmd.AddCommand(RunCmd)
}
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.17
require (
github.com/Pallinder/sillyname-go v0.0.0-20130730142914-97aeae9e6ba1
github.com/briandowns/spinner v1.6.1
github.com/dapr/dapr v1.6.0
github.com/dapr/dapr v1.7.0-rc.1
github.com/dapr/go-sdk v1.0.0
github.com/docker/docker v20.10.12+incompatible
github.com/fatih/color v1.13.0
Expand All @@ -21,7 +21,7 @@ require (
github.com/spf13/cobra v1.3.0
github.com/spf13/viper v1.10.0
github.com/stretchr/testify v1.7.0
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e
golang.org/x/sys v0.0.0-20220204135822-1c1b9b1eba6a
gopkg.in/yaml.v2 v2.4.0
helm.sh/helm/v3 v3.8.1
k8s.io/api v0.23.4
Expand Down Expand Up @@ -99,7 +99,7 @@ require (
github.com/jmoiron/sqlx v1.3.4 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.13.6 // indirect
github.com/klauspost/compress v1.14.4 // indirect
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
github.com/lib/pq v1.10.4 // indirect
Expand Down Expand Up @@ -131,7 +131,7 @@ require (
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.11.0 // indirect
github.com/prometheus/client_golang v1.11.1 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
Expand All @@ -152,13 +152,13 @@ require (
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca // indirect
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
golang.org/x/crypto v0.0.0-20211117183948-ae814b36b871 // indirect
golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838 // indirect
golang.org/x/net v0.0.0-20220107192237-5cfca573fb4d // indirect
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368 // indirect
google.golang.org/grpc v1.43.0 // indirect
Expand Down
Loading