Skip to content

feat(metrics): add total and per channel vods duration#1095

Merged
Zibbp merged 1 commit intoZibbp:mainfrom
Entrivax:totalDurationMetrics
Mar 5, 2026
Merged

feat(metrics): add total and per channel vods duration#1095
Zibbp merged 1 commit intoZibbp:mainfrom
Entrivax:totalDurationMetrics

Conversation

@Entrivax
Copy link
Contributor

@Entrivax Entrivax commented Mar 4, 2026

Small PR to add the total vods duration to the metrics. I was wondering how days (months or years) of vods I had on my instance, so I tried to add it to the metrics export since it didn't seem very complex to add.

Visualization with Netdata of these exported values:

  • Per channel (stacked bars)
    image
    Per channel (pie)
    image
  • Total (simple line)
    image

@coderabbitai
Copy link

coderabbitai bot commented Mar 4, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ef64d5b7-b872-4208-9c2e-78595efb06fb

📥 Commits

Reviewing files that changed from the base of the PR and between 0a65dea and 72a73c0.

📒 Files selected for processing (1)
  • internal/metrics/metrics.go

Walkthrough

Adds per-channel and total VOD duration metrics to the metrics system. Introduces two new gauge metrics (totalVodsDuration and channelVodDuration) to the Metrics struct, initializes them in NewService with Prometheus registration, and extends GatherMetrics to compute per-channel durations and aggregate totals.

Changes

Cohort / File(s) Summary
VOD Duration Metrics
internal/metrics/metrics.go
Adds totalVodsDuration and channelVodDuration fields to Metrics struct; initializes both as Prometheus gauges in NewService with "total_vods_duration_seconds" and "channel_vod_duration_seconds" names; registers metrics via MustRegister; extends GatherMetrics to compute per-channel VOD durations by summing vod.Duration values and sets both gauge metrics accordingly.
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: adding total and per-channel VOD duration metrics to the metrics system.
Description check ✅ Passed The description is directly related to the changeset, explaining the motivation for adding VOD duration metrics and providing visualizations of how the metrics are used.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Entrivax
Copy link
Contributor Author

Entrivax commented Mar 4, 2026

Now that I think about it, I should probably add the storage distribution that we already have in the admin overview.

Copy link
Owner

@Zibbp Zibbp left a comment

Choose a reason for hiding this comment

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

looks good, thanks

@Zibbp Zibbp merged commit 6f637bd into Zibbp:main Mar 5, 2026
8 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.

2 participants