Skip to content

Commit

Permalink
Modify according to code review comments
Browse files Browse the repository at this point in the history
Signed-off-by: surechen <chenshuo17@huawei.com>
  • Loading branch information
surechen committed Oct 22, 2019
1 parent 19d17f7 commit b193fe2
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 40 deletions.
50 changes: 17 additions & 33 deletions docs/skywalking/skywalking.md
@@ -1,52 +1,36 @@
# SkyWalking

Skywalking-manager is a handler plugin of mesher, it reports tracing data to skywalking server
Skywalking-manager is a handler plugin of mesher, it reports tracing data to skywalking server.

## Configurations
**In conf/mesher.conf**

**servicecomb.apm.tracing.enable**
> *(optional, bool)* enable apm
> *(optional, bool)* enable application performance manager
**servicecomb.apm.tracing.serverUri**
> *(optional, string)* server address of skywalking
## Example
```yaml
servicecomb:
apm:
apm: #application performance monitor
tracing:
enable: true
serverUri: 127.0.0.1:11800
enable: true #enable tracing ability
serverUri: 127.0.0.1:11800 #url of skywalking
```
## Step:

## SkyWawlking-Manager Init
**In file proxy/bootstrap/bootstrap.go**
```shell script
import "github.com/apache/servicecomb-mesher/proxy/pkg/skywalking"
```
**In function Start()**
```shell script
skywalking.Init()
```

**In function SetHandlers() add two Handlers**
```shell script
consumerChain := strings.Join([]string{
...
skywalking.SkyWalkingConsumer,
chassisHandler.Transport,
}}
# 1. SkyWawlking-Manager Init
**You must init skywawlking manager pkg which will manage connection and report msg to skywalking**
- For example:
- [1] You can import skywalking manager proxy/pkg/skywalking in file proxy/bootstrap/bootstrap.go.
- [2] Calling function Init() in proxy/pkg/skywalking manually to init skywalking manager.
- [3] Adding skywalking's consumer handler name SkyWalkingConsumer defined in proxy/pkg/skywalking to consumerChain.
- [4] Adding skywalking's provider handler name SkyWalkingProvider defined in proxy/pkg/skywalking to providerChain.
- more details about handler chains in [go-chassis](https://github.com/go-chassis/go-chassis#readme)

providerChain := strings.Join([]string{
...
skywalking.SkyWalkingProvider,
chassisHandler.Transport,
}}
# 2. SkyWalking-Handler Init
- You must import proxy/handler pkg to init skywalking handler. Not only skywalking handler, all the handlers which are customized for mesher are defined here.
- For example you can import handler pkg in file cmd/mesher/mesher.go

```
## SkyWalking-Handler Init
**In cmd/mesher/mesher.go**
```shell script
import _ "github.com/apache/servicecomb-mesher/proxy/handler"
```
6 changes: 3 additions & 3 deletions proxy/config/struct.go
Expand Up @@ -74,12 +74,12 @@ type Tracing struct {
ServerURI string `yaml:"serverUri"`
}

//Apm is for Application Performance Management
type Apm struct {
//APM is for Application Performance Management
type APM struct {
Tracing Tracing `yaml:"tracing"`
}

//ServiceComb is for servicecomb config
type ServiceComb struct {
APM Apm `yaml:"apm"`
APM APM `yaml:"apm"`
}
5 changes: 3 additions & 2 deletions proxy/handler/skywalking_handler.go
Expand Up @@ -32,8 +32,9 @@ const (
)

const (
HTTPClientComponentID = 2
HTTPServerComponentID = 49
HTTPClientComponentID = 2
ServiceCombComponentID = 28
HTTPServerComponentID = 49
)

//SkyWalkingProviderHandler struct
Expand Down
2 changes: 1 addition & 1 deletion proxy/handler/skywalking_handler_test.go
Expand Up @@ -44,7 +44,7 @@ func initGcConfig() {

//initMesherConfig
func initMesherConfig() {
config.SetConfig(&config.MesherConfig{ServiceComb: &config.ServiceComb{config.Apm{config.Tracing{Enable: true, ServerURI: "192.168.0.1:17289"}}}})
config.SetConfig(&config.MesherConfig{ServiceComb: &config.ServiceComb{config.APM{config.Tracing{Enable: true, ServerURI: "192.168.0.1:17289"}}}})
}

//initInv
Expand Down
2 changes: 1 addition & 1 deletion proxy/pkg/skywalking/skywalking_manager_test.go
Expand Up @@ -42,7 +42,7 @@ func initConfig() {

//initMesherConfig
func initMesherConfig() {
config.SetConfig(&config.MesherConfig{ServiceComb: &config.ServiceComb{config.Apm{config.Tracing{Enable: true, ServerURI: "192.168.0.1:17289"}}}})
config.SetConfig(&config.MesherConfig{ServiceComb: &config.ServiceComb{config.APM{config.Tracing{Enable: true, ServerURI: "192.168.0.1:17289"}}}})
}

//initInv
Expand Down

0 comments on commit b193fe2

Please sign in to comment.