feat(sentry-types): Add trace metric protocol envelope support#1022
feat(sentry-types): Add trace metric protocol envelope support#1022szokeasaurusrex wants to merge 1 commit intomasterfrom
Conversation
|
ee23bf8 to
52b0419
Compare
| /// The metric name . Uses dot separators for hierarchy. | ||
| pub name: String, | ||
| /// The numeric value. | ||
| pub value: f64, |
There was a problem hiding this comment.
Is this fine?
It's technically not defined in the spec, but logically you should only be able to send ints for counters while you should be able to send floats for e.g. gauges.
I wonder what happens if you send a counter but serialize the value as 1.0, I guess it depends on how loosely this is defined in Relay/other systems.
There was a problem hiding this comment.
Looks like Relay converts all metric values to f64. There's also an example test where a counter is sent with a float value of 1.0.
So, I think it makes sense to stick with f64.
| pub unit: Option<String>, | ||
| /// Additional key-value attributes. | ||
| #[serde(default, skip_serializing_if = "Map::is_empty")] | ||
| pub attributes: Map<String, LogAttribute>, |
There was a problem hiding this comment.
I think we could rename this to Attribute and then alias type LogAttribute = Attribute so that it's not a breaking change if anyone is using it.
wdyt?
There was a problem hiding this comment.
Yeah, that could make sense; although, I am slightly concerned that the name Attribute is maybe a bit vague. What if we would want to use Attribute for something else one day? Thoughts?
In any case, let's make this change in a separate PR.
There was a problem hiding this comment.
Well the attributes API we're gonna introduce will take exactly the same types so the concepts would match.
a5a8201 to
d53c02f
Compare
Add `TraceMetric` protocol types and `trace_metric` envelope container serialization/deserialization in `sentry-types`. Closes #1008 Closes [RUST-159](https://linear.app/getsentry/issue/RUST-159/add-trace-metric-protocol-models-and-envelope-item-container-support) Co-authored-by: Joris Bayer <joris.bayer@sentry.io> Co-authored-by: Lorenzo Cian <17258265+lcian@users.noreply.github.com>
d53c02f to
d06efa0
Compare
Add
TraceMetricprotocol types andtrace_metricenvelope container serialization/deserialization insentry-types.Closes #1008
Closes RUST-159