question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

<pattern>: do not include property when value is empty/null

See original GitHub issue

Suppose the following pattern:

<pattern>
{
   "trace": "%mdc{traceId}"
}
</pattern>

Is there a way to omit the trace property when there is no such traceId MDC key? Something like what #nullNA{...} does for Access events…

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:8
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

14reactions
kharnt0xcommented, Nov 3, 2017

we would definitely welcome this feature

0reactions
philsttrcommented, May 25, 2019

@wsargent If my understanding is correct, this request is more about excluding a specific field within a pattern based on the the field’s evaluated value, rather than excluding the whole pattern based on a value.

i.e. if the pattern is something like this:

{
    "trace": "%mdc{traceId}",
    "foo": "bar"
}

Then only the trace field would be omitted if the field value evaluated to null. The foo field would still be included regardless.

You could work around this by separating out every possible nullable thing into a different pattern, but that would be cumbersome when working with a large pattern.

Read more comments on GitHub >

github_iconTop Results From Across the Web

<pattern>: do not include property when value is empty/null ...
Suppose the following pattern: { "trace": "%mdc{traceId}" } Is there a way to omit the trace property when there is no such traceId...
Read more >
c# - What does "is { }" mean? - Stack Overflow
That's just the empty property pattern in C# 8, meaning the value not null . It matches any value type or reference type....
Read more >
Matching null values and empty strings in Amazon ...
Null values and empty strings are not interchangeable in pattern matching. An event pattern that matches empty strings doesn't match values of null...
Read more >
Understanding non-existent properties and working with nulls
That is, there really is no such thing as a property with a null value; null indicates that the property doesn't exist at...
Read more >
Orchestrator Quick Tip: “Null” value conditions
Use the “Matches Pattern” or “Does Not Match pattern” condition and enter the regular expression ^$ which is interpreted as “blank”. thumbnail ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found