Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-scrubber
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Platform
Development
swh-scrubber
Commits
5573b1b9
Commit
5573b1b9
authored
11 months ago
by
Antoine Lambert
Browse files
Options
Downloads
Patches
Plain Diff
base_checker: Set statsd constant tags in base checker classes
parent
d8c04aaa
No related branches found
Branches containing commit
No related tags found
Tags containing commit
3 merge requests
!69
cli: Add support for scrubbbing an object storage
,
!66
objstorage_checker: Use check method from object storage interface
,
!65
objstorage_checker: Add support for consuming content ids from journal
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
swh/scrubber/base_checker.py
+12
-13
12 additions, 13 deletions
swh/scrubber/base_checker.py
swh/scrubber/journal_checker.py
+1
-7
1 addition, 7 deletions
swh/scrubber/journal_checker.py
swh/scrubber/objstorage_checker.py
+0
-1
0 additions, 1 deletion
swh/scrubber/objstorage_checker.py
with
13 additions
and
21 deletions
swh/scrubber/base_checker.py
+
12
−
13
View file @
5573b1b9
...
...
@@ -29,10 +29,14 @@ class BaseChecker(ABC):
):
self
.
db
=
db
self
.
config_id
=
config_id
self
.
statsd_constant_tags
:
Dict
[
str
,
Any
]
=
{}
self
.
_config
:
Optional
[
ConfigEntry
]
=
None
self
.
_statsd
:
Optional
[
Statsd
]
=
None
self
.
statsd_constant_tags
:
Dict
[
str
,
Any
]
=
{
"
object_type
"
:
self
.
object_type
.
name
.
lower
(),
"
datastore_package
"
:
self
.
datastore
.
package
,
"
datastore_cls
"
:
self
.
datastore
.
cls
,
"
datastore_instance
"
:
self
.
datastore
.
instance
,
}
@property
def
config
(
self
)
->
ConfigEntry
:
...
...
@@ -59,6 +63,11 @@ class BaseChecker(ABC):
)
return
self
.
_statsd
@property
def
object_type
(
self
)
->
swhids
.
ObjectType
:
"""
Returns the type of object being checked.
"""
return
self
.
config
.
object_type
@property
def
check_hashes
(
self
)
->
bool
:
return
self
.
config
.
check_hashes
...
...
@@ -84,17 +93,7 @@ class BasePartitionChecker(BaseChecker):
):
super
().
__init__
(
db
=
db
,
config_id
=
config_id
)
self
.
limit
=
limit
self
.
statsd_constant_tags
=
{
"
object_type
"
:
self
.
object_type
,
"
nb_partitions
"
:
self
.
nb_partitions
,
"
datastore_package
"
:
self
.
datastore
.
package
,
"
datastore_cls
"
:
self
.
datastore
.
cls
,
}
@property
def
object_type
(
self
)
->
swhids
.
ObjectType
:
"""
Returns the type of object being checked.
"""
return
self
.
config
.
object_type
self
.
statsd_constant_tags
[
"
nb_partitions
"
]
=
self
.
nb_partitions
@property
def
nb_partitions
(
self
)
->
int
:
...
...
This diff is collapsed.
Click to expand it.
swh/scrubber/journal_checker.py
+
1
−
7
View file @
5573b1b9
...
...
@@ -49,10 +49,6 @@ class JournalChecker(BaseChecker):
self
,
db
:
ScrubberDb
,
config_id
:
int
,
journal_client_config
:
Dict
[
str
,
Any
]
):
super
().
__init__
(
db
=
db
,
config_id
=
config_id
)
self
.
statsd_constant_tags
=
{
"
datastore_package
"
:
self
.
datastore
.
package
,
"
datastore_cls
"
:
self
.
datastore
.
cls
,
}
if
self
.
config
.
check_references
:
raise
ValueError
(
...
...
@@ -66,9 +62,7 @@ class JournalChecker(BaseChecker):
"
The journal_client configuration entry should not define the
"
"
object_types field; this is handled by the scrubber configuration entry
"
)
self
.
journal_client_config
[
"
object_types
"
]
=
[
self
.
config
.
object_type
.
name
.
lower
()
]
self
.
journal_client_config
[
"
object_types
"
]
=
[
self
.
object_type
.
name
.
lower
()]
self
.
journal_client
=
get_journal_client
(
**
self
.
journal_client_config
,
# Remove default deserializer; so process_kafka_values() gets the message
...
...
This diff is collapsed.
Click to expand it.
swh/scrubber/objstorage_checker.py
+
0
−
1
View file @
5573b1b9
...
...
@@ -49,7 +49,6 @@ class ObjectStorageChecker(BasePartitionChecker):
self
.
objstorage
=
(
objstorage
if
objstorage
is
not
None
else
getattr
(
storage
,
"
objstorage
"
)
)
self
.
statsd_constant_tags
[
"
datastore_instance
"
]
=
self
.
datastore
.
instance
def
check_partition
(
self
,
object_type
:
ObjectType
,
partition_id
:
int
)
->
None
:
if
object_type
!=
ObjectType
.
CONTENT
:
...
...
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