| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package count | 5 package count |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "time" | 8 "time" |
| 9 | 9 |
| 10 "golang.org/x/net/context" | 10 "golang.org/x/net/context" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 | 136 |
| 137 func (g *infoCounter) SignBytes(bytes []byte) (keyName string, signature []byte,
err error) { | 137 func (g *infoCounter) SignBytes(bytes []byte) (keyName string, signature []byte,
err error) { |
| 138 keyName, signature, err = g.gi.SignBytes(bytes) | 138 keyName, signature, err = g.gi.SignBytes(bytes) |
| 139 g.c.SignBytes.up(err) | 139 g.c.SignBytes.up(err) |
| 140 return | 140 return |
| 141 } | 141 } |
| 142 | 142 |
| 143 // FilterGI installs a counter GlobalInfo filter in the context. | 143 // FilterGI installs a counter GlobalInfo filter in the context. |
| 144 func FilterGI(c context.Context) (context.Context, *InfoCounter) { | 144 func FilterGI(c context.Context) (context.Context, *InfoCounter) { |
| 145 state := &InfoCounter{} | 145 state := &InfoCounter{} |
| 146 state.AppID.init() |
| 147 state.FullyQualifiedAppID.init() |
| 148 state.GetNamespace.init() |
| 149 state.Datacenter.init() |
| 150 state.DefaultVersionHostname.init() |
| 151 state.InstanceID.init() |
| 152 state.IsDevAppServer.init() |
| 153 state.IsOverQuota.init() |
| 154 state.IsTimeoutError.init() |
| 155 state.ModuleHostname.init() |
| 156 state.ModuleName.init() |
| 157 state.RequestID.init() |
| 158 state.ServerSoftware.init() |
| 159 state.ServiceAccount.init() |
| 160 state.VersionID.init() |
| 161 state.Namespace.init() |
| 162 state.AccessToken.init() |
| 163 state.PublicCertificates.init() |
| 164 state.SignBytes.init() |
| 165 |
| 146 return info.AddFilters(c, func(ic context.Context, gi info.Interface) in
fo.Interface { | 166 return info.AddFilters(c, func(ic context.Context, gi info.Interface) in
fo.Interface { |
| 147 return &infoCounter{state, gi} | 167 return &infoCounter{state, gi} |
| 148 }), state | 168 }), state |
| 149 } | 169 } |
| OLD | NEW |