Skip to content

Feature request: Sanitize Metadata for X-Ray #1010

@hjgraca

Description

@hjgraca

Use case

Currently X-Ray sdk has limitations on the types it supports for Metadata serialization, for instance it does not support, GUID, int64, Decimals and others. Some issues open here and here

Since we control the input for Metadata to X-Ray we will sanitize the input so customers will not have the error as reported here

Solution/User Experience

Handle the sanitization of the types that get serialized

For instance returning this object will fail, with this release it will be fixed

[Tracing]
public async Task<object> FunctionHandler(object input, ILambdaContext context)
{
    var details = new
    {
        SystemInfo = new
        {
            DotNetVersion = Environment.Version.ToString(),
            RuntimeVersion = RuntimeInformation.FrameworkDescription,
            OSDescription = RuntimeInformation.OSDescription,
            OSArchitecture = RuntimeInformation.OSArchitecture.ToString(),
            ProcessArchitecture = RuntimeInformation.ProcessArchitecture.ToString(),
            RuntimeIdentifier = RuntimeInformation.RuntimeIdentifier,
            MachineName = Environment.MachineName,
            ProcessorCount = Environment.ProcessorCount,
            WorkingSet = Environment.WorkingSet,
            Is64BitOperatingSystem = Environment.Is64BitOperatingSystem,
            Is64BitProcess = Environment.Is64BitProcess,
            CLRVersion = Environment.Version.ToString(),
            CurrentDirectory = Environment.CurrentDirectory
        },
        LambdaInfo = new
        {
            FunctionName = context.FunctionName,
            FunctionVersion = context.FunctionVersion,
            InvokedFunctionArn = context.InvokedFunctionArn,
            MemoryLimitInMB = context.MemoryLimitInMB,
            RemainingTime = context.RemainingTime,
            RequestId = context.AwsRequestId,
            LogGroupName = context.LogGroupName,
            LogStreamName = context.LogStreamName
        }
    };

    return details;
}

Alternative solutions

Acknowledgment

Metadata

Metadata

Assignees

Labels

area/tracingCore tracing utilityfeature-requestNew or enhancements to existing features

Type

No type

Projects

Status

🏗 In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions