From b6439118829a09a4c8c49d7692d38df0dff7e7ae Mon Sep 17 00:00:00 2001 From: joshhunt Date: Tue, 1 Jul 2025 12:24:31 +0100 Subject: [PATCH] less logs --- pkg/build/e2e-playwright/service.go | 9 +++++---- scripts/grafana-server/custom.ini | 5 +++++ scripts/grafana-server/start-server | 23 ++++++++++++----------- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/pkg/build/e2e-playwright/service.go b/pkg/build/e2e-playwright/service.go index c866bc60520..2deb6daf5e5 100644 --- a/pkg/build/e2e-playwright/service.go +++ b/pkg/build/e2e-playwright/service.go @@ -17,7 +17,7 @@ type GrafanaServiceOpts struct { func GrafanaService(ctx context.Context, d *dagger.Client, opts GrafanaServiceOpts) (*dagger.Service, error) { container := d.Container().From("alpine:3"). - WithExec([]string{"apk", "add", "--no-cache", "bash", "tar", "netcat-openbsd"}). + WithExec([]string{"apk", "add", "--no-cache", "bash", "tar", "netcat-openbsd", "util-linux"}). WithMountedFile("/src/grafana.tar.gz", opts.GrafanaTarGz). WithExec([]string{"mkdir", "-p", "/src/grafana"}). WithExec([]string{"tar", "--strip-components=1", "-xzf", "/src/grafana.tar.gz", "-C", "/src/grafana"}). @@ -25,9 +25,10 @@ func GrafanaService(ctx context.Context, d *dagger.Client, opts GrafanaServiceOp WithDirectory("/src/grafana/e2e/test-plugins", opts.HostSrc.Directory("./e2e/test-plugins")). WithDirectory("/src/grafana/scripts", opts.HostSrc.Directory("./scripts")). WithWorkdir("/src/grafana"). - WithEnvVariable("GF_APP_MODE", "development"). + // Only set config variables here that are specific to the dagger/GHA runner. + // Prefer to configure scripts/grafana-server/custom.ini instead so they're also used + // when running locally. WithEnvVariable("GF_SERVER_HTTP_PORT", fmt.Sprint(grafanaPort)). - WithEnvVariable("GF_SERVER_ROUTER_LOGGING", "1"). WithExposedPort(grafanaPort) var licenseArg string @@ -45,7 +46,7 @@ func GrafanaService(ctx context.Context, d *dagger.Client, opts GrafanaServiceOp } } - svc := container.AsService(dagger.ContainerAsServiceOpts{Args: []string{"bash", "-x", "scripts/grafana-server/start-server", licenseArg}}) + svc := container.AsService(dagger.ContainerAsServiceOpts{Args: []string{"bash", "scripts/grafana-server/start-server", licenseArg}}) return svc, nil } diff --git a/scripts/grafana-server/custom.ini b/scripts/grafana-server/custom.ini index 68968c502fa..d8e92d8782e 100644 --- a/scripts/grafana-server/custom.ini +++ b/scripts/grafana-server/custom.ini @@ -1,3 +1,8 @@ +app_mode = development + +[log] +level = error +filters = http.server:info,settings:info [security] content_security_policy = true diff --git a/scripts/grafana-server/start-server b/scripts/grafana-server/start-server index 6162439a299..15a3261dd9f 100755 --- a/scripts/grafana-server/start-server +++ b/scripts/grafana-server/start-server @@ -60,17 +60,18 @@ cp devenv/dashboards.yaml $PROV_DIR/dashboards cp devenv/alert_rules.yaml $PROV_DIR/alerting cp devenv/plugins.yaml $PROV_DIR/plugins -cp -r devenv $RUNDIR +cp -r devenv $ -echo -e "Starting Grafana Server port $PORT" +echo -e "Starting Grafana server port $PORT" -$RUNDIR/bin/"$ARCH"grafana-server \ - --homepath=$HOME_PATH \ - --pidfile=$RUNDIR/pid \ - cfg:server.http_port=$PORT \ - cfg:server.router_logging=1 \ - cfg:app_mode=development \ - cfg:enterprise.license_path=$1 -# 2>&1 > $RUNDIR/output.log & -# cfg:log.level=debug \ +# We get a lot of "context canceled" errors from navigating away from pages, +# so filter them out because they're not useful +{ + exec "$RUNDIR/bin/${ARCH}grafana" server \ + --homepath="$HOME_PATH" \ + --pidfile="$RUNDIR/pid" \ + cfg:server.http_port="$PORT" \ + cfg:enterprise.license_path="$1" \ + 2>&1 +} | grep -v -i "context canceled" \ No newline at end of file