Skip to content

Commit

Permalink
[exporter/alibabacloudlogservice] do not expose method (#26383)
Browse files Browse the repository at this point in the history
**Description:**
Remove exposed function, only keep NewFactory to pass checkapi

**Link to tracking Issue:**

#26304
  • Loading branch information
sakulali authored Sep 5, 2023
1 parent e6e5f54 commit f94a24d
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 18 deletions.
27 changes: 27 additions & 0 deletions .chloggen/alibabacloudlogservice-checkapi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: breaking

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: alibabacloudlogserviceexporter

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Do not export the function `NewLogServiceClient`

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [26304]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [api]
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 f94a24d

Please sign in to comment.