-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Custom to Context and expose it via public API #585
Add Custom to Context and expose it via public API #585
Conversation
is build failed? @gregkalapos |
We had some known CI issues which we already work on. The build fail is probably not related to this PR. |
@@ -1,45 +1,50 @@ | |||
using System; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry about the lots of changes here - this is again our line ending issue. The only real change here is that I added public Dictionary<string, string> Custom => _custom.Value;
and public bool ShouldSerializeCustom() => _custom.IsValueCreated && Custom.Count > 0;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs LGTM. A couple suggestions.
docs/public-api.asciidoc
Outdated
[[api-transaction-Custom]] | ||
==== `Dictionary<string,string> Custom` | ||
|
||
Custom context is used to add non-indexed, custom contextual information to transactions. Non-indexed means the data is not searchable or aggregatable in Elasticsearch, and you cannot build dashboards on top of the data. However, non-indexed information is useful for other reasons, like providing contextual information to help you quickly debug performance issues or errors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move each sentence to its own line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I did it.
Co-Authored-By: Brandon Morelli <[email protected]>
…pos/apm-agent-dotnet into ExposeTransactionCustom
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM other than missing Custom
keys validation
docs/public-api.asciidoc
Outdated
---- | ||
Agent.Tracer.CaptureTransaction(transactionName, transactionType, (transaction) => | ||
{ | ||
transaction.Custom.Add("foo", "bar"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be more consistent to use indexer here just as in Labels
example and also it might be worth using value that would not be possible to store as label (i.e., very long string).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, changed it to indexer
/// </summary> | ||
[JsonProperty("tags")] | ||
[JsonConverter(typeof(LabelsJsonConverter))] | ||
public Dictionary<string, string> Custom => _custom.Value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need JsonConverter
here as well to ensure the keys are valid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a converter for this - also covered by tests now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Addressing #582.
Adding and exposing
Custom
which is not yet available in .NET.Also added docs.