Skip to content

Commit

Permalink
[chore] update alibabacloudlogserviceexporter to pass apicheck
Browse files Browse the repository at this point in the history
  • Loading branch information
sakulali committed Sep 4, 2023
1 parent a33a352 commit 4021008
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 18 deletions.
1 change: 0 additions & 1 deletion cmd/checkapi/allowlist.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
connector/servicegraphconnector
exporter/alibabacloudlogserviceexporter
exporter/awscloudwatchlogsexporter
exporter/awskinesisexporter
exporter/azuremonitorexporter
Expand Down
6 changes: 3 additions & 3 deletions exporter/alibabacloudlogserviceexporter/logs_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func newLogsExporter(set exporter.CreateSettings, cfg component.Config) (exporte
}

var err error
if l.client, err = NewLogServiceClient(cfg.(*Config), set.Logger); err != nil {
if l.client, err = newLogServiceClient(cfg.(*Config), set.Logger); err != nil {
return nil, err
}

Expand All @@ -34,7 +34,7 @@ func newLogsExporter(set exporter.CreateSettings, cfg component.Config) (exporte

type logServiceLogsSender struct {
logger *zap.Logger
client LogServiceClient
client logServiceClient
}

func (s *logServiceLogsSender) pushLogsData(
Expand All @@ -43,7 +43,7 @@ func (s *logServiceLogsSender) pushLogsData(
var err error
slsLogs := logDataToLogService(md)
if len(slsLogs) > 0 {
err = s.client.SendLogs(slsLogs)
err = s.client.sendLogs(slsLogs)
}
return err
}
6 changes: 3 additions & 3 deletions exporter/alibabacloudlogserviceexporter/metrics_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func newMetricsExporter(set exporter.CreateSettings, cfg component.Config) (expo
}

var err error
if l.client, err = NewLogServiceClient(cfg.(*Config), set.Logger); err != nil {
if l.client, err = newLogServiceClient(cfg.(*Config), set.Logger); err != nil {
return nil, err
}

Expand All @@ -34,7 +34,7 @@ func newMetricsExporter(set exporter.CreateSettings, cfg component.Config) (expo

type logServiceMetricsSender struct {
logger *zap.Logger
client LogServiceClient
client logServiceClient
}

func (s *logServiceMetricsSender) pushMetricsData(
Expand All @@ -44,7 +44,7 @@ func (s *logServiceMetricsSender) pushMetricsData(
var err error
logs := metricsDataToLogServiceData(s.logger, md)
if len(logs) > 0 {
err = s.client.SendLogs(logs)
err = s.client.sendLogs(logs)
}
return err
}
6 changes: 3 additions & 3 deletions exporter/alibabacloudlogserviceexporter/trace_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func newTracesExporter(set exporter.CreateSettings, cfg component.Config) (expor
}

var err error
if l.client, err = NewLogServiceClient(cfg.(*Config), set.Logger); err != nil {
if l.client, err = newLogServiceClient(cfg.(*Config), set.Logger); err != nil {
return nil, err
}

Expand All @@ -34,7 +34,7 @@ func newTracesExporter(set exporter.CreateSettings, cfg component.Config) (expor

type logServiceTraceSender struct {
logger *zap.Logger
client LogServiceClient
client logServiceClient
}

func (s *logServiceTraceSender) pushTraceData(
Expand All @@ -44,7 +44,7 @@ func (s *logServiceTraceSender) pushTraceData(
var err error
slsLogs := traceDataToLogServiceData(td)
if len(slsLogs) > 0 {
err = s.client.SendLogs(slsLogs)
err = s.client.sendLogs(slsLogs)
}
return err
}
16 changes: 8 additions & 8 deletions exporter/alibabacloudlogserviceexporter/uploader.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import (
"go.uber.org/zap"
)

// LogServiceClient log Service's client wrapper
type LogServiceClient interface {
// SendLogs send message to LogService
SendLogs(logs []*sls.Log) error
// logServiceClient log Service's client wrapper
type logServiceClient interface {
// sendLogs send message to LogService
sendLogs(logs []*sls.Log) error
}

type logServiceClientImpl struct {
Expand All @@ -41,8 +41,8 @@ func getIPAddress() (ipAddress string, err error) {
return ipAddress, err
}

// NewLogServiceClient Create Log Service client
func NewLogServiceClient(config *Config, logger *zap.Logger) (LogServiceClient, error) {
// newLogServiceClient Create Log Service client
func newLogServiceClient(config *Config, logger *zap.Logger) (logServiceClient, error) {
if config == nil || config.Endpoint == "" || config.Project == "" || config.Logstore == "" {
return nil, errors.New("missing logservice params: Endpoint, Project, Logstore")
}
Expand Down Expand Up @@ -71,8 +71,8 @@ func NewLogServiceClient(config *Config, logger *zap.Logger) (LogServiceClient,
return c, nil
}

// SendLogs send message to LogService
func (c *logServiceClientImpl) SendLogs(logs []*sls.Log) error {
// sendLogs send message to LogService
func (c *logServiceClientImpl) sendLogs(logs []*sls.Log) error {
return c.clientInstance.SendLogListWithCallBack(c.project, c.logstore, c.topic, c.source, logs, c)
}

Expand Down

0 comments on commit 4021008

Please sign in to comment.