gizmo: Index | Files

package observe

import ""

Package observe provides functions that help with setting tracing/metrics in cloud providers, mainly GCP.


Package Files


func GetGAEInfo Uses

func GetGAEInfo() (projectID, service, version string)

GetGAEInfo returns the GCP Project ID, the service, and the version of the application.

func GetServiceInfo Uses

func GetServiceInfo() (projectID, service, version string)

GetServiceInfo returns the GCP Project ID, the service name and version (GAE or through SERVICE_NAME/SERVICE_VERSION env vars). Note that SERVICE_NAME/SERVICE_VERSION are not standard but your application can pass them in as variables to be included in your trace attributes

func GoogleProjectID Uses

func GoogleProjectID() string

GoogleProjectID returns the GCP Project ID that can be used to instantiate various GCP clients such as Stack Driver.

func IsGAE Uses

func IsGAE() bool

IsGAE tells you whether your program is running within the App Engine platform.

func IsGCPEnabled Uses

func IsGCPEnabled() bool

IsGCPEnabled returns whether the running application is inside GCP or has access to its products.

func NewStackdriverExporter Uses

func NewStackdriverExporter(projectID string, onErr func(error)) (*stackdriver.Exporter, error)

NewStackdriverExporter will return the tracing and metrics through the stack driver exporter, if exists in the underlying platform. If exporter is registered, it returns the exporter so you can register it and ensure to call Flush on termination.

func RegisterAndObserveGCP Uses

func RegisterAndObserveGCP(onError func(error)) error

RegisterAndObserveGCP will initiate and register Stackdriver profiling and tracing and metrics in environments that pass the tests in the IsGCPEnabled function. All exporters will be registered using the information returned by the GetServiceInfo function. Tracing and metrics are enabled via OpenCensus exporters. See the OpenCensus documentation for instructions for registering additional spans and metrics.

func SkipObserve Uses

func SkipObserve() bool

SkipObserve checks if the GIZMO_SKIP_OBSERVE environment variable has been populated. This may be used along with local development to cut down on long startup times caused by the 'monitoredresource.Autodetect()' call in IsGCPEnabled().

Package observe imports 11 packages (graph) and is imported by 2 packages. Updated 2019-06-14. Refresh now. Tools for package owners.