As we reevaluate how to best support and maintain Staging Ref in the future, we encourage development teams using this environment to highlight their use cases in the following issue: https://gitlab.com/gitlab-com/gl-infra/software-delivery/framework/software-delivery-framework-issue-tracker/-/issues/36.

Skip to content
Snippets Groups Projects
Unverified Commit be9c3633 authored by Ash McKenzie's avatar Ash McKenzie Committed by GitLab
Browse files

Add basic LFS connections metric for HTTP

parent 22609329
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -16,6 +16,7 @@ import (
"gitlab.com/gitlab-org/gitlab-shell/v14/internal/command/uploadarchive"
"gitlab.com/gitlab-org/gitlab-shell/v14/internal/command/uploadpack"
"gitlab.com/gitlab-org/gitlab-shell/v14/internal/config"
"gitlab.com/gitlab-org/gitlab-shell/v14/internal/metrics"
"gitlab.com/gitlab-org/gitlab-shell/v14/internal/sshenv"
)
Loading
Loading
@@ -115,6 +116,7 @@ func Build(args *commandargs.Shell, config *config.Config, readWriter *readwrite
case commandargs.TwoFactorVerify:
return &twofactorverify.Command{Config: config, Args: args, ReadWriter: readWriter}
case commandargs.LfsAuthenticate:
metrics.LfsHTTPConnectionsTotal.Inc()
return &lfsauthenticate.Command{Config: config, Args: args, ReadWriter: readWriter}
case commandargs.LfsTransfer:
if config.LFSConfig.PureSSHProtocol {
Loading
Loading
Loading
Loading
@@ -4,6 +4,7 @@ import (
"errors"
"testing"
"github.com/prometheus/client_golang/prometheus/testutil"
"github.com/stretchr/testify/require"
cmd "gitlab.com/gitlab-org/gitlab-shell/v14/cmd/gitlab-shell/command"
"gitlab.com/gitlab-org/gitlab-shell/v14/internal/command/commandargs"
Loading
Loading
@@ -19,6 +20,7 @@ import (
"gitlab.com/gitlab-org/gitlab-shell/v14/internal/command/uploadpack"
"gitlab.com/gitlab-org/gitlab-shell/v14/internal/config"
"gitlab.com/gitlab-org/gitlab-shell/v14/internal/executable"
"gitlab.com/gitlab-org/gitlab-shell/v14/internal/metrics"
"gitlab.com/gitlab-org/gitlab-shell/v14/internal/sshenv"
)
Loading
Loading
@@ -104,6 +106,21 @@ func TestNew(t *testing.T) {
}
}
func TestLFSAuthenticateCommands(t *testing.T) {
arguments := []string{}
env := buildEnv("git-lfs-authenticate")
config := &config.Config{GitlabUrl: "http+unix://gitlab.socket"}
lfsHTTPConnectionsTotal := testutil.ToFloat64(metrics.LfsHTTPConnectionsTotal)
command, err := cmd.New(arguments, env, config, nil)
require.NoError(t, err)
require.IsType(t, &lfsauthenticate.Command{}, command)
require.InDelta(t, lfsHTTPConnectionsTotal+1, testutil.ToFloat64(metrics.LfsHTTPConnectionsTotal), 0)
}
func TestLFSTransferCommands(t *testing.T) {
testCases := []struct {
desc string
Loading
Loading
Loading
Loading
@@ -27,6 +27,8 @@ const (
sliSshdSessionsTotalName = "gitlab_sli:shell_sshd_sessions:total"
sliSshdSessionsErrorsTotalName = "gitlab_sli:shell_sshd_sessions:errors_total"
lfsHTTPConnectionsTotalName = "lfs_http_connections_total"
gitalyConnectionsTotalName = "connections_total"
)
Loading
Loading
@@ -143,6 +145,13 @@ var (
Help: "A gauge of requests currently being performed.",
},
)
LfsHTTPConnectionsTotal = promauto.NewCounter(
prometheus.CounterOpts{
Name: lfsHTTPConnectionsTotalName,
Help: "Number of LFS over HTTP connections that have been established",
},
)
)
func NewRoundTripper(next http.RoundTripper) promhttp.RoundTripperFunc {
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment