# README
touchstone
Touchstone is an integration between go.uber.org/fx and prometheus.
Summary
Touchstone provides easy bootstrapping of a prometheus client environment within a go.uber.org/fx application container. Key features include:
- External configuration that can drive how the Registry and other components are initialized
- Simple constructors that allow individual metrics to fully participate in dependency injection
- Prebundled HTTP metrics with a simpler and more efficient instrumentation than what promhttp provides
Table of Contents
Code of Conduct
This project and everyone participating in it are governed by the XMiDT Code Of Conduct. By participating, you agree to this Code.
Install
go get -u github.com/xmidt-org/touchstone
Contributing
Refer to CONTRIBUTING.md.
# Packages
SPDX-FileCopyrightText: 2022 Comcast Cable Communications Management, LLC SPDX-License-Identifier: Apache-2.0.
Package touchhttp defines the HTTP-specific behavior for metrics within
an uber/fx app which uses the touchstone package.
Package touchkit adds integration with go-kit's metrics API with prometheus
as the backend.
Package touchtest exposes common prometheus testing utilities.
# Functions
ApplyDefaults ensures that any field in dst that is the zero value takes a default from the corresponding field in src.
AsAlreadyRegisteredError tests if err is a prometheus AlreadyRegisteredError.
CollectorAs attempts to set target to the given collector.
Counter uses a Factory instance from the enclosing fx.App to create and register a prometheus.Counter with the same component name as the metric Name.
CounterVec uses a Factory instance from the enclosing fx.App to create and register a *prometheus.CounterVec with the same component name as the metric Name.
ExistingCollector attempts to use the previously registered collector as target.
Gauge uses a Factory instance from the enclosing fx.App to create and register a prometheus.Gauge with the same component name as the metric Name.
GaugeVec uses a Factory instance from the enclosing fx.App to create and register a *prometheus.GaugeVec with the same component name as the metric Name.
Histogram uses a Factory instance from the enclosing fx.App to create and register a prometheus.Observer with the same component name as the metric Name.
HistogramVec uses a Factory instance from the enclosing fx.App to create and register a prometheus.ObserverVec with the same component name as the metric Name.
Metric emits a named component using the specified target.
New bootstraps a prometheus registry given a Config instance.
NewFactory produces a Factory that uses the supplied registry.
NewUntypedFunc is a variant of prometheus.NewUntypedFunc that allows the function to have a more flexible signature.
Provide bootstraps a prometheus environment for an uber/fx App.
Summary uses a Factory instance from the enclosing fx.App to create and register a prometheus.Observer with the same component name as the metric Name.
SummaryVec uses a Factory instance from the enclosing fx.App to create and register a prometheus.ObserverVec with the same component name as the metric Name.
# Constants
Module is the name of the fx module that touchstone components are provided within.
# Variables
ErrNoMetricName indicates that a prometheus *Opts struct did not set the Name field.