Comments (10)
It seems that this feature is now implemented:
getsentry/sentry-javascript#623 (comment)
Can we reopen this perhaps?
from sentry-dotnet.
I see, thanks for your reply. Looking at it, I have two questions:
- How do I use this overload?
SentrySdk.AddBreadCrumb
is the documented approach, but this overload is not available on theSentrySdk
static class.
Those extensions are available when adding directly to the event or to the scope. The latter is what SentrySdk.AddBreadcrumb
does. You can see all extension methods through:
SentrySdk.ConfigureScope(s => s.AddBreadcrumb(...)
- In the source code, it seems that it adds a KeyValuePair to the
Dictionary<string,string>
, so we're not really setting the top-level data object.
Not sure I follow. What do you mean by the top level data
object? The Dictionary<string, string> named data
is the field in the breadcrumb object where we can define arbitrary data.
We document this here: https://develop.sentry.dev/sdk/event-payloads/breadcrumbs/
The fields at the level of the breadcrumb (ie.: its properties) are typed and you can't add data that's not specified in the documentation above.
Thinking about it more, I suppose that as long as the Sentry UI displays the string values as is, including whitespace and linebreaks, then it doesn't really matter whether or not it understands JSON, since we can include a pretty-printed json string in the breadcrumbs.
I will experiment with this approach.
Sounds good! I hope this works out.
from sentry-dotnet.
Currently Sentry doesn't really support a serialized object in its data
bag.
Serializing an object shows up like this:
I think this could be a feature request opened on Sentry and if implemented, change the SDKs which is a coordinated thing now as align the API.
from sentry-dotnet.
@lunim I'll close this as per my comment above.
If Sentry itself is changed to support breadcrumbs value as objects we can reopen this and implement support in this SDK.
from sentry-dotnet.
It's a bit of an issue to take object
because often people put data that can't be serialized by default and we have issues.
Forcing this to be ISerializable
will introduce friction, since one would need to implement the interface and get serialization done. To be quite honest at this point I would prefer the caller serializes it.
from sentry-dotnet.
from sentry-dotnet.
It currently accepts string
as a value so it should already work if you're serializing before setting it.
There are different extension method, for example accepting a value tuple:
from sentry-dotnet.
I see, thanks for your reply. Looking at it, I have two questions:
- How do I use this overload?
SentrySdk.AddBreadCrumb
is the documented approach, but this overload is not available on theSentrySdk
static class. - In the source code, it seems that it adds a KeyValuePair to the
Dictionary<string,string>
, so we're not really setting the top-level data object.
Thinking about it more, I suppose that as long as the Sentry UI displays the string values as is, including whitespace and linebreaks, then it doesn't really matter whether or not it understands JSON, since we can include a pretty-printed json string in the breadcrumbs.
I will experiment with this approach.
from sentry-dotnet.
@boukeversteegh @lunim looks like @bruno-garcia answered this one.
from sentry-dotnet.
Sorry to keep this open.
My current workaround is to pass a dictionary like this;
Dictionary<string, string> data = new();
data.Add(key, JsonFormatter.Format(message)); // formats a Protobuf message to JSON
SentrySdk.AddBreadcrumb(description, category, null, data);
It's just shown as a string, and the json structure is not handled in any way, but it's workable for small messages. Haven't tested yet with formatted/multiline strings.
Closing this is OK I suppose. Thanks!
from sentry-dotnet.
Related Issues (20)
- Sentry assembly produces trim warnings when compiling AOT HOT 1
- System.IO.IOException in DebugStackTrace
- Hangfire not in cron HOT 1
- Add logs to `metrics`
- Remove FirstChanceException workaround
- Try to populate DeviceInfo if/when sentry-native is available
- Add the Refit Exception Content to Sentry HOT 4
- Improve OutOfMemory insight
- Incorrect stack traces for UWP in .NET Native HOT 5
- Filter out health check transactions HOT 6
- Cocoa Issues
- Enhanced Stack Frames with Native AOT HOT 4
- Crash in release mode when using the Logging extensions only HOT 14
- `scope.User = null` shows warning of CS8625: Cannot convert null literal to non-nullable reference type. HOT 6
- Add a benchmark action
- Make span eligible for `Requests` HOT 2
- install instructions for profiling have the wrong version HOT 4
- Sentry dotnet SDK is blowing away User.IpAddress if we set it explicitly and SendDefaultPii is true HOT 4
- Mobile: User.Other is included in managed errors but not native ones HOT 2
- No debug logs on MAUI when launching within Visual Studio HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sentry-dotnet.