Skip to content

Add networkobservability_build_info Prometheus metric#2064

Draft
Copilot wants to merge 6 commits intomainfrom
copilot/add-retina-build-info-metric
Draft

Add networkobservability_build_info Prometheus metric#2064
Copilot wants to merge 6 commits intomainfrom
copilot/add-retina-build-info-metric

Conversation

Copy link
Contributor

Copilot AI commented Feb 14, 2026

Description

Implements networkobservability_build_info metric following Prometheus build_info conventions. Metric exposes build metadata as labels with constant value of 1.

Implementation

  • Metric: networkobservability_build_info{version="v0.0.17",architecture="amd64",os="linux"} 1
  • Labels:
    • version: from buildinfo.Version (ldflags injection) with "unknown" fallback
    • architecture: from runtime.GOARCH
    • os: from runtime.GOOS
  • Initialization: Single set during metrics.InitializeMetrics() at daemon startup

Code Changes

  • pkg/metrics/types.go: BuildInfo gauge and BuildInfoDescription constant
  • pkg/metrics/metrics.go: Metric creation and initialization with runtime values
  • pkg/utils/metric_names.go: BuildInfoName constant
  • pkg/utils/attr_utils.go: BuildVersion, BuildArchitecture, BuildOS label constants
  • pkg/metrics/metrics_test.go: Test validation of metric value and labels

Related Issue

Addresses feature request for build info metric exposure.

Checklist

  • I have read the contributing documentation.
  • I signed and signed-off the commits (git commit -S -s ...). See this documentation on signing commits.
  • I have correctly attributed the author(s) of the code.
  • I have tested the changes locally.
  • I have followed the project's style guidelines.
  • I have updated the documentation, if necessary.
  • I have added tests, if applicable.

Screenshots (if applicable) or Testing Completed

Metric output verified via test:

# HELP networkobservability_build_info Retina build information
# TYPE networkobservability_build_info gauge
networkobservability_build_info{architecture="amd64",os="linux",version="unknown"} 1

Unit tests pass with metric value and label validation.

Additional Notes

Version label uses "unknown" in test/dev builds. Production builds populate version via ldflags during build process.


Please refer to the CONTRIBUTING.md file for more information on how to contribute to this project.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/microsoft/retina/releases/latest
    • Triggering command: /usr/bin/curl curl -s REDACTED git conf�� G1dG6bKHw credential.usern-ifaceassert tnet/tools/bash (http block)
    • Triggering command: /usr/bin/curl curl -s REDACTED x64/pkg/include ortc�� x64/src/runtime/-p x64/src/internalgo.uber.org/zap (http block)
    • Triggering command: `/usr/bin/curl curl -s REDACTED ux_amd64/compileorigin -o crosoft-authentication-library-f-c=4 pkg/plugin/common/constants.go x64/pkg/tool/linux_amd64/compile-importcfg -p /informers/disco-V=full -lang=go1.23 x64/pkg/tool/linux_amd64/compileRename build info label constants to be more specific

Co-authored-by: nddq <28567936+nddq@users.noreply.github.com> -E th-securejoin@v0.5.1/deprecated_linux.go th-securejoin@v0.5.1/doc.go x64/pkg/tool/linux_amd64/compile entpools_client.git ild.go -imultiarch x64/pkg/tool/linux_amd64/compile` (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Prometheus metrics build info: retina_build_info</issue_title>
<issue_description>Is your feature request related to a problem? Please describe.
it's quite common to have a xxx_build_info metric that gives information about the application.

Describe the solution you'd like
Could you add a Prometheus metrics retina_build_info with some labels: version (git tag), architecture, ...

Describe alternatives you've considered

Additional context
</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 5 commits February 14, 2026 03:55
…nd OS labels

Co-authored-by: nddq <28567936+nddq@users.noreply.github.com>
Co-authored-by: nddq <28567936+nddq@users.noreply.github.com>
Co-authored-by: nddq <28567936+nddq@users.noreply.github.com>
Co-authored-by: nddq <28567936+nddq@users.noreply.github.com>
Co-authored-by: nddq <28567936+nddq@users.noreply.github.com>
Copilot AI changed the title [WIP] Add Prometheus metric for retina build info Add networkobservability_build_info Prometheus metric Feb 14, 2026
Copilot AI requested a review from nddq February 14, 2026 04:08
@github-actions
Copy link

Retina Code Coverage Report

Total coverage no change

Increased diff

Impacted Files Coverage
pkg/metrics/metrics.go 43.25% ... 50.0% (6.75%) ⬆️

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.

Prometheus metrics build info: retina_build_info

2 participants