You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2020/12/28 14:28:31 UTC

[GitHub] [skywalking-satellite] surlymo commented on a change in pull request #11: add prometheus server

surlymo commented on a change in pull request #11:
URL: https://github.com/apache/skywalking-satellite/pull/11#discussion_r549363740



##########
File path: internal/pkg/plugin/definition.go
##########
@@ -33,12 +41,24 @@ type SharingPlugin interface {
 
 	// Prepare the sharing plugins, such as build the connection with the external services.
 	Prepare() error
+	// Start a server to receive the input APM data.
+	Start() error
 	// Close the sharing plugin.
 	Close() error
 }
 
 // Config is used to initialize the DefaultInitializingPlugin.
 type Config map[string]interface{}
 
-// NameField is a required field in Config.
-const NameField = "plugin_name"
+// GetPluginName returns a plugin name generated by the packages.
+func GetPluginName(p Plugin) string {
+	t := reflect.TypeOf(p)
+	if t.Kind() == reflect.Ptr {
+		t = t.Elem()
+	}
+	arr := strings.Split(t.PkgPath(), "/")
+	if len(arr) < 2 {

Review comment:
       magic num

##########
File path: internal/pkg/plugin/definition.go
##########
@@ -33,12 +41,24 @@ type SharingPlugin interface {
 
 	// Prepare the sharing plugins, such as build the connection with the external services.
 	Prepare() error
+	// Start a server to receive the input APM data.
+	Start() error
 	// Close the sharing plugin.
 	Close() error
 }
 
 // Config is used to initialize the DefaultInitializingPlugin.
 type Config map[string]interface{}
 
-// NameField is a required field in Config.
-const NameField = "plugin_name"
+// GetPluginName returns a plugin name generated by the packages.
+func GetPluginName(p Plugin) string {

Review comment:
       why not just return the string name?

##########
File path: plugins/fallbacker/timer/timer_fallbacker.go
##########
@@ -20,13 +20,15 @@ package timer
 import (
 	"time"
 
-	"github.com/apache/skywalking-satellite/internal/pkg/event"
+	"github.com/apache/skywalking-satellite/internal/pkg/config"
+	"github.com/apache/skywalking-satellite/internal/satellite/event"
 	"github.com/apache/skywalking-satellite/plugins/forwarder/api"
 )
 
 // Fallbacker is a timer fallbacker when forward fails. `latencyFactor` is the standard retry duration,
 // and the time for each retry is expanded by 2 times until the number of retries reaches the maximum.
 type Fallbacker struct {
+	config.CommonFields

Review comment:
       why all need this struct




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org