serverless

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2021 License: Apache-2.0 Imports: 11 Imported by: 6

README

Serverless

This project provides Serverless runtimes for use with Knative.

Runtimes

  • Go
Go

Usage:

package main

import (
	"gitlab.com/autokubeops/serverless"
	"net/http"
)

func main() {
	serverless.NewBuilder(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		// put your application logic here
		_, _ = w.Write([]byte("OK"))
	})).
		WithPrometheus(). // enable prometheus metrics (optional)
		Run()
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MetricNamespace = "serverless"
	MetricSubsystem = "function"
)

Functions

This section is empty.

Types

type Builder added in v0.2.0

type Builder struct {
	// contains filtered or unexported fields
}

func NewBuilder added in v0.2.0

func NewBuilder(handler http.Handler) *Builder

func (*Builder) Run added in v0.2.0

func (b *Builder) Run()

func (*Builder) WithPort added in v0.2.0

func (b *Builder) WithPort(port int) *Builder

func (*Builder) WithPrometheus added in v0.2.0

func (b *Builder) WithPrometheus() *Builder

WithPrometheus enables Prometheus metric collection from function invocation.

Jump to

Keyboard shortcuts

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