Telemetry interfaces for logs and metrics allowing complete decoupling of instrumentation implementations.

Telemetry

This package provides a set of Telemetry interfaces allowing you to completely decouple your libraries and packages from Logging and Metrics instrumentation implementations.

For more information on the interfaces, see: https://pkg.go.dev/github.com/tetratelabs/telemetry

Implementations

Below you can find a list of known interface implementations. As a consumer of this package, you might want to select existing implementations to use in your application binaries. If looking to write your own, take a look at existing ones for inspiration.

If you have an OSS implementation you want to share, feel free to submit a PR to this file so it may be included in this list.

repository supported interfaces notes
tetratelabs/telemetry-gokit-log Logger Go kit log bridge
tetratelabs/telemetry-opencensus Metrics OpenCensus metrics bridge
Owner
Tetrate Labs
Open Source projects from Tetrate
Tetrate Labs
Comments
  • Allow to override default logger when it is not the same

    Allow to override default logger when it is not the same

    When testing with multiple logger instances, the default logger (in scope) needs to be overridden (to be initialized with the cloned (of the given) logger instance). Context: https://github.com/tetratelabs/telemetry/pull/13.

    Signed-off-by: Dhi Aurrahman [email protected]

  • Fix scope registration

    Fix scope registration

    When registering a new scope, we need to make sure we clone the default logger, if present. Otherwise, all scopes will end up sharing the same log level and it won't be able to be changed individually. This was already addressed in the UseLogger method but was not taken care of during registration, making the scope level setting only work if the loggers were registered before calling the UseLogger method.

  • Fix level clone in function logger

    Fix level clone in function logger

    Fix https://github.com/tetratelabs/telemetry/issues/15

    Fixes how cloning works in the Function logger so that enhancing a logger with values keeps the original references (such as levels) for the fields, but cloning dereferences them. This effectively helps decorating the Function logger with logging scopes.

  • Update a scope level, when we have more than one scopes

    Update a scope level, when we have more than one scopes

    I have the following program (using github.com/tetratelabs/log as the telemetry.Logger implementation): https://go.dev/play/p/zFPUPY_72Jz, I expect executing scopeA.SetLevel(telemetry.LevelInfo) only updates the scopeA, however, I saw scopeB's level is also updated. I believe I missed something obvious here. 🙇🏾

    package main
    
    import (
    	"fmt"
    
    	"github.com/tetratelabs/log"
    	"github.com/tetratelabs/telemetry"
    	"github.com/tetratelabs/telemetry/scope"
    )
    
    func main() {
    	l := log.New()
    	a := scope.Register("a", "Messages from a")
    	b := scope.Register("b", "Messages from b")
    	scope.UseLogger(l)
    
    	scopeA, _ := scope.Find("a")
    	scopeA.SetLevel(telemetry.LevelDebug)
    	scopeB, _ := scope.Find("b")
    	scopeB.SetLevel(telemetry.LevelDebug)
    
    	fmt.Println("scopeA == instance a", scopeA == a, scopeA)
    	fmt.Println("scopeB == instance b", scopeB == b, scopeB)
    
    	fmt.Println()
    	fmt.Println("scope level a", scopeA.Level().String())
    	fmt.Println("scope level b", scopeB.Level().String()) // despite only updating scope a, scope b level is changed too.
    	fmt.Println()
    
    	print(a)
    	print(b)
    
    	scopeA.SetLevel(telemetry.LevelInfo)
    
    	fmt.Println()
    	fmt.Println("after scope 'a' is updated to info:")
    
    	fmt.Println()
    	fmt.Println("scope level a", scopeA.Level().String())
    	fmt.Println("scope level b", scopeB.Level().String()) // despite only updating scope a, scope b level is changed too.
    
    	print(a)
    	print(b) // Since we don't update scope 'b', we expect to still see "time="..." level=debug msg="debug" scope="b"" here.
    }
    
    func print(logger telemetry.Logger) {
    	logger.Info("info")
    	logger.Debug("debug")
    }
    

    Output, after scope 'a' is updated to info, I expect scope b to still have that debug part.

    scopeA == instance a true &{0xc000060190 [] <nil> <nil> a Messages from a <nil>}
    scopeB == instance b true &{0xc000060280 [] <nil> <nil> b Messages from b <nil>}
    
    scope level a debug
    scope level b debug
    
    time="2009/11/10 23:00:00" level=info msg="info" scope="a"
    time="2009/11/10 23:00:00" level=debug msg="debug" scope="a"
    time="2009/11/10 23:00:00" level=info msg="info" scope="b"
    time="2009/11/10 23:00:00" level=debug msg="debug" scope="b"
    
    after scope 'a' is updated to info:
    
    scope level a info
    scope level b info
    time="2009/11/10 23:00:00" level=info msg="info" scope="a"
    time="2009/11/10 23:00:00" level=info msg="info" scope="b"
    
    Program exited.
    
  • Update group's telemetry and run versions

    Update group's telemetry and run versions

    Seems like if being used, "replaces" are not being transitively resolved from the project that consumes this module.

    Signed-off-by: Dhi Aurrahman [email protected]

  • Generalize level and add base Function logger

    Generalize level and add base Function logger

    Makes the Level concept top-level in the Logger interface and adds a Function logger that allows users to easily configure logging with a custom function.

    Now that the code contains more tests, this also adds the pertinent CI configuration and build files to run tests, sanity checks, coverage, linters, etc.

  • adds global metricsink for lazy registration of metrics, adds noop logger

    adds global metricsink for lazy registration of metrics, adds noop logger

    GlobalMetricSink logic allows packages to purely use the telemetry.MetricSink interface without it being passed along.

    Common initialization:

    func main() {
    	...
    	telemetry.SetGlobalMetricSink(opencensus.New(
    		scope.Register("metrics", "metrics related messages"),
    	))
    	...
    }
    

    Common usage:

    package somelib
    
    var (
    	labelStatus   telemetry.Label
    	metricCounter telemetry.Metric
    )
    
    func init() {
    	telemetry.ToGlobalMetricSink(func(m telemetry.MetricSink) {
    		labelStatus = m.NewLabel("status")
    		metricCounter = m.NewSum(
    			"counter_total", 
    			"description of this metric",
    			telemetry.WithLabels(labelStatus).
    	}
    )
    
  • scoped & level logger facades and run group config for scoped logger

    scoped & level logger facades and run group config for scoped logger

    This PR Adds:

    • level logger interface and level logger wrapper (for bare bones telemetry.Logger implementations)
    • scoped logger facade (similar to Istio one) with level logger support (allowing lazy loading of logger implementation)
    • run.Group compatible config for scoped logger
Related tags
OpenTelemetry auto-instrumentation for Go applications

OpenTelemetry Auto-Instrumentation for Go This project adds OpenTelemetry instrumentation to Go applications without having to modify their source cod

Dec 18, 2022
Apollo Federation Gateway v1 implementations by Go

fedeway Apollo Federation Gateway v1 implementations by Go. ⚠️ This product is under development. don't use in production. ⚠️ TODO implements validati

Jan 6, 2023
Common rate-limiter implementations

Overview An example Rate Limiter library used to control the rate that events occur, but these can also be used as thresholds that should replenish ov

Dec 1, 2021
Go package to simulate bandwidth, latency and packet loss for net.PacketConn and net.Conn interfaces

lossy Go package to simulate bandwidth, latency and packet loss for net.PacketConn and net.Conn interfaces. Its main usage is to test robustness of ap

Oct 14, 2022
Go network programming framework, supports multiplexing, synchronous and asynchronous IO mode, modular design, and provides flexible custom interfaces
Go network programming framework, supports multiplexing, synchronous and asynchronous IO mode, modular design, and provides flexible custom interfaces

Go network programming framework, supports multiplexing, synchronous and asynchronous IO mode, modular design, and provides flexible custom interfaces。The key is the transport layer, application layer protocol has nothing to do

Nov 7, 2022
A base library defines interfaces and modules of aBFT Lachesis consensus protocol

Lachesis base A base library defines interfaces and modules of aBFT Lachesis consensus protocol. Part of galaxy' s Consensus-as-a-Service for distribu

Oct 25, 2021
Request: a HTTP request library for Go with interfaces and mocks for unit tests

Requester Request is a HTTP request library for Go with interfaces and mocks for

Jan 10, 2022
Go-libp2p-core. - Home to the interfaces and abstractions that make up go-libp2p

go-libp2p-core Home to the interfaces and abstractions that make up go-libp2p. I

Jan 17, 2022
An online shop application, the complete microservices demo for kratos.

[WIP] beer-shop An online shop application, the complete microservices demo for kratos. 本项目为一个使用kratos框架创建的,简单却功能尽量完整的微服务电商项目。旨在演示kratos在mono-repo(单体仓

Jan 6, 2023
Axiom Honeycomb Proxy ships logs to Axiom and Honeycomb simultaneously.

Axiom Honeycomb Proxy Table of Contents Introduction Usage Contributing License Introduction Axiom Honeycomb Proxy ships logs to Axiom and Honeycomb s

Dec 6, 2021
Watch for interesting patterns in Caddy logs and send a Telegram notification.

Watch for interesting patterns in Caddy logs and send a Telegram notification.

Jul 21, 2022
A framework for building chat interfaces with gioui.org.

chat A framework for building chat interfaces with gioui.org. The canonical copy of this repository is hosted on Sourcehut. We also have: An issue tra

Dec 1, 2022
A Golang protobuf plugin used to generate the necessary interfaces to interact with the database

protoc-gen-go-db-enum This protobuf compiler plugin generates the Valuer and Scanner interfaces for enums defined in the proto files. It is highly bas

Sep 9, 2022
Turbine-common - This package contains the common interfaces for Turbine that are shared with other software

turbine-common This package contains the common interfaces for Turbine that are

Feb 12, 2022
A CLI tool to get Certificate Transparency logs of a domain name.
A CLI tool to get Certificate Transparency logs of a domain name.

crt crt is a CLI tool to get Certificate Transparency logs of a domain name. It can also enumerate subdomains. Installation If you have Go installed:

Dec 17, 2022
A tool for capturing newly issued x.509 from Certificate Transparency logs & performing periodic revocation checking.

ct-logster This repository contains the tools for collecting newly issued x509 certificates from Certificate Transparency logs, as well as performing

May 4, 2022
Prometheus exporter for ping metrics such as RTT, packet loss, and jitter to any number of hosts.

ping_exporter Command ping_exporter provides a Prometheus exporter for ping metrics such as RTT, packet loss, and jitter to any number of hosts. Usage

Sep 24, 2022
Capture sensor data from Xiaomi thermometers (via BLE) and expose it as prometheus metrics

sensor-probe Sensor Probe is a small utility that reads advertisement data sent by the Xiaomi Thermometer LYWSD03MMC via Bluetooth LE and expose them

Oct 13, 2022