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 9d7ea153 authored by Vasilii Iakliushin's avatar Vasilii Iakliushin Committed by GitLab
Browse files

Merge branch '767-ensure-lfs-protocol-logic-has-prometheus-metrics' into 'main'

parents 0653124b 3c042d0c
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -120,6 +120,7 @@ func Build(args *commandargs.Shell, config *config.Config, readWriter *readwrite
return &lfsauthenticate.Command{Config: config, Args: args, ReadWriter: readWriter}
case commandargs.LfsTransfer:
if config.LFSConfig.PureSSHProtocol {
metrics.LfsSSHConnectionsTotal.Inc()
return &lfstransfer.Command{Config: config, Args: args, ReadWriter: readWriter}
}
case commandargs.ReceivePack:
Loading
Loading
Loading
Loading
@@ -151,11 +151,16 @@ func TestLFSTransferCommands(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.desc, func(t *testing.T) {
lfsSSHConnectionsTotal := testutil.ToFloat64(metrics.LfsSSHConnectionsTotal)
command, err := cmd.New(tc.arguments, tc.env, tc.config, nil)
if len(tc.errorString) > 0 {
require.Equal(t, err.Error(), tc.errorString)
} else {
require.InDelta(t, lfsSSHConnectionsTotal+1, testutil.ToFloat64(metrics.LfsSSHConnectionsTotal), 0)
}
require.IsType(t, tc.expectedType, command)
})
}
Loading
Loading
Loading
Loading
@@ -56,6 +56,8 @@ func (c *Command) Execute(ctx context.Context) (context.Context, error) {
accessResponse.RootNamespaceID,
))
log.WithContextFields(ctxWithLogData, log.Fields{"action": action}).Info("processing action")
auth, err := c.authenticate(ctx, operation, repo, accessResponse.UserID)
if err != nil {
return ctxWithLogData, err
Loading
Loading
@@ -81,7 +83,8 @@ func (c *Command) Execute(ctx context.Context) (context.Context, error) {
}
p := transfer.NewProcessor(handler, backend, logger)
defer log.WithContextFields(ctxWithLogData, log.Fields{}).Info("done processing commands")
defer log.WithContextFields(ctxWithLogData, log.Fields{"action": action}).Info("done processing commands")
switch operation {
case transfer.DownloadOperation:
return ctxWithLogData, p.ProcessCommands(transfer.DownloadOperation)
Loading
Loading
Loading
Loading
@@ -28,6 +28,7 @@ const (
sliSshdSessionsErrorsTotalName = "gitlab_sli:shell_sshd_sessions:errors_total"
lfsHTTPConnectionsTotalName = "lfs_http_connections_total"
lfsSSHConnectionsTotalName = "lfs_ssh_connections_total"
gitalyConnectionsTotalName = "connections_total"
)
Loading
Loading
@@ -152,6 +153,13 @@ var (
Help: "Number of LFS over HTTP connections that have been established",
},
)
LfsSSHConnectionsTotal = promauto.NewCounter(
prometheus.CounterOpts{
Name: lfsSSHConnectionsTotalName,
Help: "Number of LFS over SSH 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