Package versions allows processes to report string-valued metrics with versions of various libraries they link with.

    The metric is named 'luci/components/version', and it has single field 'component' that defines the logical name of the component whose version is reported by the metric value.

    Having such metrics allows to easily detect processes that use stale code in production.

    Various go packages can register their versions during 'init' time, and all registered version will be flushed to monitoring whenever 'Report' is called.



    This section is empty.


    This section is empty.


    func Register

    func Register(component, version string)

      Register tells the library to start reporting a version for given component.

      This should usually called during 'init' time.

      The component name will be used as a value of 'component' metric field, and the given version will become the actual reported metric value. It is a good idea to use a fully qualified go package name as 'component'.

      func Report

      func Report(c context.Context)

        Report populates 'luci/components/version' metric with versions of all registered components.


        This section is empty.

        Source Files