Moesif is an API analytics platform. Cloud Functions is a serverless Function as a service (Faas) offer from Google Cloud Platform (GCP)
A Moesif client who utilizes Cloud Functions, written in Go Lang, would like to log all "outbound" calls originating from their cloud functions to be logged into Moesif.
This is a simple "Cloud function" that shows how to integrate Moesif outbound call logging.
- Create a Cloud Function in
go
by following GCP Quickstart. Deploy and verify it works. - Copy
moesif-init.go
from this project into your Cloud Function project. Update thepackage
name to match yours. - In your Cloud Functions file (eg:
function.go
) add/update the init function to invokemoesifInit
:
func init() {
moesifInit()
}
- In GCP console, add the following
Runtime environment variable
MOESIF_APPLICATION_ID
: <enter the moesif application id here>
Follow 3 simple steps to create sample function, invoke it, and see the results in Moesif dashboard: