Skip to content

Commit

Permalink
adding fixed change
Browse files Browse the repository at this point in the history
  • Loading branch information
Paramadon committed Dec 11, 2024
1 parent 15fda03 commit cbb2dee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
6 changes: 3 additions & 3 deletions exporter/awsemfexporter/emf_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
"context"
"errors"
"fmt"
"github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsmiddleware"
"github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil"
"strings"
"sync"

"github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsmiddleware"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/google/uuid"
"go.opentelemetry.io/collector/component"
Expand Down Expand Up @@ -167,7 +167,7 @@ func (emf *emfExporter) getPusher(key cwlogs.StreamKey) (cwlogs.Pusher, error) {

pusher, exists := emf.pusherMap[key]
if !exists {
if emf.set.Logger !=nil{
if emf.set.Logger != nil {
pusher = cwlogs.NewPusher(key, emf.retryCnt, *emf.svcStructuredLog, emf.set.Logger)
} else {
pusher = cwlogs.NewPusher(key, emf.retryCnt, *emf.svcStructuredLog, emf.config.logger)
Expand All @@ -188,7 +188,7 @@ func (emf *emfExporter) listPushers() []cwlogs.Pusher {
return pushers
}

func (emf *emfExporter) start(ctx context.Context, host component.Host) error {
func (emf *emfExporter) start(_ context.Context, host component.Host) error {
// Create AWS session here
awsConfig, session, err := awsutil.GetAWSConfigSession(emf.config.logger, &awsutil.Conn{}, &emf.config.AWSSessionSettings)
if err != nil {
Expand Down
7 changes: 1 addition & 6 deletions exporter/awsemfexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ package awsemfexporter // import "github.com/open-telemetry/opentelemetry-collec

import (
"context"
"fmt"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/exporter"
"go.opentelemetry.io/collector/exporter/exporterhelper"
Expand Down Expand Up @@ -61,16 +59,13 @@ func createMetricsExporter(ctx context.Context, params exporter.Settings, config
return nil, err
}

// Calling start right after constructor
if err := emfExp.start(ctx, nil); err != nil {
return nil, fmt.Errorf("failed to start EMF exporter: %w", err)
}

exporter, err := exporterhelper.NewMetricsExporter(
ctx,
params,
config,
emfExp.pushMetricsData,
exporterhelper.WithStart(emfExp.start),
exporterhelper.WithShutdown(emfExp.shutdown),
)
if err != nil {
Expand Down

0 comments on commit cbb2dee

Please sign in to comment.