-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#noissue] separating plugin guide document into individual README.md
- Loading branch information
Showing
33 changed files
with
2,422 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# ppbeego | ||
This package instruments the [beego/v2](https://github.com/beego/beego) package. | ||
|
||
## Installation | ||
|
||
```bash | ||
$ go get github.com/pinpoint-apm/pinpoint-go-agent/plugin/beego | ||
``` | ||
```go | ||
import "github.com/pinpoint-apm/pinpoint-go-agent/plugin/beego" | ||
``` | ||
## Usage | ||
[![PkgGoDev](https://pkg.go.dev/badge/github.com/pinpoint-apm/pinpoint-go-agent/plugin/beego)](https://pkg.go.dev/github.com/pinpoint-apm/pinpoint-go-agent/plugin/beego) | ||
|
||
### server | ||
This package instruments inbound requests handled by a beego instance. | ||
Register the ServerFilterChain as the filter chain of the router to trace all handlers: | ||
|
||
``` go | ||
web.InsertFilterChain("/*", ppbeego.ServerFilterChain()) | ||
``` | ||
|
||
For each request, a pinpoint.Tracer is stored in the request context. | ||
By using the pinpoint.FromContext function, this tracer can be obtained in your handler. | ||
Alternatively, the context of the request may be propagated where the context that contains the pinpoint.Tracer is required. | ||
|
||
``` go | ||
package main | ||
|
||
import ( | ||
"github.com/beego/beego/v2/server/web" | ||
"github.com/pinpoint-apm/pinpoint-go-agent" | ||
"github.com/pinpoint-apm/pinpoint-go-agent/plugin/beego" | ||
) | ||
|
||
func (m *MainController) Hello() { | ||
tracer := pinpoint.FromContext(m.Ctx.Request.Context()) | ||
defer tracer.NewSpanEvent("f1").EndSpanEvent() | ||
|
||
m.Ctx.WriteString("hello, world!!") | ||
} | ||
|
||
func main() { | ||
//setup agent | ||
|
||
ctrl := &MainController{} | ||
web.Router("/hello", ctrl, "get:Hello") | ||
web.InsertFilterChain("/*", ppbeego.ServerFilterChain()) | ||
web.Run("localhost:9000") | ||
} | ||
``` | ||
|
||
This package supports URL Statistics feature. It aggregates response times, successes and failures for each router pattern. | ||
|
||
#### Config Options | ||
* [Http.Server.StatusCodeErrors](/doc/config.md#Http.Server.StatusCodeErrors) | ||
* [Http.Server.ExcludeUrl](/doc/config.md#Http.Server.ExcludeUrl) | ||
* [Http.Server.ExcludeMethod](/doc/config.md#Http.Server.ExcludeMethod) | ||
* [Http.Server.RecordRequestHeader](/doc/config.md#Http.Server.RecordRequestHeader) | ||
* [Http.Server.RecordResponseHeader](/doc/config.md#Http.Server.RecordResponseHeader) | ||
* [Http.Server.RecordRequestCookie](/doc/config.md#Http.Server.RecordRequestCookie) | ||
* [Http.UrlStat.Enable](/doc/config.md#Http.UrlStat.Enable) | ||
* [Http.UrlStat.LimitSize](/doc/config.md#Http.UrlStat.LimitSize) | ||
|
||
### client | ||
This package instruments outbound requests and add distributed tracing headers. | ||
Add the ClientFilterChain as the filter chain of the request. | ||
|
||
``` go | ||
req := httplib.Get("http://localhost:9090/") | ||
req.AddFilters(ppbeego.ClientFilterChain(tracer)) | ||
``` | ||
``` go | ||
import ( | ||
"github.com/beego/beego/v2/client/httplib" | ||
"github.com/pinpoint-apm/pinpoint-go-agent" | ||
"github.com/pinpoint-apm/pinpoint-go-agent/plugin/beego" | ||
) | ||
|
||
func (m *MainController) Get() { | ||
tracer := pinpoint.FromContext(m.Ctx.Request.Context()) | ||
|
||
req := httplib.Get("http://localhost:9090/") | ||
req.AddFilters(ppbeego.ClientFilterChain(tracer)) | ||
str, _ := req.String() | ||
m.Ctx.WriteString(str) | ||
} | ||
``` | ||
[Full Example Source](/plugin/beego/example/beego_server.go) | ||
|
||
#### Config Options | ||
* [Http.Client.RecordRequestHeader](/doc/config.md#Http.Client.RecordRequestHeader) | ||
* [Http.Client.RecordResponseHeader](/doc/config.md#Http.Client.RecordResponseHeader) | ||
* [Http.Client.RecordRequestCookie](/doc/config.md#Http.Client.RecordRequestCookie) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# ppchi | ||
This package instruments the [go-chi/chi](https://github.com/go-chi/chi) package. | ||
|
||
## Installation | ||
|
||
```bash | ||
$ go get github.com/pinpoint-apm/pinpoint-go-agent/plugin/chi | ||
``` | ||
```go | ||
import "github.com/pinpoint-apm/pinpoint-go-agent/plugin/chi" | ||
``` | ||
## Usage | ||
[![PkgGoDev](https://pkg.go.dev/badge/github.com/pinpoint-apm/pinpoint-go-agent/plugin/chi)](https://pkg.go.dev/github.com/pinpoint-apm/pinpoint-go-agent/plugin/chi) | ||
|
||
This package instruments inbound requests handled by a chi.Router. | ||
Register the Middleware as the middleware of the router to trace all handlers: | ||
|
||
``` go | ||
r := chi.NewRouter() | ||
r.Use(ppchi.Middleware()) | ||
``` | ||
|
||
Use WrapHandler or WrapHandlerFunc to select the handlers you want to track: | ||
|
||
``` go | ||
r.Get("/hello", ppchi.WrapHandlerFunc(hello)) | ||
``` | ||
|
||
For each request, a pinpoint.Tracer is stored in the request context. | ||
By using the pinpoint.FromContext function, this tracer can be obtained in your handler. | ||
Alternatively, the context of the request may be propagated where the context that contains the pinpoint.Tracer is required. | ||
|
||
``` go | ||
import ( | ||
"net/http" | ||
|
||
"github.com/go-chi/chi" | ||
"github.com/pinpoint-apm/pinpoint-go-agent" | ||
"github.com/pinpoint-apm/pinpoint-go-agent/plugin/chi" | ||
) | ||
|
||
func hello(w http.ResponseWriter, r *http.Request) { | ||
io.WriteString(w, "hello world") | ||
} | ||
|
||
func main() { | ||
... //setup agent | ||
|
||
r := chi.NewRouter() | ||
r.Use(ppchi.Middleware()) | ||
|
||
r.Get("/hello", hello) | ||
http.ListenAndServe(":8000", r) | ||
} | ||
``` | ||
|
||
[Full Example Source](/plugin/chi/example/chi_server.go) | ||
|
||
This package supports URL Statistics feature. It aggregates response times, successes and failures for each router pattern. | ||
|
||
### Config Options | ||
* [Http.Server.StatusCodeErrors](/doc/config.md#Http.Server.StatusCodeErrors) | ||
* [Http.Server.ExcludeUrl](/doc/config.md#Http.Server.ExcludeUrl) | ||
* [Http.Server.ExcludeMethod](/doc/config.md#Http.Server.ExcludeMethod) | ||
* [Http.Server.RecordRequestHeader](/doc/config.md#Http.Server.RecordRequestHeader) | ||
* [Http.Server.RecordResponseHeader](/doc/config.md#Http.Server.RecordResponseHeader) | ||
* [Http.Server.RecordRequestCookie](/doc/config.md#Http.Server.RecordRequestCookie) | ||
* [Http.UrlStat.Enable](/doc/config.md#Http.UrlStat.Enable) | ||
* [Http.UrlStat.LimitSize](/doc/config.md#Http.UrlStat.LimitSize) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# ppecho | ||
This package instruments the [labstack/echo](https://github.com/labstack/echo) package. | ||
|
||
## Installation | ||
|
||
```bash | ||
$ go get github.com/pinpoint-apm/pinpoint-go-agent/plugin/echo | ||
``` | ||
```go | ||
import "github.com/pinpoint-apm/pinpoint-go-agent/plugin/echo" | ||
``` | ||
## Usage | ||
[![PkgGoDev](https://pkg.go.dev/badge/github.com/pinpoint-apm/pinpoint-go-agent/plugin/echo)](https://pkg.go.dev/github.com/pinpoint-apm/pinpoint-go-agent/plugin/echo) | ||
|
||
This package instruments inbound requests handled by an echo.Router. | ||
Register the Middleware as the middleware of the router to trace all handlers: | ||
|
||
``` go | ||
e := echo.New() | ||
e.Use(ppecho.Middleware()) | ||
``` | ||
|
||
Use WrapHandler to select the handlers you want to track: | ||
|
||
``` go | ||
e.GET("/hello", ppecho.WrapHandler(hello)) | ||
``` | ||
|
||
For each request, a pinpoint.Tracer is stored in the request context. | ||
By using the pinpoint.FromContext function, this tracer can be obtained in your handler. | ||
Alternatively, the context of the request may be propagated where the context that contains the pinpoint.Tracer is required. | ||
|
||
``` go | ||
package main | ||
|
||
import ( | ||
"github.com/labstack/echo" | ||
"github.com/pinpoint-apm/pinpoint-go-agent" | ||
"github.com/pinpoint-apm/pinpoint-go-agent/plugin/echo" | ||
) | ||
|
||
func hello(c echo.Context) error { | ||
return c.String(200, "Hello World!!") | ||
} | ||
|
||
func main() { | ||
... //setup agent | ||
|
||
e := echo.New() | ||
e.Use(ppecho.Middleware()) | ||
|
||
e.GET("/hello", hello) | ||
e.Start(":9000") | ||
} | ||
|
||
``` | ||
[Full Example Source](/plugin/echo/example/echo_server.go) | ||
|
||
This package supports URL Statistics feature. It aggregates response times, successes and failures for each router pattern. | ||
|
||
### Config Options | ||
* [Http.Server.StatusCodeErrors](/doc/config.md#Http.Server.StatusCodeErrors) | ||
* [Http.Server.ExcludeUrl](/doc/config.md#Http.Server.ExcludeUrl) | ||
* [Http.Server.ExcludeMethod](/doc/config.md#Http.Server.ExcludeMethod) | ||
* [Http.Server.RecordRequestHeader](/doc/config.md#Http.Server.RecordRequestHeader) | ||
* [Http.Server.RecordResponseHeader](/doc/config.md#Http.Server.RecordResponseHeader) | ||
* [Http.Server.RecordRequestCookie](/doc/config.md#Http.Server.RecordRequestCookie) | ||
* [Http.UrlStat.Enable](/doc/config.md#Http.UrlStat.Enable) | ||
* [Http.UrlStat.LimitSize](/doc/config.md#Http.UrlStat.LimitSize) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# ppechov4 | ||
This package instruments the [labstack/echo/v4](https://github.com/labstack/echo) package. | ||
|
||
## Installation | ||
|
||
```bash | ||
$ go get github.com/pinpoint-apm/pinpoint-go-agent/plugin/echov4 | ||
``` | ||
```go | ||
import "github.com/pinpoint-apm/pinpoint-go-agent/plugin/echov4" | ||
``` | ||
## Usage | ||
[![PkgGoDev](https://pkg.go.dev/badge/github.com/pinpoint-apm/pinpoint-go-agent/plugin/echov4)](https://pkg.go.dev/github.com/pinpoint-apm/pinpoint-go-agent/plugin/echov4) | ||
|
||
This package instruments inbound requests handled by an echo.Router. | ||
Register the Middleware as the middleware of the router to trace all handlers: | ||
|
||
``` go | ||
e := echo.New() | ||
e.Use(ppechov4.Middleware()) | ||
``` | ||
|
||
Use WrapHandler to select the handlers you want to track: | ||
|
||
``` go | ||
e.GET("/hello", ppechov4.WrapHandler(hello)) | ||
``` | ||
|
||
For each request, a pinpoint.Tracer is stored in the request context. | ||
By using the pinpoint.FromContext function, this tracer can be obtained in your handler. | ||
Alternatively, the context of the request may be propagated where the context that contains the pinpoint.Tracer is required. | ||
|
||
``` go | ||
package main | ||
|
||
import ( | ||
"github.com/labstack/echo/v4" | ||
"github.com/pinpoint-apm/pinpoint-go-agent" | ||
"github.com/pinpoint-apm/pinpoint-go-agent/plugin/echov4" | ||
) | ||
|
||
func hello(c echo.Context) error { | ||
return c.String(200, "Hello World!!") | ||
} | ||
|
||
func main() { | ||
... //setup agent | ||
|
||
e := echo.New() | ||
e.Use(ppecho.Middleware()) | ||
|
||
e.GET("/hello", hello) | ||
e.Start(":9000") | ||
} | ||
|
||
``` | ||
[Full Example Source](/plugin/echov4/example/echov4_server.go) | ||
|
||
This package supports URL Statistics feature. It aggregates response times, successes and failures for each router pattern. | ||
|
||
### Config Options | ||
* [Http.Server.StatusCodeErrors](/doc/config.md#Http.Server.StatusCodeErrors) | ||
* [Http.Server.ExcludeUrl](/doc/config.md#Http.Server.ExcludeUrl) | ||
* [Http.Server.ExcludeMethod](/doc/config.md#Http.Server.ExcludeMethod) | ||
* [Http.Server.RecordRequestHeader](/doc/config.md#Http.Server.RecordRequestHeader) | ||
* [Http.Server.RecordResponseHeader](/doc/config.md#Http.Server.RecordResponseHeader) | ||
* [Http.Server.RecordRequestCookie](/doc/config.md#Http.Server.RecordRequestCookie) | ||
* [Http.UrlStat.Enable](/doc/config.md#Http.UrlStat.Enable) | ||
* [Http.UrlStat.LimitSize](/doc/config.md#Http.UrlStat.LimitSize) |
Oops, something went wrong.