Skip to content

ITransaction.AddCustomAttribute should support Array arguments #2977

@nr-ahemsath

Description

@nr-ahemsath

The .NET agent API method ITransaction.AddCustomAttribute currently does not support values of type Array. The documentation says that unsupported types will have .ToString() called on them and treated as strings. This appears to be the current behavior; the following code:

        [Transaction]
        private static void CreateTransactionWithCustomAttributeArrayArgument(int length)
        {
            var eventAttributes = new string[length];
            for (int i = 0; i < length; i++) {
                eventAttributes[i] = $"foo{i}";
            }
            var tx = NewRelic.Api.Agent.NewRelic.GetAgent().CurrentTransaction;
            tx.AddCustomAttribute("ArrayAttributeTest", eventAttributes);
        }

results in the following atrribute attached to the transaction:
ArrayAttributeTest System.String[]

We have a customer request to support array custom attribute values "not via escaping & stringifying json & then using NRQL for parsing".

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestTo tag an issue after triage that is a feature instead of TD

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions