Skip to content

Commit 781f815

Browse files
chemidydomgreen
authored andcommitted
fix misspelling in comment + lint (137)
* Update server_interceptors.go fix misspelling * Update fieldextractor.go fix misspelling * Update options.go fix misspelling * Update options.go fix comment * Update server_interceptors.go lint comment * Update payload_interceptors.go lint comment * Update client_interceptors.go lint comment * Update payload_interceptors.go lint comment * update docs
1 parent b9ed6ae commit 781f815

File tree

11 files changed

+48
-54
lines changed

11 files changed

+48
-54
lines changed

logging/logrus/DOC.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ DefaultDurationToField is the default implementation of converting request durat
194194

195195
``` go
196196
var (
197-
// JsonPBMarshaller is the marshaller used for serializing protobuf messages.
197+
// JsonPbMarshaller is the marshaller used for serializing protobuf messages.
198198
JsonPbMarshaller = &jsonpb.Marshaler{}
199199
)
200200
```
@@ -260,13 +260,13 @@ _ = func(ctx context.Context, ping *pb_testproto.PingRequest) (*pb_testproto.Pin
260260
``` go
261261
func PayloadStreamClientInterceptor(entry *logrus.Entry, decider grpc_logging.ClientPayloadLoggingDecider) grpc.StreamClientInterceptor
262262
```
263-
PayloadStreamServerInterceptor returns a new streaming client interceptor that logs the paylods of requests and responses.
263+
PayloadStreamClientInterceptor returns a new streaming client interceptor that logs the paylods of requests and responses.
264264

265265
## <a name="PayloadStreamServerInterceptor">func</a> [PayloadStreamServerInterceptor](./payload_interceptors.go#L45)
266266
``` go
267267
func PayloadStreamServerInterceptor(entry *logrus.Entry, decider grpc_logging.ServerPayloadLoggingDecider) grpc.StreamServerInterceptor
268268
```
269-
PayloadUnaryServerInterceptor returns a new server server interceptors that logs the payloads of requests.
269+
PayloadStreamServerInterceptor returns a new server server interceptors that logs the payloads of requests.
270270

271271
This *only* works when placed *after* the `grpc_logrus.StreamServerInterceptor`. However, the logging can be done to a
272272
separate instance of the logger.
@@ -315,7 +315,7 @@ UnaryClientInterceptor returns a new unary client interceptor that optionally lo
315315
``` go
316316
func UnaryServerInterceptor(entry *logrus.Entry, opts ...Option) grpc.UnaryServerInterceptor
317317
```
318-
PayloadUnaryServerInterceptor returns a new unary server interceptors that adds logrus.Entry to the context.
318+
UnaryServerInterceptor returns a new unary server interceptors that adds logrus.Entry to the context.
319319

320320
## <a name="CodeToLevel">type</a> [CodeToLevel](./options.go#L53)
321321
``` go

logging/logrus/payload_interceptors.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
)
1515

1616
var (
17-
// JsonPBMarshaller is the marshaller used for serializing protobuf messages.
17+
// JsonPbMarshaller is the marshaller used for serializing protobuf messages.
1818
JsonPbMarshaller = &jsonpb.Marshaler{}
1919
)
2020

@@ -38,7 +38,7 @@ func PayloadUnaryServerInterceptor(entry *logrus.Entry, decider grpc_logging.Ser
3838
}
3939
}
4040

41-
// PayloadUnaryServerInterceptor returns a new server server interceptors that logs the payloads of requests.
41+
// PayloadStreamServerInterceptor returns a new server server interceptors that logs the payloads of requests.
4242
//
4343
// This *only* works when placed *after* the `grpc_logrus.StreamServerInterceptor`. However, the logging can be done to a
4444
// separate instance of the logger.
@@ -70,7 +70,7 @@ func PayloadUnaryClientInterceptor(entry *logrus.Entry, decider grpc_logging.Cli
7070
}
7171
}
7272

73-
// PayloadStreamServerInterceptor returns a new streaming client interceptor that logs the paylods of requests and responses.
73+
// PayloadStreamClientInterceptor returns a new streaming client interceptor that logs the paylods of requests and responses.
7474
func PayloadStreamClientInterceptor(entry *logrus.Entry, decider grpc_logging.ClientPayloadLoggingDecider) grpc.StreamClientInterceptor {
7575
return func(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) {
7676
if !decider(ctx, method) {

logging/logrus/server_interceptors.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ var (
2222
KindField = "span.kind"
2323
)
2424

25-
// PayloadUnaryServerInterceptor returns a new unary server interceptors that adds logrus.Entry to the context.
25+
// UnaryServerInterceptor returns a new unary server interceptors that adds logrus.Entry to the context.
2626
func UnaryServerInterceptor(entry *logrus.Entry, opts ...Option) grpc.UnaryServerInterceptor {
2727
o := evaluateServerOpt(opts)
2828
return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {

logging/zap/DOC.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ var (
215215
// SystemField is used in every log statement made through grpc_zap. Can be overwritten before any initialization code.
216216
SystemField = zap.String("system", "grpc")
217217

218-
// ServerField is used in every server-side log statment made through grpc_zap.Can be overwritten before initialization.
218+
// ServerField is used in every server-side log statement made through grpc_zap.Can be overwritten before initialization.
219219
ServerField = zap.String("span.kind", "server")
220220
)
221221
```
@@ -232,7 +232,7 @@ DefaultDurationToField is the default implementation of converting request durat
232232

233233
``` go
234234
var (
235-
// JsonPBMarshaller is the marshaller used for serializing protobuf messages.
235+
// JsonPbMarshaller is the marshaller used for serializing protobuf messages.
236236
JsonPbMarshaller = &jsonpb.Marshaler{}
237237
)
238238
```
@@ -300,13 +300,13 @@ _ = func(ctx context.Context, ping *pb_testproto.PingRequest) (*pb_testproto.Pin
300300
``` go
301301
func PayloadStreamClientInterceptor(logger *zap.Logger, decider grpc_logging.ClientPayloadLoggingDecider) grpc.StreamClientInterceptor
302302
```
303-
PayloadStreamServerInterceptor returns a new streaming client interceptor that logs the paylods of requests and responses.
303+
PayloadStreamClientInterceptor returns a new streaming client interceptor that logs the paylods of requests and responses.
304304

305305
## <a name="PayloadStreamServerInterceptor">func</a> [PayloadStreamServerInterceptor](./payload_interceptors.go#L46)
306306
``` go
307307
func PayloadStreamServerInterceptor(logger *zap.Logger, decider grpc_logging.ServerPayloadLoggingDecider) grpc.StreamServerInterceptor
308308
```
309-
PayloadUnaryServerInterceptor returns a new server server interceptors that logs the payloads of requests.
309+
PayloadStreamServerInterceptor returns a new server server interceptors that logs the payloads of requests.
310310

311311
This *only* works when placed *after* the `grpc_zap.StreamServerInterceptor`. However, the logging can be done to a
312312
separate instance of the logger.
@@ -337,7 +337,7 @@ This should be called *before* any other initialization, preferably from init()
337337
``` go
338338
func StreamClientInterceptor(logger *zap.Logger, opts ...Option) grpc.StreamClientInterceptor
339339
```
340-
StreamServerInterceptor returns a new streaming client interceptor that optionally logs the execution of external gRPC calls.
340+
StreamClientInterceptor returns a new streaming client interceptor that optionally logs the execution of external gRPC calls.
341341

342342
## <a name="StreamServerInterceptor">func</a> [StreamServerInterceptor](./server_interceptors.go#L51)
343343
``` go

logging/zap/client_interceptors.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func UnaryClientInterceptor(logger *zap.Logger, opts ...Option) grpc.UnaryClient
3030
}
3131
}
3232

33-
// StreamServerInterceptor returns a new streaming client interceptor that optionally logs the execution of external gRPC calls.
33+
// StreamClientInterceptor returns a new streaming client interceptor that optionally logs the execution of external gRPC calls.
3434
func StreamClientInterceptor(logger *zap.Logger, opts ...Option) grpc.StreamClientInterceptor {
3535
o := evaluateClientOpt(opts)
3636
return func(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) {

logging/zap/payload_interceptors.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
)
1616

1717
var (
18-
// JsonPBMarshaller is the marshaller used for serializing protobuf messages.
18+
// JsonPbMarshaller is the marshaller used for serializing protobuf messages.
1919
JsonPbMarshaller = &jsonpb.Marshaler{}
2020
)
2121

@@ -39,7 +39,7 @@ func PayloadUnaryServerInterceptor(logger *zap.Logger, decider grpc_logging.Serv
3939
}
4040
}
4141

42-
// PayloadUnaryServerInterceptor returns a new server server interceptors that logs the payloads of requests.
42+
// PayloadStreamServerInterceptor returns a new server server interceptors that logs the payloads of requests.
4343
//
4444
// This *only* works when placed *after* the `grpc_zap.StreamServerInterceptor`. However, the logging can be done to a
4545
// separate instance of the logger.
@@ -70,7 +70,7 @@ func PayloadUnaryClientInterceptor(logger *zap.Logger, decider grpc_logging.Clie
7070
}
7171
}
7272

73-
// PayloadStreamServerInterceptor returns a new streaming client interceptor that logs the paylods of requests and responses.
73+
// PayloadStreamClientInterceptor returns a new streaming client interceptor that logs the paylods of requests and responses.
7474
func PayloadStreamClientInterceptor(logger *zap.Logger, decider grpc_logging.ClientPayloadLoggingDecider) grpc.StreamClientInterceptor {
7575
return func(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) {
7676
if !decider(ctx, method) {

logging/zap/server_interceptors.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var (
1717
// SystemField is used in every log statement made through grpc_zap. Can be overwritten before any initialization code.
1818
SystemField = zap.String("system", "grpc")
1919

20-
// ServerField is used in every server-side log statment made through grpc_zap.Can be overwritten before initialization.
20+
// ServerField is used in every server-side log statement made through grpc_zap.Can be overwritten before initialization.
2121
ServerField = zap.String("span.kind", "server")
2222
)
2323

retry/DOC.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ changed through options (e.g. WithMax) on creation of the interceptor or on call
158158
``` go
159159
type BackoffFunc func(attempt uint) time.Duration
160160
```
161-
BackoffFunc denotes a family of functions that controll the backoff duration between call retries.
161+
BackoffFunc denotes a family of functions that control the backoff duration between call retries.
162162

163163
They are called with an identifier of the attempt, and should return a time the system client should
164164
hold off for. If the time returned is longer than the `context.Context.Deadline` of the request
@@ -186,7 +186,7 @@ type CallOption struct {
186186
// contains filtered or unexported fields
187187
}
188188
```
189-
callOption is a grpc.CallOption that is local to grpc_retry.
189+
CallOption is a grpc.CallOption that is local to grpc_retry.
190190

191191
### <a name="Disable">func</a> [Disable](./options.go#L40)
192192
``` go

retry/options.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ var (
2626
}
2727
)
2828

29-
// BackoffFunc denotes a family of functions that controll the backoff duration between call retries.
29+
// BackoffFunc denotes a family of functions that control the backoff duration between call retries.
3030
//
3131
// They are called with an identifier of the attempt, and should return a time the system client should
3232
// hold off for. If the time returned is longer than the `context.Context.Deadline` of the request
@@ -90,7 +90,7 @@ type options struct {
9090
backoffFunc BackoffFunc
9191
}
9292

93-
// callOption is a grpc.CallOption that is local to grpc_retry.
93+
// CallOption is a grpc.CallOption that is local to grpc_retry.
9494
type CallOption struct {
9595
grpc.EmptyCallOption // make sure we implement private after() and before() fields so we don't panic.
9696
applyFunc func(opt *options)

tags/DOC.md

Lines changed: 25 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ _ = grpc.NewServer(
6868
- [google.golang.org/grpc/peer](https://godoc.org/google.golang.org/grpc/peer)
6969

7070
## <a name="pkg-index">Index</a>
71+
* [Variables](#pkg-variables)
7172
* [func CodeGenRequestFieldExtractor(fullMethod string, req interface{}) map[string]interface{}](#CodeGenRequestFieldExtractor)
7273
* [func StreamServerInterceptor(opts ...Option) grpc.StreamServerInterceptor](#StreamServerInterceptor)
7374
* [func UnaryServerInterceptor(opts ...Option) grpc.UnaryServerInterceptor](#UnaryServerInterceptor)
@@ -77,10 +78,7 @@ _ = grpc.NewServer(
7778
* [type RequestFieldExtractorFunc](#RequestFieldExtractorFunc)
7879
* [func TagBasedRequestFieldExtractor(tagName string) RequestFieldExtractorFunc](#TagBasedRequestFieldExtractor)
7980
* [type Tags](#Tags)
80-
* [func Extract(ctx context.Context) \*Tags](#Extract)
81-
* [func (t \*Tags) Has(key string) bool](#Tags.Has)
82-
* [func (t \*Tags) Set(key string, value interface{}) \*Tags](#Tags.Set)
83-
* [func (t \*Tags) Values() map[string]interface{}](#Tags.Values)
81+
* [func Extract(ctx context.Context) Tags](#Extract)
8482

8583
#### <a name="pkg-examples">Examples</a>
8684
* [Package (InitialisationWithOptions)](#example__initialisationWithOptions)
@@ -89,6 +87,15 @@ _ = grpc.NewServer(
8987
#### <a name="pkg-files">Package files</a>
9088
[context.go](./context.go) [doc.go](./doc.go) [fieldextractor.go](./fieldextractor.go) [interceptors.go](./interceptors.go) [options.go](./options.go)
9189

90+
## <a name="pkg-variables">Variables</a>
91+
``` go
92+
var (
93+
94+
// NoopTags is a trivial, minimum overhead implementation of Tags for which all operations are no-ops.
95+
NoopTags = &noopTags{}
96+
)
97+
```
98+
9299
## <a name="CodeGenRequestFieldExtractor">func</a> [CodeGenRequestFieldExtractor](./fieldextractor.go#L23)
93100
``` go
94101
func CodeGenRequestFieldExtractor(fullMethod string, req interface{}) map[string]interface{}
@@ -141,48 +148,35 @@ Keys and values will be added to the context tags of the request. If there are n
141148
func TagBasedRequestFieldExtractor(tagName string) RequestFieldExtractorFunc
142149
```
143150
TagBasedRequestFieldExtractor is a function that relies on Go struct tags to export log fields from requests.
144-
These are usualy coming from a protoc-plugin, such as Gogo protobuf.
151+
These are usually coming from a protoc-plugin, such as Gogo protobuf.
145152

146153
message Metadata {
147154
repeated string tags = 1 [ (gogoproto.moretags) = "log_field:\"meta_tags\"" ];
148155
}
149156

150157
The tagName is configurable using the tagName variable. Here it would be "log_field".
151158

152-
## <a name="Tags">type</a> [Tags](./context.go#L17-L19)
159+
## <a name="Tags">type</a> [Tags](./context.go#L19-L27)
153160
``` go
154-
type Tags struct {
155-
// contains filtered or unexported fields
161+
type Tags interface {
162+
// Set sets the given key in the metadata tags.
163+
Set(key string, value interface{}) Tags
164+
// Has checks if the given key exists.
165+
Has(key string) bool
166+
// Values returns a map of key to values.
167+
// Do not modify the underlying map, please use Set instead.
168+
Values() map[string]interface{}
156169
}
157170
```
158-
Tags is the struct used for storing request tags between Context calls.
159-
This object is *not* thread safe, and should be handled only in the context of the request.
171+
Tags is the interface used for storing request tags between Context calls.
172+
The default implementation is *not* thread safe, and should be handled only in the context of the request.
160173

161-
### <a name="Extract">func</a> [Extract](./context.go#L41)
174+
### <a name="Extract">func</a> [Extract](./context.go#L63)
162175
``` go
163-
func Extract(ctx context.Context) *Tags
176+
func Extract(ctx context.Context) Tags
164177
```
165178
Extracts returns a pre-existing Tags object in the Context.
166179
If the context wasn't set in a tag interceptor, a no-op Tag storage is returned that will *not* be propagated in context.
167180
168-
### <a name="Tags.Has">func</a> (\*Tags) [Has](./context.go#L28)
169-
``` go
170-
func (t *Tags) Has(key string) bool
171-
```
172-
Has checks if the given key exists.
173-
174-
### <a name="Tags.Set">func</a> (\*Tags) [Set](./context.go#L22)
175-
``` go
176-
func (t *Tags) Set(key string, value interface{}) *Tags
177-
```
178-
Set sets the given key in the metadata tags.
179-
180-
### <a name="Tags.Values">func</a> (\*Tags) [Values](./context.go#L35)
181-
``` go
182-
func (t *Tags) Values() map[string]interface{}
183-
```
184-
Values returns a map of key to values.
185-
Do not modify the underlying map, please use Set instead.
186-
187181
- - -
188182
Generated by [godoc2ghmd](https://github.com/GandalfUK/godoc2ghmd)

0 commit comments

Comments
 (0)