package metrics
import "golang.org/x/build/internal/metrics"
Package metrics provides a service for reporting metrics to Stackdriver, or locally during development.
Index ¶
- type MonitoredResource
- func GKEResource(containerName string) (*MonitoredResource, error)
- func (r *MonitoredResource) MonitoredResource() (resType string, labels map[string]string)
- type Service
Types ¶
type MonitoredResource ¶
type MonitoredResource mrpb.MonitoredResource
MonitoredResource wraps a *mrpb.MonitoredResource to implement the monitoredresource.MonitoredResource interface.
func GKEResource ¶
func GKEResource(containerName string) (*MonitoredResource, error)
GKEResource populates a MonitoredResource with GKE Metadata.
The returned MonitoredResource will have the type set to "k8s_container".
func (*MonitoredResource) MonitoredResource ¶
func (r *MonitoredResource) MonitoredResource() (resType string, labels map[string]string)
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service controls metric exporters.
func NewService ¶
func NewService(resource *MonitoredResource, views []*view.View) (*Service, error)
NewService initializes a *Service.
The Service returned is configured to send metric data to StackDriver. When not running on GCE, it will host metrics through a prometheus HTTP handler.
views will be passed to view.Register for export to the metric service.
func (*Service) ServeHTTP ¶
func (m *Service) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*Service) Stop ¶
func (m *Service) Stop()
Stop flushes metrics and stops exporting. Stop should be called before exiting.
Source Files ¶
metrics.go
- Version
- v0.0.0-20250421191922-3619c213cff3 (latest)
- Published
- Apr 21, 2025
- Platform
- linux/amd64
- Imports
- 11 packages
- Last checked
- 3 months ago –
Tools for package owners.