gae: go.chromium.org/gae/filter/count Index | Examples | Files

package count

import "go.chromium.org/gae/filter/count"

Package count contains 'counter' filters for all the gae services. This serves as a set of simple example filters, and also enables other filters to test to see if certain underlying APIs are called when they should be (e.g. for the datastore mcache filter, for example).

Index

Examples

Package Files

count.go gi.go mail.go mc.go mod.go rds.go tq.go user.go

func FilterGI Uses

func FilterGI(c context.Context) (context.Context, *InfoCounter)

FilterGI installs a counter GlobalInfo filter in the context.

func FilterMC Uses

func FilterMC(c context.Context) (context.Context, *MCCounter)

FilterMC installs a counter Memcache filter in the context.

func FilterMail Uses

func FilterMail(c context.Context) (context.Context, *MailCounter)

FilterMail installs a counter Mail filter in the context.

func FilterModule Uses

func FilterModule(c context.Context) (context.Context, *ModuleCounter)

FilterModule installs a counter Module filter in the context.

func FilterRDS Uses

func FilterRDS(c context.Context) (context.Context, *DSCounter)

FilterRDS installs a counter datastore filter in the context.

Code:

// Set up your context using a base service implementation (memory or prod)
c := memory.Use(context.Background())

// Apply the counter.FilterRDS
c, counter := FilterRDS(c)

// functions use ds from the context like normal... they don't need to know
// that there are any filters at all.
someCalledFunc := func(c context.Context) {
    vals := []ds.PropertyMap{{
        "FieldName": ds.MkProperty(100),
        "$key":      ds.MkProperty(ds.NewKey(c, "Kind", "", 1, nil))},
    }
    if err := ds.Put(c, vals); err != nil {
        panic(err)
    }
}

// Using the other function.
someCalledFunc(c)
someCalledFunc(c)

// Then we can see what happened!
fmt.Printf("%d\n", counter.PutMulti.Successes())

Output:

2

func FilterTQ Uses

func FilterTQ(c context.Context) (context.Context, *TQCounter)

FilterTQ installs a counter TaskQueue filter in the context.

func FilterUser Uses

func FilterUser(c context.Context) (context.Context, *UserCounter)

FilterUser installs a counter User filter in the context.

type DSCounter Uses

type DSCounter struct {
    AllocateIDs      Entry
    DecodeCursor     Entry
    RunInTransaction Entry
    Run              Entry
    Count            Entry
    DeleteMulti      Entry
    GetMulti         Entry
    PutMulti         Entry
}

DSCounter is the counter object for the datastore service.

type Entry Uses

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

Entry is a success/fail pair for a single API method. It's returned by the Counter interface.

func (*Entry) Errors Uses

func (e *Entry) Errors() int

Errors returns the number of unsuccessful invocations for this Entry.

func (*Entry) String Uses

func (e *Entry) String() string

func (*Entry) Successes Uses

func (e *Entry) Successes() int

Successes returns the number of successful invocations for this Entry.

func (*Entry) Total Uses

func (e *Entry) Total() int64

Total is a convenience function for getting the total number of calls to this API. It's Successes+Errors.

type InfoCounter Uses

type InfoCounter struct {
    AppID                  Entry
    FullyQualifiedAppID    Entry
    GetNamespace           Entry
    Datacenter             Entry
    DefaultVersionHostname Entry
    InstanceID             Entry
    IsDevAppServer         Entry
    IsOverQuota            Entry
    IsTimeoutError         Entry
    ModuleHostname         Entry
    ModuleName             Entry
    RequestID              Entry
    ServerSoftware         Entry
    ServiceAccount         Entry
    VersionID              Entry
    Namespace              Entry
    AccessToken            Entry
    PublicCertificates     Entry
    SignBytes              Entry
}

InfoCounter is the counter object for the GlobalInfo service.

type MCCounter Uses

type MCCounter struct {
    NewItem             Entry
    AddMulti            Entry
    SetMulti            Entry
    GetMulti            Entry
    DeleteMulti         Entry
    CompareAndSwapMulti Entry
    Increment           Entry
    Flush               Entry
    Stats               Entry
}

MCCounter is the counter object for the Memcache service.

type MailCounter Uses

type MailCounter struct {
    Send         Entry
    SendToAdmins Entry
}

MailCounter is the counter object for the Mail service.

type ModuleCounter Uses

type ModuleCounter struct {
    List            Entry
    NumInstances    Entry
    SetNumInstances Entry
    Versions        Entry
    DefaultVersion  Entry
    Start           Entry
    Stop            Entry
}

ModuleCounter is the counter object for the Module service.

type TQCounter Uses

type TQCounter struct {
    AddMulti    Entry
    DeleteMulti Entry
    Lease       Entry
    LeaseByTag  Entry
    ModifyLease Entry
    Purge       Entry
    Stats       Entry
}

TQCounter is the counter object for the TaskQueue service.

type UserCounter Uses

type UserCounter struct {
    Current           Entry
    CurrentOAuth      Entry
    IsAdmin           Entry
    LoginURL          Entry
    LoginURLFederated Entry
    LogoutURL         Entry
    OAuthConsumerKey  Entry
}

UserCounter is the counter object for the User service.

Package count imports 11 packages (graph). Updated 2018-08-15. Refresh now. Tools for package owners.