Skip to content

Add metrics for measure delete progress - #181

Merged
reshke merged 6 commits into
masterfrom
AddDeleteMetrics
Jul 28, 2026
Merged

Add metrics for measure delete progress#181
reshke merged 6 commits into
masterfrom
AddDeleteMetrics

Conversation

@leborchuk

@leborchuk leborchuk commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Here we add prometheus metrics to measure deletion progress.

The main metrics are DeleteProcessTotal && DeleteProcessProcessed. They are operation-specific, reported after completed listing operation.

To measure we instrument each operation by specific prometheus object (from promauto space) and increment metrics on each completed operation. The same for the operation latency

Copilot AI review requested due to automatic review settings July 28, 2026 13:02
@leborchuk
leborchuk marked this pull request as draft July 28, 2026 13:02
Comment thread pkg/proc/delete_handler_test.go Dismissed
Comment thread pkg/proc/delete_handler_test.go Dismissed
Comment thread pkg/proc/delete_handler_test.go Dismissed
Comment thread pkg/proc/delete_handler_test.go Dismissed
Comment thread pkg/proc/delete_handler_test.go Dismissed
Comment thread pkg/proc/delete_handler_test.go Dismissed
Comment thread pkg/proc/delete_handler_test.go Dismissed
Comment thread pkg/proc/delete_handler_test.go Dismissed
Comment thread pkg/proc/delete_handler_test.go Dismissed
@github-actions

This comment has been minimized.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Prometheus instrumentation to track progress and performance of long-running delete / garbage-collection operations in pkg/proc, along with documentation and unit tests to validate metric behavior.

Changes:

  • Introduces new per-bucket/per-operation delete progress and request metrics (pkg/metrics/delete_metrics.go).
  • Instruments delete/untrashify handlers to report batch totals, remaining items, processed/deleted/kept counts, and list/delete latency/size.
  • Documents the new metrics in README.md and adds unit tests asserting the emitted values.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
README.md Documents new delete/GC metrics and their labels (bucket, operation, stage).
pkg/proc/delete_handler.go Emits delete/untrashify progress + latency/size metrics during handler execution.
pkg/proc/delete_handler_test.go Adds tests to verify metrics are recorded for success/failure/retry paths.
pkg/metrics/delete_metrics.go Defines new Prometheus gauge/counter/histogram vectors and a small tracker helper.
go.mod Promotes github.com/prometheus/client_model to a direct dependency for test metric inspection.
Comments suppressed due to low confidence (1)

pkg/proc/delete_handler.go:147

  • On a dry-run (Confirm == false), delete_process_remaining is left at len(fileList) even though the handler exits immediately. This can make operational dashboards/alerts think a delete is stuck.

Consider resetting delete_process_remaining before returning.

	if !msg.Confirm { // Do not delete files if no confirmation flag provided
		ylogger.Zero.Info().Str("bucket", bucket).Msg("do not perform actual delete files as no confirmation flag provided")
		return nil
	}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/proc/delete_handler.go
Comment thread pkg/proc/delete_handler.go
Comment thread pkg/metrics/delete_metrics.go
@github-actions

This comment has been minimized.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@leborchuk
leborchuk marked this pull request as ready for review July 28, 2026 13:57
Comment thread pkg/proc/delete_handler.go Outdated
Comment thread pkg/proc/delete_handler.go
@github-actions

This comment has been minimized.

Comment thread pkg/proc/delete_handler.go Outdated
Comment thread pkg/proc/delete_handler.go
Comment thread pkg/proc/delete_handler.go Outdated
Comment thread pkg/proc/delete_handler.go
Comment thread pkg/proc/delete_handler.go Outdated
Comment thread pkg/proc/delete_handler.go Outdated
Comment thread pkg/proc/delete_handler.go
@github-actions

Copy link
Copy Markdown

@check-spelling-bot Report

🔴 Please review

See the 📂 files view, the 📜action log, 👼 SARIF report, or 📝 job summary for details.

Unrecognized words (3)

dto
testutil
vec

These words are not needed and should be removed testutils Vec

To accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands

... in a clone of the git@github.com:open-gpdb/yproxy.git repository
on the AddDeleteMetrics branch (ℹ️ how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/main/apply.pl' |
perl - 'https://github.com/open-gpdb/yproxy/actions/runs/30374199288/attempts/1' &&
git commit -m 'Update check-spelling metadata'

OR

To have the bot accept them for you, comment in the PR quoting the following line:
@check-spelling-bot apply updates.

Available 📚 dictionaries could cover words (expected and unrecognized) not in the 📘 dictionary

This includes both expected items (269) from .github/actions/spelling/expect.txt and unrecognized words (3)

Dictionary Entries Covers Uniquely
cspell:golang/dict/go.txt 2099 15 5
cspell:node/dict/node.txt 891 15 2
cspell:php/dict/php.txt 1689 15 2
cspell:python/src/python/python-lib.txt 2417 14 2
cspell:dotnet/dict/dotnet.txt 405 7
cspell:filetypes/filetypes.txt 264 5 1
cspell:fullstack/dict/fullstack.txt 419 5 1
cspell:java/src/java.txt 2464 5 2
cspell:python/src/python/python.txt 392 5
cspell:typescript/dict/typescript.txt 1098 4 1
cspell:k8s/dict/k8s.txt 153 4
cspell:r/src/r.txt 543 4
cspell:django/dict/django.txt 393 3 2
cspell:aws/aws.txt 218 3 1
cspell:cpp/src/stdlib-c.txt 278 3 1
cspell:rust/dict/rust.txt 30 3
cspell:scala/dict/scala.txt 153 3
cspell:cpp/src/stdlib-cpp.txt 252 3
cspell:npm/dict/npm.txt 302 3
cspell:lua/dict/lua.txt 190 2 1

Consider adding them (in .github/workflows/spelling.yaml) in jobs:/spelling: for uses: check-spelling/check-spelling@main in its with to extra_dictionaries:

            cspell:golang/dict/go.txt
            cspell:node/dict/node.txt
            cspell:php/dict/php.txt
            cspell:python/src/python/python-lib.txt
            cspell:dotnet/dict/dotnet.txt
            cspell:filetypes/filetypes.txt
            cspell:fullstack/dict/fullstack.txt
            cspell:java/src/java.txt
            cspell:python/src/python/python.txt
            cspell:typescript/dict/typescript.txt
            cspell:k8s/dict/k8s.txt
            cspell:r/src/r.txt
            cspell:django/dict/django.txt
            cspell:aws/aws.txt
            cspell:cpp/src/stdlib-c.txt
            cspell:rust/dict/rust.txt
            cspell:scala/dict/scala.txt
            cspell:cpp/src/stdlib-cpp.txt
            cspell:npm/dict/npm.txt
            cspell:lua/dict/lua.txt

To stop checking additional dictionaries, add (in .github/workflows/spelling.yaml) for uses: check-spelling/check-spelling@main in its with:

check_extra_dictionaries: ""
Pattern suggestions ✂️ (11)

You could add these patterns to .github/actions/spelling/patterns.txt:

# Automatically suggested patterns

# hit-count: 13 file-count: 8
# https/http/file urls
(?:\b(?:https?|ftp|file)://)[-A-Za-z0-9+&@#/*%?=~_|!:,.;]+[-A-Za-z0-9+&@#/*%=~_|]

# hit-count: 8 file-count: 2
# version suffix <word>v#
(?:(?<=[A-Z]{2})V|(?<=[a-z]{2}|[A-Z]{2})v)\d+(?:\b|(?=[a-zA-Z_]))

# hit-count: 5 file-count: 1
# in check-spelling@v0.0.22+, printf markers aren't automatically consumed
# printf markers
(?<!\\)\\[nrt](?=[a-z]{2,})

# hit-count: 5 file-count: 1
# alternate printf markers if you run into latex and friends
(?<!\\)\\[nrt](?=[a-z]{2,})(?=.*['"`])

# hit-count: 4 file-count: 4
# uuencoded
[!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_]{40,}

# hit-count: 4 file-count: 2
# C network byte conversions
(?:\d|\bh)to(?!ken)(?=[a-z])|to(?=[adhiklpun]\()

# hit-count: 4 file-count: 1
# container images
image: [-\w./:@]+

# hit-count: 1 file-count: 1
# scala imports
^import (?:[\w.]|\{\w*?(?:,\s*(?:\w*|\*))+\})+

# hit-count: 1 file-count: 1
# Debian changelog severity
[-\w]+ \(.*\) (?:\w+|baseline|unstable|experimental); urgency=(?:low|medium|high|emergency|critical)\b

# hit-count: 1 file-count: 1
# Compiler flags (Unix, Java/Scala)
# Use if you have things like `-Pdocker` and want to treat them as `docker`
(?:^|[\t ,>"'`=(])-(?:(?:J-|)[DPWXY]|[Llf])(?=[A-Z]{2,}|[A-Z][a-z]|[a-z]{2,})

# hit-count: 1 file-count: 1
# Compiler flags (Windows / PowerShell)
# This is a subset of the more general compiler flags pattern.
# It avoids matching `-Path` to prevent it from being treated as `ath`
(?:^|[\t ,"'`=(])-(?:[DPL](?=[A-Z]{2,})|[WXYlf](?=[A-Z]{2,}|[A-Z][a-z]|[a-z]{2,}))

Alternatively, if a pattern suggestion doesn't make sense for this project, add a # to the beginning of the line in the candidates file with the pattern to stop suggesting it.

Notices ℹ️ (2)

See the 📂 files view, the 📜action log, 👼 SARIF report, or 📝 job summary for details.

ℹ️ Notices Count
ℹ️ candidate-pattern 17
ℹ️ unused-config-file 1

See ℹ️ Event descriptions for more information.

If the flagged items are 🤯 false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it,
    try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

🚂 If you're seeing this message and your PR is from a branch that doesn't have check-spelling,
please merge to your PR's base branch to get the version configured for your repository.

@reshke
reshke merged commit 98b2dd0 into master Jul 28, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants