services/

directory
v0.4.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2022 License: Apache-2.0

README

Service packages structure

All service cloud function packages share a consistent structure

Two functions and one type

Initialize function
  • Goal
    • Optimize cloud function performance by reducing the invocation latency
  • Implementation
    • Is executed once per cloud function instance as a cold start.
    • Cache objects expensive to create, like clients
    • Retreive settings once, like environment variables
    • Cached objects and reteived settings are exposed in one global variable named global
Global type
  • A struct to define a global variable carrying cached objects and retreived settings by Initialized function and used by EntryPoint function
EntryPoint function
  • Goal
    • Execute operations to be performed each time the cloud function is invoked
  • Implementation
    • Is executed on every event triggering the cloud function
    • Uses cached objects and retreived settings prepared by the Initialized function and carried by a global variable of type Global
    • Performs the task a given service is targetted to do that is described before the package key word

Automatic retrying

Automatic retrying is consistently implemented in RAM service packages as documented in Google Cloud Function best practice Retrying Background Functions

Impact on cloud functions Stackdriver logs:

  • Errors entry in log only appears for transient errors.
    • As en error is reported the function is retried.
  • Other errors and loged as information to avoid unwanted retries
    • To find errors in such cloud function logs you can use the following Stackdriver logging filter
resource.type="cloud_function"
textPayload:"REDO_ON_TRANSIENT"

The standard exponential backoff algorithm leads to have:

  • 343 retries in one hour
  • 157 retries during the first 100 seconds

Documentation

Directories

Path Synopsis
Package convertlog2feed convert log entry messsage from pubsub into feed compatible format pubusub message
Package convertlog2feed convert log entry messsage from pubsub into feed compatible format pubusub message
Package dumpinventory request CAI to perform an export
Package dumpinventory request CAI to perform an export
Package getgroupsettings retreives the settings of one group from `Groups Settings API`
Package getgroupsettings retreives the settings of one group from `Groups Settings API`
Package listgroupmembers extract all members from a group in GCI directory using the Admin SDK API
Package listgroupmembers extract all members from a group in GCI directory using the Admin SDK API
Package listgroups extract all groups from a GCI directory using the Admin SDK API
Package listgroups extract all groups from a GCI directory using the Admin SDK API
Package monitor check asset compliance
Package monitor check asset compliance
Package publish2fs publish assets resource feeds as FireStore documents
Package publish2fs publish assets resource feeds as FireStore documents
Package setdashboards set cloud monitoring dashboards for RAM
Package setdashboards set cloud monitoring dashboards for RAM
Package setfeeds set Cloud Asset Inventory feeds at organization level
Package setfeeds set Cloud Asset Inventory feeds at organization level
Package setlogmetrics set cloud logging metrics from logs
Package setlogmetrics set cloud logging metrics from logs
Package setlogsinks set organization log sinks to pubsub
Package setlogsinks set organization log sinks to pubsub
Package splitdump nibble large CAI dumps into PubSub asset feed messages
Package splitdump nibble large CAI dumps into PubSub asset feed messages
Package stream2bq streams PubSub message into BigQuery tables
Package stream2bq streams PubSub message into BigQuery tables
Package upload2gcs stores feeds as JSON files in a GCS bucket
Package upload2gcs stores feeds as JSON files in a GCS bucket

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL