Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion autospotting.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/aws/aws-lambda-go/lambda"
"github.com/aws/aws-sdk-go/aws/endpoints"
"github.com/aws/aws-xray-sdk-go/strategy/ctxmissing"
"github.com/aws/aws-xray-sdk-go/xray"
"github.com/cristim/autospotting/core"
"github.com/cristim/ec2-instances-info"
Expand Down Expand Up @@ -58,7 +59,10 @@ func run(ctx context.Context) {
conf.TagFilteringMode,
conf.SpotProductDescription)

xray.Configure(xray.Config{LogLevel: "error"})
xray.Configure(xray.Config{
ContextMissingStrategy: ctxmissing.NewDefaultLogErrorStrategy(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks much better than I had attempted... I'm just sorry I wasted a few hours trying to fix this myself without any results.

I'll try it out tomorrow.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worked like a charm!

LogLevel: "error",
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be configurable from an env variable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What exactly do you want to configure in this place? Log level?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made log level configurable via flag, but it looks like there is a bug in X-Ray SDK. aws/aws-xray-sdk-go#60. At the moment, it will post a particular error message ignoring log level...

autospotting.Run(ctx, conf.Config)
log.Println("Execution completed, nothing left to do")
}
Expand Down