Skip to content

Commit 1a2362f

Browse files
committed
Add package-level document for api and adapter/micro package
Signed-off-by: Eric Zhao <[email protected]>
1 parent 5595860 commit 1a2362f

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

adapter/micro/doc.go

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
This package provides Sentinel integration for go-micro.
3+
4+
For server side, users may append a Sentinel handler wrapper to go-micro service, like:
5+
6+
import (
7+
sentinelPlugin "github.com/alibaba/sentinel-golang/adapter/micro"
8+
)
9+
10+
// Append a Sentinel handler wrapper.
11+
micro.NewService(micro.WrapHandler(sentinelPlugin.NewHandlerWrapper()))
12+
13+
The plugin extracts service method as the resource name by default.
14+
Users may provide customized resource name extractor when creating new
15+
Sentinel handler wrapper (via options).
16+
17+
Fallback logic: the plugin will return the BlockError by default
18+
if current request is blocked by Sentinel rules. Users may also
19+
provide customized fallback logic via WithXxxBlockFallback(handler) options.
20+
*/
21+
package micro

api/api.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package api provides fundamental APIs of Sentinel.
12
package api
23

34
import (

0 commit comments

Comments
 (0)