Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ The next release will require at least [Go 1.24].
### Changed

- Change the default span name to be `GET /path` so it complies with the HTTP semantic conventions in `go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux`. (#7551)
- Change the faas.max_memory unit to be bytes instead of MB to comply with the semantic conventions in `go.opentelemetry.io/contrib/detectors/aws/lambda`. (#7745)
- Transform attribute values of `go.opentelemetry.io/otel/attribute.Value` and `go.opentelemetry.io/otel/log.Value` types to appropriate `go.opentelemetry.io/otel/log.Value` type instead of `log.StringValue` in the modules below. (#7660)
- `go.opentelemetry.io/contrib/bridges/otellogr`
- `go.opentelemetry.io/contrib/bridges/otellogrus`
Expand Down
3 changes: 2 additions & 1 deletion detectors/aws/lambda/detector.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const (
lambdaFunctionVersionEnvVar = "AWS_LAMBDA_FUNCTION_VERSION"
lambdaLogStreamNameEnvVar = "AWS_LAMBDA_LOG_STREAM_NAME"
lambdaMemoryLimitEnvVar = "AWS_LAMBDA_FUNCTION_MEMORY_SIZE"
miB = 1 << 20
)

var (
Expand Down Expand Up @@ -65,7 +66,7 @@ func (*resourceDetector) Detect(context.Context) (*resource.Resource, error) {
maxMemoryStr := os.Getenv(lambdaMemoryLimitEnvVar)
maxMemory, err := strconv.Atoi(maxMemoryStr)
if err == nil {
attrs = append(attrs, semconv.FaaSMaxMemory(maxMemory))
attrs = append(attrs, semconv.FaaSMaxMemory(maxMemory*miB))
}

return resource.NewWithAttributes(semconv.SchemaURL, attrs...), nil
Expand Down
2 changes: 1 addition & 1 deletion detectors/aws/lambda/detector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestDetectSuccess(t *testing.T) {
semconv.FaaSName("testFunction"),
semconv.FaaSVersion("$LATEST"),
semconv.FaaSInstance("2023/01/01/[$LATEST]5d1edb9e525d486696cf01a3503487bc"),
semconv.FaaSMaxMemory(128),
semconv.FaaSMaxMemory(128 * miB),
}
expectedResource := resource.NewWithAttributes(semconv.SchemaURL, attributes...)
detector := resourceDetector{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import (
"go.opentelemetry.io/contrib/propagators/aws/xray"
)

const miB = 1 << 20

var errorLogger = log.New(log.Writer(), "OTel Lambda Test Error: ", 0)

type mockIDGenerator struct {
Expand Down Expand Up @@ -142,7 +144,7 @@ var (
attribute.String("faas.name", "testFunction"),
attribute.String("faas.version", "$LATEST"),
attribute.String("faas.instance", "2023/01/01/[$LATEST]5d1edb9e525d486696cf01a3503487bc"),
attribute.Int("faas.max_memory", 128)),
attribute.Int("faas.max_memory", 128*miB)),
InstrumentationScope: instrumentation.Scope{
Name: "go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-lambda-go/otellambda",
Version: otellambda.Version(),
Expand Down Expand Up @@ -337,7 +339,7 @@ var (
attribute.String("faas.name", "testFunction"),
attribute.String("faas.version", "$LATEST"),
attribute.String("faas.instance", "2023/01/01/[$LATEST]5d1edb9e525d486696cf01a3503487bc"),
attribute.Int("faas.max_memory", 128)),
attribute.Int("faas.max_memory", 128*miB)),
InstrumentationScope: instrumentation.Scope{
Name: "go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-lambda-go/otellambda",
Version: otellambda.Version(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import (
"go.opentelemetry.io/contrib/propagators/aws/xray"
)

const miB = 1 << 20

func TestEventToCarrier(t *testing.T) {
t.Setenv("_X_AMZN_TRACE_ID", "traceID")
carrier := xrayEventToCarrier([]byte{})
Expand Down Expand Up @@ -107,7 +109,7 @@ var (
{Key: "cloud.provider", Value: &v1common.AnyValue{Value: &v1common.AnyValue_StringValue{StringValue: "aws"}}},
{Key: "cloud.region", Value: &v1common.AnyValue{Value: &v1common.AnyValue_StringValue{StringValue: "us-texas-1"}}},
{Key: "faas.instance", Value: &v1common.AnyValue{Value: &v1common.AnyValue_StringValue{StringValue: "2023/01/01/[$LATEST]5d1edb9e525d486696cf01a3503487bc"}}},
{Key: "faas.max_memory", Value: &v1common.AnyValue{Value: &v1common.AnyValue_IntValue{IntValue: 128}}},
{Key: "faas.max_memory", Value: &v1common.AnyValue{Value: &v1common.AnyValue_IntValue{IntValue: 128 * miB}}},
{Key: "faas.name", Value: &v1common.AnyValue{Value: &v1common.AnyValue_StringValue{StringValue: "testFunction"}}},
{Key: "faas.version", Value: &v1common.AnyValue{Value: &v1common.AnyValue_StringValue{StringValue: "$LATEST"}}},
},
Expand Down
Loading