Skip to content

Commit

Permalink
chore: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
reggiemcdonald committed Aug 11, 2020
1 parent 7f8e5a8 commit 37b2076
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions instrumentation/github.com/astaxie/beego/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,48 @@ You can customize instrumentation by passing any of the following options to `Ne
| `WithPropagators(propagation.Propagators)` | The propagators to be used. If not specified, `global.Propagators()` will be used. |
| `WithFilter(Filter)` | Adds an additional filter function to the configuration. Defaults to no filters. |
| `WithSpanNameFormatter(SpanNameFormatter)` | The formatter used to format span names. If not specified, the route will be used instead. |

You can also trace the `Render`, `RenderString`, and `RenderBytes` functions. You should disable the `AutoRender` setting either programmatically or in the config file, so you can explicitly call the traced implementations:

```go
package main

import (
"github.com/astaxie/beego"

otelBeego "go.opentelemetry.io/contrib/instrumentation/github.com/astaxie/beego"
)

type ExampleController struct {
beego.Controller
}

func (c *ExampleController) Get() {
c.TplName = "index.ptl"

// explicit call to traced Render function
otelBeego.Render(&c.Controller)
}

func main() {
// Init the tracer and metric export pipelines

// Disable autorender
beego.BConfig.WebConfig.AutoRender = false

// Create your routes
beego.Router("/", &ExampleController{})

// Create the MiddleWare
mware := otelBeego.NewOTelBeegoMiddleWare("example-server")

// Run the server with the MiddleWare
beego.RunWithMiddleWares("localhost:8080", mware)
}
```

| Function | Description |
| -------- | ----------- |
| `Render(*beego.Controller) error` | Provides tracing to `beego.Render`. |
| `RenderString(*beego.Controller) (string, error)` | Provides tracing to `beego.RenderString`. |
| `RenderBytes(*beego.Controller) ([]byte, error)` | Provides tracing to `beego.RenderBytes`. |

0 comments on commit 37b2076

Please sign in to comment.