Apm-agent-dotnet: Labels do not allow periods

Created on 3 Nov 2019  路  4Comments  路  Source: elastic/apm-agent-dotnet

Describe the bug
Setting a transaction/context label with a key that has a period in it, such as transaction.Context.Labels["account.paid"] results in a very difficult to parse error from the server.

To Reproduce
Steps to reproduce the behavior:

  1. Using a transaction t, set a label account.paid with any value, say true
  2. Call t.End()
  3. See error in logs, something along the lines of
[#/allOf/3/properties/context/properties/tags/additionalProperties] additionalProperties \"account.id\", \"route.controller\", \"route.action\", \"account.paid\" not allowed

Expected behavior
Ideally, periods would be allowed. But if a limitation of APM, I'd prefer a more clear error from the client. A couple of options:

  • Validation when serializing Labels that indicates . is not an allowed character.
  • A method on Context or ITransaction to add some guards against this that can error out with an exception.
  • An update to documentation that would be clear that . (and any other characters) are not allowed.
bug

All 4 comments

Thanks for reporting this @rgmills.

Just some update on this:

  • The APM server currently does not allow ., so probably short/mid term we won't be able to allow this.
  • I'm trying to figure out what all other Elastic APM agents do in this case, we usually try to align on these things.

I'll update once I know how all other agents handle this. Overall I totally agree with you that this could be improved.

Turns out that other agents simply replace . by _. I implemented this in #591 and I also added this to the documentation.

Awesome, thanks @gregkalapos

Implemented in #591 - this will be in the next release.

Was this page helpful?
0 / 5 - 0 ratings