Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Sharkey
Manage
Activity
Members
Labels
Plan
Issues
338
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
28
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TransFem.org
Sharkey
Commits
4f987a37
Verified
Commit
4f987a37
authored
6 months ago
by
4censord
💬
Browse files
Options
Downloads
Patches
Plain Diff
Instrument DeliveryProcessor for jobmetrics
parent
e0f89f7d
No related branches found
Branches containing commit
Tags
13.10.3
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
packages/backend/src/misc/metrics.ts
+7
-0
7 additions, 0 deletions
packages/backend/src/misc/metrics.ts
packages/backend/src/queue/processors/DeliverProcessorService.ts
+9
-1
9 additions, 1 deletion
...s/backend/src/queue/processors/DeliverProcessorService.ts
with
16 additions
and
1 deletion
packages/backend/src/misc/metrics.ts
0 → 100644
+
7
−
0
View file @
4f987a37
import
{
register
,
Counter
,
Gauge
}
from
'
prom-client
'
export
const
jobs_metrics
=
new
Counter
({
name
:
"
sharkey_jobs
"
,
help
:
"
Metrics about jobs
"
,
labelNames
:
[
'
job
'
,
'
status
'
,
'
reason
'
]
as const
,
});
This diff is collapsed.
Click to expand it.
packages/backend/src/queue/processors/DeliverProcessorService.ts
+
9
−
1
View file @
4f987a37
...
...
@@ -24,6 +24,8 @@ import { bindThis } from '@/decorators.js';
import
{
QueueLoggerService
}
from
'
../QueueLoggerService.js
'
;
import
type
{
DeliverJobData
}
from
'
../types.js
'
;
import
{
jobs_metrics
}
from
'
@/misc/metrics.js
'
@
Injectable
()
export
class
DeliverProcessorService
{
private
logger
:
Logger
;
...
...
@@ -55,6 +57,7 @@ export class DeliverProcessorService {
// ブロックしてたら中断
const
meta
=
await
this
.
metaService
.
fetch
();
if
(
this
.
utilityService
.
isBlockedHost
(
meta
.
blockedHosts
,
this
.
utilityService
.
toPuny
(
host
)))
{
jobs_metrics
.
inc
({
job
:
'
delivery
'
,
status
:
'
skipped
'
,
reason
:
'
blocked
'
});
return
'
skip (blocked)
'
;
}
...
...
@@ -69,6 +72,7 @@ export class DeliverProcessorService {
this
.
suspendedHostsCache
.
set
(
suspendedHosts
);
}
if
(
suspendedHosts
.
map
(
x
=>
x
.
host
).
includes
(
this
.
utilityService
.
toPuny
(
host
)))
{
jobs_metrics
.
inc
({
job
:
'
delivery
'
,
status
:
'
skipped
'
,
reason
:
'
suspended
'
});
return
'
skip (suspended)
'
;
}
...
...
@@ -92,7 +96,7 @@ export class DeliverProcessorService {
this
.
instanceChart
.
requestSent
(
i
.
host
,
true
);
}
});
jobs_metrics
.
inc
({
job
:
'
delivery
'
,
status
:
'
success
'
,
reason
:
''
});
return
'
Success
'
;
}
catch
(
res
)
{
// Update stats
...
...
@@ -135,15 +139,19 @@ export class DeliverProcessorService {
suspensionState
:
'
goneSuspended
'
,
});
});
jobs_metrics
.
inc
({
job
:
'
delivery
'
,
status
:
'
failed
'
,
reason
:
'
gone
'
});
throw
new
Bull
.
UnrecoverableError
(
`
${
host
}
is gone`
);
}
jobs_metrics
.
inc
({
job
:
'
delivery
'
,
status
:
'
failed
'
,
reason
:
res
.
statusCode
});
throw
new
Bull
.
UnrecoverableError
(
`
${
res
.
statusCode
}
${
res
.
statusMessage
}
`
);
}
// 5xx etc.
jobs_metrics
.
inc
({
job
:
'
delivery
'
,
status
:
'
failed
'
,
reason
:
'
remote_error
'
});
throw
new
Error
(
`
${
res
.
statusCode
}
${
res
.
statusMessage
}
`
);
}
else
{
// DNS error, socket error, timeout ...
jobs_metrics
.
inc
({
job
:
'
delivery
'
,
status
:
'
retrying
'
,
reason
:
'
remote_error
'
});
throw
res
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment