relay_server/statsd.rs
1use relay_statsd::{CounterMetric, GaugeMetric, HistogramMetric, TimerMetric};
2#[cfg(doc)]
3use relay_system::RuntimeMetrics;
4
5/// Gauge metrics used by Relay
6pub enum RelayGauges {
7 /// Tracks the number of futures waiting to be executed in the pool's queue.
8 ///
9 /// Useful for understanding the backlog of work and identifying potential bottlenecks.
10 ///
11 /// This metric is tagged with:
12 /// - `pool`: the name of the pool.
13 AsyncPoolQueueSize,
14 /// Tracks the utilization of the async pool.
15 ///
16 /// The utilization is a value between 0.0 and 100.0 which determines how busy the pool is doing
17 /// CPU-bound work.
18 ///
19 /// This metric is tagged with:
20 /// - `pool`: the name of the pool.
21 AsyncPoolUtilization,
22 /// Tracks the activity of the async pool.
23 ///
24 /// The activity is a value between 0.0 and 100.0 which determines how busy is the pool
25 /// w.r.t. to its provisioned capacity.
26 ///
27 /// This metric is tagged with:
28 /// - `pool`: the name of the pool.
29 AsyncPoolActivity,
30 /// The state of Relay with respect to the upstream connection.
31 /// Possible values are `0` for normal operations and `1` for a network outage.
32 NetworkOutage,
33 /// The number of individual stacks in the priority queue.
34 ///
35 /// Per combination of `(own_key, sampling_key)`, a new stack is created.
36 BufferStackCount,
37 /// The used disk for the buffer.
38 BufferDiskUsed,
39 /// The currently used memory by the entire system.
40 ///
41 /// Relay uses the same value for its memory health check.
42 SystemMemoryUsed,
43 /// The total system memory.
44 ///
45 /// Relay uses the same value for its memory health check.
46 SystemMemoryTotal,
47 /// The number of connections currently being managed by the Redis Pool.
48 #[cfg(feature = "processing")]
49 RedisPoolConnections,
50 /// The number of idle connections in the Redis Pool.
51 #[cfg(feature = "processing")]
52 RedisPoolIdleConnections,
53 /// The maximum number of connections in the Redis pool.
54 #[cfg(feature = "processing")]
55 RedisPoolMaxConnections,
56 /// The number of futures waiting to grab a connection.
57 #[cfg(feature = "processing")]
58 RedisPoolWaitingForConnection,
59 /// The number of notifications in the broadcast channel of the project cache.
60 ProjectCacheNotificationChannel,
61 /// The number of scheduled and in progress fetches in the project cache.
62 ProjectCacheScheduledFetches,
63 /// Exposes the amount of currently open and handled connections by the server.
64 ServerActiveConnections,
65 /// Maximum delay of a metric bucket in seconds.
66 ///
67 /// The maximum is measured from initial creation of the bucket in an internal Relay
68 /// until it is produced to Kafka.
69 ///
70 /// This metric is tagged with:
71 /// - `namespace`: the metric namespace.
72 #[cfg(feature = "processing")]
73 MetricDelayMax,
74 /// Estimated percentage [0-100] of how busy Relay's internal services are.
75 ///
76 /// This metric is tagged with:
77 /// - `service`: the service name.
78 /// - `instance_id`: a for the service name unique identifier for the running service
79 ServiceUtilization,
80}
81
82impl GaugeMetric for RelayGauges {
83 fn name(&self) -> &'static str {
84 match self {
85 RelayGauges::AsyncPoolQueueSize => "async_pool.queue_size",
86 RelayGauges::AsyncPoolUtilization => "async_pool.utilization",
87 RelayGauges::AsyncPoolActivity => "async_pool.activity",
88 RelayGauges::NetworkOutage => "upstream.network_outage",
89 RelayGauges::BufferStackCount => "buffer.stack_count",
90 RelayGauges::BufferDiskUsed => "buffer.disk_used",
91 RelayGauges::SystemMemoryUsed => "health.system_memory.used",
92 RelayGauges::SystemMemoryTotal => "health.system_memory.total",
93 #[cfg(feature = "processing")]
94 RelayGauges::RedisPoolConnections => "redis.pool.connections",
95 #[cfg(feature = "processing")]
96 RelayGauges::RedisPoolIdleConnections => "redis.pool.idle_connections",
97 #[cfg(feature = "processing")]
98 RelayGauges::RedisPoolMaxConnections => "redis.pool.max_connections",
99 #[cfg(feature = "processing")]
100 RelayGauges::RedisPoolWaitingForConnection => "redis.pool.waiting_for_connection",
101 RelayGauges::ProjectCacheNotificationChannel => {
102 "project_cache.notification_channel.size"
103 }
104 RelayGauges::ProjectCacheScheduledFetches => "project_cache.fetches.size",
105 RelayGauges::ServerActiveConnections => "server.http.connections",
106 #[cfg(feature = "processing")]
107 RelayGauges::MetricDelayMax => "metrics.delay.max",
108 RelayGauges::ServiceUtilization => "service.utilization",
109 }
110 }
111}
112
113/// Gauge metrics collected from the Runtime.
114pub enum RuntimeGauges {
115 /// Exposes [`RuntimeMetrics::num_idle_threads`].
116 NumIdleThreads,
117 /// Exposes [`RuntimeMetrics::num_alive_tasks`].
118 NumAliveTasks,
119 /// Exposes [`RuntimeMetrics::blocking_queue_depth`].
120 BlockingQueueDepth,
121 /// Exposes [`RuntimeMetrics::num_blocking_threads`].
122 NumBlockingThreads,
123 /// Exposes [`RuntimeMetrics::num_idle_blocking_threads`].
124 NumIdleBlockingThreads,
125 /// Exposes [`RuntimeMetrics::num_workers`].
126 NumWorkers,
127 /// Exposes [`RuntimeMetrics::worker_local_queue_depth`].
128 ///
129 /// This metric is tagged with:
130 /// - `worker`: the worker id.
131 WorkerLocalQueueDepth,
132 /// Exposes [`RuntimeMetrics::worker_mean_poll_time`].
133 ///
134 /// This metric is tagged with:
135 /// - `worker`: the worker id.
136 WorkerMeanPollTime,
137}
138
139impl GaugeMetric for RuntimeGauges {
140 fn name(&self) -> &'static str {
141 match self {
142 RuntimeGauges::NumIdleThreads => "runtime.idle_threads",
143 RuntimeGauges::NumAliveTasks => "runtime.alive_tasks",
144 RuntimeGauges::BlockingQueueDepth => "runtime.blocking_queue_depth",
145 RuntimeGauges::NumBlockingThreads => "runtime.num_blocking_threads",
146 RuntimeGauges::NumIdleBlockingThreads => "runtime.num_idle_blocking_threads",
147 RuntimeGauges::NumWorkers => "runtime.num_workers",
148 RuntimeGauges::WorkerLocalQueueDepth => "runtime.worker_local_queue_depth",
149 RuntimeGauges::WorkerMeanPollTime => "runtime.worker_mean_poll_time",
150 }
151 }
152}
153
154/// Counter metrics collected from the Runtime.
155pub enum RuntimeCounters {
156 /// Exposes [`RuntimeMetrics::budget_forced_yield_count`].
157 BudgetForcedYieldCount,
158 /// Exposes [`RuntimeMetrics::worker_local_schedule_count`].
159 ///
160 /// This metric is tagged with:
161 /// - `worker`: the worker id.
162 WorkerLocalScheduleCount,
163 /// Exposes [`RuntimeMetrics::worker_noop_count`].
164 ///
165 /// This metric is tagged with:
166 /// - `worker`: the worker id.
167 WorkerNoopCount,
168 /// Exposes [`RuntimeMetrics::worker_overflow_count`].
169 ///
170 /// This metric is tagged with:
171 /// - `worker`: the worker id.
172 WorkerOverflowCount,
173 /// Exposes [`RuntimeMetrics::worker_park_count`].
174 ///
175 /// This metric is tagged with:
176 /// - `worker`: the worker id.
177 WorkerParkCount,
178 /// Exposes [`RuntimeMetrics::worker_poll_count`].
179 ///
180 /// This metric is tagged with:
181 /// - `worker`: the worker id.
182 WorkerPollCount,
183 /// Exposes [`RuntimeMetrics::worker_steal_count`].
184 ///
185 /// This metric is tagged with:
186 /// - `worker`: the worker id.
187 WorkerStealCount,
188 /// Exposes [`RuntimeMetrics::worker_steal_operations`].
189 ///
190 /// This metric is tagged with:
191 /// - `worker`: the worker id.
192 WorkerStealOperations,
193 /// Exposes [`RuntimeMetrics::worker_total_busy_duration`].
194 ///
195 /// This metric is tagged with:
196 /// - `worker`: the worker id.
197 WorkerTotalBusyDuration,
198}
199
200impl CounterMetric for RuntimeCounters {
201 fn name(&self) -> &'static str {
202 match self {
203 RuntimeCounters::BudgetForcedYieldCount => "runtime.budget_forced_yield_count",
204 RuntimeCounters::WorkerLocalScheduleCount => "runtime.worker_local_schedule_count",
205 RuntimeCounters::WorkerNoopCount => "runtime.worker_noop_count",
206 RuntimeCounters::WorkerOverflowCount => "runtime.worker_overflow_count",
207 RuntimeCounters::WorkerParkCount => "runtime.worker_park_count",
208 RuntimeCounters::WorkerPollCount => "runtime.worker_poll_count",
209 RuntimeCounters::WorkerStealCount => "runtime.worker_steal_count",
210 RuntimeCounters::WorkerStealOperations => "runtime.worker_steal_operations",
211 RuntimeCounters::WorkerTotalBusyDuration => "runtime.worker_total_busy_duration",
212 }
213 }
214}
215
216/// Histogram metrics used by Relay.
217pub enum RelayHistograms {
218 /// The number of bytes received by Relay for each individual envelope item type.
219 ///
220 /// This metric is tagged with:
221 /// - `item_type`: The type of the items being counted.
222 /// - `is_container`: Whether this item is a container holding multiple items.
223 EnvelopeItemSize,
224
225 /// Number of elements in the envelope buffer across all the stacks.
226 ///
227 /// This metric is tagged with:
228 /// - `storage_type`: The type of storage used in the envelope buffer.
229 BufferEnvelopesCount,
230 /// The amount of bytes in the item payloads of an envelope pushed to the envelope buffer.
231 ///
232 /// This is not quite the same as the actual size of a serialized envelope, because it ignores
233 /// the envelope header and item headers.
234 BufferEnvelopeBodySize,
235 /// Size of a serialized envelope pushed to the envelope buffer.
236 BufferEnvelopeSize,
237 /// Size of a compressed envelope pushed to the envelope buffer.
238 BufferEnvelopeSizeCompressed,
239 /// The number of batches emitted per partition.
240 BatchesPerPartition,
241 /// The number of buckets in a batch emitted.
242 ///
243 /// This corresponds to the number of buckets that will end up in an envelope.
244 BucketsPerBatch,
245 /// The number of spans per processed transaction event.
246 ///
247 /// This metric is tagged with:
248 /// - `platform`: The event's platform, such as `"javascript"`.
249 /// - `sdk`: The name of the Sentry SDK sending the transaction. This tag is only set for
250 /// Sentry's SDKs and defaults to "proprietary".
251 EventSpans,
252 /// Number of projects in the in-memory project cache that are waiting for their state to be
253 /// updated.
254 ///
255 /// See `project_cache.size` for more description of the project cache.
256 ProjectStatePending,
257 /// Number of project states **requested** from the upstream for each batch request.
258 ///
259 /// If multiple batches are updated concurrently, this metric is reported multiple times.
260 ///
261 /// The batch size can be configured with `cache.batch_size`. See `project_cache.size` for more
262 /// description of the project cache.
263 ProjectStateRequestBatchSize,
264 /// Number of project states **returned** from the upstream for each batch request.
265 ///
266 /// If multiple batches are updated concurrently, this metric is reported multiple times.
267 ///
268 /// See `project_cache.size` for more description of the project cache.
269 ProjectStateReceived,
270 /// Number of attempts required to fetch the config for a given project key.
271 ProjectStateAttempts,
272 /// Number of project states currently held in the in-memory project cache.
273 ///
274 /// The cache duration for project states can be configured with the following options:
275 ///
276 /// - `cache.project_expiry`: The time after which a project state counts as expired. It is
277 /// automatically refreshed if a request references the project after it has expired.
278 /// - `cache.project_grace_period`: The time after expiry at which the project state will still
279 /// be used to ingest events. Once the grace period expires, the cache is evicted and new
280 /// requests wait for an update.
281 ///
282 /// There is no limit to the number of cached projects.
283 ProjectStateCacheSize,
284 /// The size of the compressed project config in the redis cache, in bytes.
285 #[cfg(feature = "processing")]
286 ProjectStateSizeBytesCompressed,
287 /// The size of the uncompressed project config in the redis cache, in bytes.
288 #[cfg(feature = "processing")]
289 ProjectStateSizeBytesDecompressed,
290 /// The number of upstream requests queued up for sending.
291 ///
292 /// Relay employs connection keep-alive whenever possible. Connections are kept open for _15_
293 /// seconds of inactivity or _75_ seconds of activity. If all connections are busy, they are
294 /// queued, which is reflected in this metric.
295 ///
296 /// This metric is tagged with:
297 /// - `priority`: The queueing priority of the request, either `"high"` or `"low"`. The
298 /// priority determines precedence in executing requests.
299 ///
300 /// The number of concurrent connections can be configured with:
301 /// - `limits.max_concurrent_requests` for the overall number of connections
302 /// - `limits.max_concurrent_queries` for the number of concurrent high-priority requests
303 UpstreamMessageQueueSize,
304 /// Counts the number of retries for each upstream http request.
305 ///
306 /// This metric is tagged with:
307 ///
308 /// - `result`: What happened to the request, an enumeration with the following values:
309 /// * `success`: The request was sent and returned a success code `HTTP 2xx`
310 /// * `response_error`: The request was sent and it returned an HTTP error.
311 /// * `payload_failed`: The request was sent but there was an error in interpreting the response.
312 /// * `send_failed`: Failed to send the request due to a network error.
313 /// * `rate_limited`: The request was rate limited.
314 /// * `invalid_json`: The response could not be parsed back into JSON.
315 /// - `route`: The endpoint that was called on the upstream.
316 /// - `status-code`: The status code of the request when available, otherwise "-".
317 UpstreamRetries,
318 /// Size of envelopes sent over HTTP in bytes.
319 UpstreamQueryBodySize,
320 /// Size of queries (projectconfig queries, i.e. the request payload, not the response) sent by
321 /// Relay over HTTP in bytes.
322 UpstreamEnvelopeBodySize,
323 /// Size of batched global metrics requests sent by Relay over HTTP in bytes.
324 UpstreamMetricsBodySize,
325 /// Distribution of flush buckets over partition keys.
326 ///
327 /// The distribution of buckets should be even.
328 /// If it is not, this metric should expose it.
329 PartitionKeys,
330 /// Measures how many splits were performed when sending out a partition.
331 PartitionSplits,
332}
333
334impl HistogramMetric for RelayHistograms {
335 fn name(&self) -> &'static str {
336 match self {
337 RelayHistograms::EnvelopeItemSize => "event.item_size",
338 RelayHistograms::EventSpans => "event.spans",
339 RelayHistograms::BatchesPerPartition => "metrics.buckets.batches_per_partition",
340 RelayHistograms::BucketsPerBatch => "metrics.buckets.per_batch",
341 RelayHistograms::BufferEnvelopesCount => "buffer.envelopes_count",
342 RelayHistograms::BufferEnvelopeBodySize => "buffer.envelope_body_size",
343 RelayHistograms::BufferEnvelopeSize => "buffer.envelope_size",
344 RelayHistograms::BufferEnvelopeSizeCompressed => "buffer.envelope_size.compressed",
345 RelayHistograms::ProjectStatePending => "project_state.pending",
346 RelayHistograms::ProjectStateAttempts => "project_state.attempts",
347 RelayHistograms::ProjectStateRequestBatchSize => "project_state.request.batch_size",
348 RelayHistograms::ProjectStateReceived => "project_state.received",
349 RelayHistograms::ProjectStateCacheSize => "project_cache.size",
350 #[cfg(feature = "processing")]
351 RelayHistograms::ProjectStateSizeBytesCompressed => {
352 "project_state.size_bytes.compressed"
353 }
354 #[cfg(feature = "processing")]
355 RelayHistograms::ProjectStateSizeBytesDecompressed => {
356 "project_state.size_bytes.decompressed"
357 }
358 RelayHistograms::UpstreamMessageQueueSize => "http_queue.size",
359 RelayHistograms::UpstreamRetries => "upstream.retries",
360 RelayHistograms::UpstreamQueryBodySize => "upstream.query.body_size",
361 RelayHistograms::UpstreamEnvelopeBodySize => "upstream.envelope.body_size",
362 RelayHistograms::UpstreamMetricsBodySize => "upstream.metrics.body_size",
363 RelayHistograms::PartitionKeys => "metrics.buckets.partition_keys",
364 RelayHistograms::PartitionSplits => "partition_splits",
365 }
366 }
367}
368
369/// Timer metrics used by Relay
370pub enum RelayTimers {
371 /// Time in milliseconds spent deserializing an event from JSON bytes into the native data
372 /// structure on which Relay operates.
373 EventProcessingDeserialize,
374 /// Time in milliseconds spent running normalization on an event. Normalization
375 /// happens before envelope filtering and metric extraction.
376 EventProcessingNormalization,
377 /// Time in milliseconds spent running inbound data filters on an event.
378 EventProcessingFiltering,
379 /// Time in milliseconds spent checking for organization, project, and DSN rate limits.
380 ///
381 /// Not all events reach this point. After an event is rate limited for the first time, the rate
382 /// limit is cached. Events coming in after this will be discarded earlier in the request queue
383 /// and do not reach the processing queue.
384 EventProcessingRateLimiting,
385 /// Time in milliseconds spent in data scrubbing for the current event. Data scrubbing happens
386 /// last before serializing the event back to JSON.
387 EventProcessingPii,
388 /// Time spent converting the event from its in-memory reprsentation into a JSON string.
389 EventProcessingSerialization,
390 /// Time used to extract span metrics from an event.
391 EventProcessingSpanMetricsExtraction,
392 /// Time spent between the start of request handling and processing of the envelope.
393 ///
394 /// This includes streaming the request body, scheduling overheads, project config fetching,
395 /// batched requests and congestions in the internal processor. This does not include delays in
396 /// the incoming request (body upload) and skips all envelopes that are fast-rejected.
397 EnvelopeWaitTime,
398 /// Time in milliseconds spent in synchronous processing of envelopes.
399 ///
400 /// This timing covers the end-to-end processing in the CPU pool and comprises:
401 ///
402 /// - `event_processing.deserialize`
403 /// - `event_processing.pii`
404 /// - `event_processing.serialization`
405 ///
406 /// With Relay in processing mode, this also includes the following timings:
407 ///
408 /// - `event_processing.process`
409 /// - `event_processing.filtering`
410 /// - `event_processing.rate_limiting`
411 EnvelopeProcessingTime,
412 /// Total time in milliseconds an envelope spends in Relay from the time it is received until it
413 /// finishes processing and has been submitted to the upstream.
414 EnvelopeTotalTime,
415 /// Latency of project config updates until they reach Relay.
416 ///
417 /// The metric is calculated by using the creation timestamp of the project config
418 /// and when Relay updates its local cache with the new project config.
419 ///
420 /// No metric is emitted when Relay fetches a project config for the first time.
421 ///
422 /// This metric is tagged with:
423 /// - `delay`: Bucketed amount of seconds passed between fetches.
424 ProjectCacheUpdateLatency,
425 /// Total time spent from starting to fetch a project config update to completing the fetch.
426 ProjectCacheFetchDuration,
427 /// Total time in milliseconds spent fetching queued project configuration updates requests to
428 /// resolve.
429 ///
430 /// Relay updates projects in batches. Every update cycle, Relay requests
431 /// `limits.max_concurrent_queries * cache.batch_size` projects from the upstream. This metric
432 /// measures the wall clock time for all concurrent requests in this loop.
433 ///
434 /// Note that after an update loop has completed, there may be more projects pending updates.
435 /// This is indicated by `project_state.pending`.
436 ProjectStateRequestDuration,
437 /// Time in milliseconds required to decompress a project config from redis.
438 ///
439 /// Note that this also times the cases where project config is uncompressed,
440 /// in which case the timer should be very close to zero.
441 #[cfg(feature = "processing")]
442 ProjectStateDecompression,
443 /// Total duration in milliseconds for handling inbound web requests until the HTTP response is
444 /// returned to the client.
445 ///
446 /// This does **not** correspond to the full event ingestion time. Requests for events that are
447 /// not immediately rejected due to bad data or cached rate limits always return `200 OK`. Full
448 /// validation and normalization occur asynchronously, which is reported by
449 /// `event.processing_time`.
450 ///
451 /// This metric is tagged with:
452 /// - `method`: The HTTP method of the request.
453 /// - `route`: Unique dashed identifier of the endpoint.
454 RequestsDuration,
455 /// Time spent on minidump scrubbing.
456 ///
457 /// This is the total time spent on parsing and scrubbing the minidump. Even if no PII
458 /// scrubbing rules applied the minidump will still be parsed and the rules evaluated on
459 /// the parsed minidump, this duration is reported here with status of "n/a".
460 ///
461 /// This metric is tagged with:
462 ///
463 /// - `status`: Scrubbing status: "ok" means successful scrubbed, "error" means there
464 /// was an error during scrubbing and finally "n/a" means scrubbing was successful
465 /// but no scurbbing rules applied.
466 MinidumpScrubbing,
467 /// Time spent on view hierarchy scrubbing.
468 ///
469 /// This is the total time spent on parsing and scrubbing the view hierarchy json file.
470 ///
471 /// This metric is tagged with:
472 ///
473 /// - `status`: "ok" means successful scrubbed, "error" means there was an error during
474 /// scrubbing
475 ViewHierarchyScrubbing,
476 /// Time spend on attachment scrubbing.
477 ///
478 /// This represents the total time spent on evaluating the scrubbing rules for an
479 /// attachment and the attachment scrubbing itself, regardless of whether any rules were
480 /// applied. Note that minidumps which failed to be parsed (status="error" in
481 /// scrubbing.minidumps.duration) will be scrubbed as plain attachments and count
482 /// towards this.
483 ///
484 /// This metric is tagged with:
485 ///
486 /// - `attachment_type`: The type of attachment, e.g. "minidump".
487 AttachmentScrubbing,
488 /// Total time spent to send request to upstream Relay and handle the response.
489 ///
490 /// This metric is tagged with:
491 ///
492 /// - `result`: What happened to the request, an enumeration with the following values:
493 /// * `success`: The request was sent and returned a success code `HTTP 2xx`
494 /// * `response_error`: The request was sent and it returned an HTTP error.
495 /// * `payload_failed`: The request was sent but there was an error in interpreting the response.
496 /// * `send_failed`: Failed to send the request due to a network error.
497 /// * `rate_limited`: The request was rate limited.
498 /// * `invalid_json`: The response could not be parsed back into JSON.
499 /// - `route`: The endpoint that was called on the upstream.
500 /// - `status-code`: The status code of the request when available, otherwise "-".
501 /// - `retries`: Number of retries bucket 0, 1, 2, few (3 - 10), many (more than 10).
502 UpstreamRequestsDuration,
503 /// The delay between the timestamp stated in a payload and the receive time.
504 ///
505 /// SDKs cannot transmit payloads immediately in all cases. Sometimes, crashes require that
506 /// events are sent after restarting the application. Similarly, SDKs buffer events during
507 /// network downtimes for later transmission. This metric measures the delay between the time of
508 /// the event and the time it arrives in Relay. The delay is measured after clock drift
509 /// correction is applied.
510 ///
511 /// Only payloads with a delay of more than 1 minute are captured.
512 ///
513 /// This metric is tagged with:
514 ///
515 /// - `category`: The data category of the payload. Can be one of: `event`, `transaction`,
516 /// `security`, or `session`.
517 TimestampDelay,
518 /// The time it takes the outcome aggregator to flush aggregated outcomes.
519 OutcomeAggregatorFlushTime,
520 /// Time in milliseconds spent on parsing, normalizing and scrubbing replay recordings.
521 ReplayRecordingProcessing,
522 /// Total time spent to send a request and receive the response from upstream.
523 GlobalConfigRequestDuration,
524 /// Timing in milliseconds for processing a message in the internal CPU pool.
525 ///
526 /// This metric is tagged with:
527 ///
528 /// - `message`: The type of message that was processed.
529 ProcessMessageDuration,
530 /// Timing in milliseconds for processing a task in the project cache service.
531 ///
532 /// This metric is tagged with:
533 /// - `task`: The type of the task the project cache does.
534 ProjectCacheTaskDuration,
535 /// Timing in milliseconds for handling and responding to a health check request.
536 ///
537 /// This metric is tagged with:
538 /// - `type`: The type of the health check, `liveness` or `readiness`.
539 HealthCheckDuration,
540 /// Temporary timing metric for how much time was spent evaluating span and transaction
541 /// rate limits using the `RateLimitBuckets` message in the processor.
542 ///
543 /// This metric is tagged with:
544 /// - `category`: The data category evaluated.
545 /// - `limited`: Whether the batch is rate limited.
546 /// - `count`: How many items matching the data category are contained in the batch.
547 #[cfg(feature = "processing")]
548 RateLimitBucketsDuration,
549 /// Timing in milliseconds for processing a task in the aggregator service.
550 ///
551 /// This metric is tagged with:
552 /// - `task`: The task being executed by the aggregator.
553 /// - `aggregator`: The name of the aggregator.
554 AggregatorServiceDuration,
555 /// Timing in milliseconds for processing a message in the metric router service.
556 ///
557 /// This metric is tagged with:
558 /// - `message`: The type of message that was processed.
559 MetricRouterServiceDuration,
560 /// Timing in milliseconds for processing a message in the metric store service.
561 ///
562 /// This metric is tagged with:
563 /// - `message`: The type of message that was processed.
564 #[cfg(feature = "processing")]
565 StoreServiceDuration,
566 /// Timing in milliseconds for the time it takes for initialize the buffer.
567 BufferInitialization,
568 /// Timing in milliseconds for the time it takes for the buffer to pack & spool a batch.
569 ///
570 /// Contains the time it takes to pack multiple envelopes into a single memory blob.
571 BufferSpool,
572 /// Timing in milliseconds for the time it takes for the buffer to spool data to SQLite.
573 BufferSqlWrite,
574 /// Timing in milliseconds for the time it takes for the buffer to unspool data from disk.
575 BufferUnspool,
576 /// Timing in milliseconds for the time it takes for the buffer to push.
577 BufferPush,
578 /// Timing in milliseconds for the time it takes for the buffer to peek.
579 BufferPeek,
580 /// Timing in milliseconds for the time it takes for the buffer to pop.
581 BufferPop,
582 /// Timing in milliseconds for the time it takes for the buffer to drain its envelopes.
583 BufferDrain,
584 /// Timing in milliseconds for the time it takes for an envelope to be serialized.
585 BufferEnvelopesSerialization,
586 /// Timing in milliseconds for the time it takes for an envelope to be compressed.
587 BufferEnvelopeCompression,
588 /// Timing in milliseconds for the time it takes for an envelope to be decompressed.
589 BufferEnvelopeDecompression,
590 /// Timing in milliseconds to the time it takes to read an HTTP body.
591 BodyReadDuration,
592 /// Timing in milliseconds to count spans in a serialized transaction payload.
593 CheckNestedSpans,
594 /// The time in milliseconds it takes to expand a Span V2 container into Spans V1.
595 SpanV2Expansion,
596}
597
598impl TimerMetric for RelayTimers {
599 fn name(&self) -> &'static str {
600 match self {
601 RelayTimers::EventProcessingDeserialize => "event_processing.deserialize",
602 RelayTimers::EventProcessingNormalization => "event_processing.normalization",
603 RelayTimers::EventProcessingFiltering => "event_processing.filtering",
604 RelayTimers::EventProcessingRateLimiting => "event_processing.rate_limiting",
605 RelayTimers::EventProcessingPii => "event_processing.pii",
606 RelayTimers::EventProcessingSpanMetricsExtraction => {
607 "event_processing.span_metrics_extraction"
608 }
609 RelayTimers::EventProcessingSerialization => "event_processing.serialization",
610 RelayTimers::EnvelopeWaitTime => "event.wait_time",
611 RelayTimers::EnvelopeProcessingTime => "event.processing_time",
612 RelayTimers::EnvelopeTotalTime => "event.total_time",
613 RelayTimers::ProjectStateRequestDuration => "project_state.request.duration",
614 #[cfg(feature = "processing")]
615 RelayTimers::ProjectStateDecompression => "project_state.decompression",
616 RelayTimers::ProjectCacheUpdateLatency => "project_cache.latency",
617 RelayTimers::ProjectCacheFetchDuration => "project_cache.fetch.duration",
618 RelayTimers::RequestsDuration => "requests.duration",
619 RelayTimers::MinidumpScrubbing => "scrubbing.minidumps.duration",
620 RelayTimers::ViewHierarchyScrubbing => "scrubbing.view_hierarchy_scrubbing.duration",
621 RelayTimers::AttachmentScrubbing => "scrubbing.attachments.duration",
622 RelayTimers::UpstreamRequestsDuration => "upstream.requests.duration",
623 RelayTimers::TimestampDelay => "requests.timestamp_delay",
624 RelayTimers::OutcomeAggregatorFlushTime => "outcomes.aggregator.flush_time",
625 RelayTimers::ReplayRecordingProcessing => "replay.recording.process",
626 RelayTimers::GlobalConfigRequestDuration => "global_config.requests.duration",
627 RelayTimers::ProcessMessageDuration => "processor.message.duration",
628 RelayTimers::ProjectCacheTaskDuration => "project_cache.task.duration",
629 RelayTimers::HealthCheckDuration => "health.message.duration",
630 #[cfg(feature = "processing")]
631 RelayTimers::RateLimitBucketsDuration => "processor.rate_limit_buckets",
632 RelayTimers::AggregatorServiceDuration => "metrics.aggregator.message.duration",
633 RelayTimers::MetricRouterServiceDuration => "metrics.router.message.duration",
634 #[cfg(feature = "processing")]
635 RelayTimers::StoreServiceDuration => "store.message.duration",
636 RelayTimers::BufferInitialization => "buffer.initialization.duration",
637 RelayTimers::BufferSpool => "buffer.spool.duration",
638 RelayTimers::BufferSqlWrite => "buffer.write.duration",
639 RelayTimers::BufferUnspool => "buffer.unspool.duration",
640 RelayTimers::BufferPush => "buffer.push.duration",
641 RelayTimers::BufferPeek => "buffer.peek.duration",
642 RelayTimers::BufferPop => "buffer.pop.duration",
643 RelayTimers::BufferDrain => "buffer.drain.duration",
644 RelayTimers::BufferEnvelopesSerialization => "buffer.envelopes_serialization",
645 RelayTimers::BufferEnvelopeCompression => "buffer.envelopes_compression",
646 RelayTimers::BufferEnvelopeDecompression => "buffer.envelopes_decompression",
647 RelayTimers::BodyReadDuration => "requests.body_read.duration",
648 RelayTimers::CheckNestedSpans => "envelope.check_nested_spans",
649 RelayTimers::SpanV2Expansion => "envelope.span_v2_expansion",
650 }
651 }
652}
653
654/// Counter metrics used by Relay
655pub enum RelayCounters {
656 /// Tracks the number of tasks driven to completion by the async pool.
657 ///
658 /// This metric is tagged with:
659 /// - `pool`: the name of the pool.
660 AsyncPoolFinishedTasks,
661 /// Number of Events that had corrupted (unprintable) event attributes.
662 ///
663 /// This currently checks for `environment` and `release`, for which we know that
664 /// some SDKs may send corrupted values.
665 EventCorrupted,
666 /// Number of envelopes accepted in the current time slot.
667 ///
668 /// This represents requests that have successfully passed rate limits and filters, and have
669 /// been sent to the upstream.
670 ///
671 /// This metric is tagged with:
672 /// - `handling`: Either `"success"` if the envelope was handled correctly, or `"failure"` if
673 /// there was an error or bug.
674 EnvelopeAccepted,
675 /// Number of envelopes rejected in the current time slot.
676 ///
677 /// This includes envelopes being rejected because they are malformed or any other errors during
678 /// processing (including filtered events, invalid payloads, and rate limits).
679 ///
680 /// To check the rejection reason, check `events.outcomes`, instead.
681 ///
682 /// This metric is tagged with:
683 /// - `handling`: Either `"success"` if the envelope was handled correctly, or `"failure"` if
684 /// there was an error or bug.
685 EnvelopeRejected,
686 /// Number of total envelope items we received.
687 ///
688 /// Note: This does not count raw items, it counts the logical amount of items,
689 /// e.g. a single item container counts all its contained items.
690 ///
691 /// This metric is tagged with:
692 /// - `item_type`: The type of the items being counted.
693 /// - `is_container`: Whether this item is a container holding multiple items.
694 /// - `sdk`: The name of the Sentry SDK sending the envelope. This tag is only set for
695 /// Sentry's SDKs and defaults to "proprietary".
696 EnvelopeItems,
697 /// Number of bytes we processed per envelope item.
698 ///
699 /// This metric is tagged with:
700 /// - `item_type`: The type of the items being counted.
701 /// - `is_container`: Whether this item is a container holding multiple items.
702 /// - `sdk`: The name of the Sentry SDK sending the envelope. This tag is only set for
703 /// Sentry's SDKs and defaults to "proprietary".
704 EnvelopeItemBytes,
705 /// Number of times an envelope from the buffer is trying to be popped.
706 BufferTryPop,
707 /// Number of envelopes spool to disk.
708 BufferSpooledEnvelopes,
709 /// Number of envelopes unspooled from disk.
710 BufferUnspooledEnvelopes,
711 /// Number of project changed updates received by the buffer.
712 BufferProjectChangedEvent,
713 /// Number of times one or more projects of an envelope were pending when trying to pop
714 /// their envelope.
715 BufferProjectPending,
716 /// Number of outcomes and reasons for rejected Envelopes.
717 ///
718 /// This metric is tagged with:
719 /// - `outcome`: The basic cause for rejecting the event.
720 /// - `reason`: A more detailed identifier describing the rule or mechanism leading to the
721 /// outcome.
722 /// - `to`: Describes the destination of the outcome. Can be either 'kafka' (when in
723 /// processing mode) or 'http' (when outcomes are enabled in an external relay).
724 ///
725 /// Possible outcomes are:
726 /// - `filtered`: Dropped by inbound data filters. The reason specifies the filter that
727 /// matched.
728 /// - `rate_limited`: Dropped by organization, project, or DSN rate limit, as well as exceeding
729 /// the Sentry plan quota. The reason contains the rate limit or quota that was exceeded.
730 /// - `invalid`: Data was considered invalid and could not be recovered. The reason indicates
731 /// the validation that failed.
732 Outcomes,
733 /// The number of individual outcomes including their quantity.
734 ///
735 /// While [`RelayCounters::Outcomes`] tracks the number of times aggregated outcomes
736 /// have been emitted, this counter tracks the total quantity of individual outcomes.
737 OutcomeQuantity,
738 /// Number of project state HTTP requests.
739 ///
740 /// Relay updates projects in batches. Every update cycle, Relay requests
741 /// `limits.max_concurrent_queries` batches of `cache.batch_size` projects from the upstream.
742 /// The duration of these requests is reported via `project_state.request.duration`.
743 ///
744 /// Note that after an update loop has completed, there may be more projects pending updates.
745 /// This is indicated by `project_state.pending`.
746 ProjectStateRequest,
747 /// Number of times a project state is requested from the central Redis cache.
748 ///
749 /// This metric is tagged with:
750 /// - `hit`: One of:
751 /// - `revision`: the cached version was validated to be up to date using its revision.
752 /// - `project_config`: the request was handled by the cache.
753 /// - `project_config_revision`: the request was handled by the cache and the revision did
754 /// not change.
755 /// - `false`: the request will be sent to the sentry endpoint.
756 #[cfg(feature = "processing")]
757 ProjectStateRedis,
758 /// Number of times a project had a fetch scheduled.
759 ProjectCacheSchedule,
760 /// Number of times an upstream request for a project config is completed.
761 ///
762 /// Completion can be because a result was returned or because the config request was
763 /// dropped after there still was no response after a timeout. This metrics has tags
764 /// for `result` and `attempts` indicating whether it was succesful or a timeout and how
765 /// many attempts were made respectively.
766 ProjectUpstreamCompleted,
767 /// Number of times an upstream request for a project config failed.
768 ///
769 /// Failure can happen, for example, when there's a network error. Refer to
770 /// [`UpstreamRequestError`](crate::services::upstream::UpstreamRequestError) for all cases.
771 ProjectUpstreamFailed,
772 /// Number of Relay server starts.
773 ///
774 /// This can be used to track unwanted restarts due to crashes or termination.
775 ServerStarting,
776 /// Number of messages placed on the Kafka queues.
777 ///
778 /// When Relay operates as Sentry service and an Envelope item is successfully processed, each
779 /// Envelope item results in a dedicated message on one of the ingestion topics on Kafka.
780 ///
781 /// This metric is tagged with:
782 /// - `event_type`: The kind of message produced to Kafka.
783 /// - `namespace` (only for metrics): The namespace that the metric belongs to.
784 /// - `is_segment` (only for event_type span): `true` the span is the root of a segment.
785 /// - `has_parent` (only for event_type span): `false` if the span is the root of a trace.
786 /// - `platform` (only for event_type span): The platform from which the span was spent.
787 /// - `metric_type` (only for event_type metric): The metric type, counter, distribution,
788 /// gauge or set.
789 /// - `metric_encoding` (only for event_type metric): The encoding used for distribution and
790 /// set metrics.
791 ///
792 /// The message types can be:
793 ///
794 /// - `event`: An error or transaction event. Error events are sent to `ingest-events`,
795 /// transactions to `ingest-transactions`, and errors with attachments are sent to
796 /// `ingest-attachments`.
797 /// - `attachment`: An attachment file associated with an error event, sent to
798 /// `ingest-attachments`.
799 /// - `user_report`: A message from the user feedback dialog, sent to `ingest-events`.
800 /// - `session`: A release health session update, sent to `ingest-sessions`.
801 #[cfg(feature = "processing")]
802 ProcessingMessageProduced,
803 /// Number of events that hit any of the store-like endpoints: Envelope, Store, Security,
804 /// Minidump, Unreal.
805 ///
806 /// The events are counted before they are rate limited, filtered, or processed in any way.
807 ///
808 /// This metric is tagged with:
809 /// - `version`: The event protocol version number defaulting to `7`.
810 EventProtocol,
811 /// The number of transaction events processed by the source of the transaction name.
812 ///
813 /// This metric is tagged with:
814 /// - `platform`: The event's platform, such as `"javascript"`.
815 /// - `source`: The source of the transaction name on the client. See the [transaction source
816 /// documentation](https://develop.sentry.dev/sdk/event-payloads/properties/transaction_info/)
817 /// for all valid values.
818 /// - `contains_slashes`: Whether the transaction name contains `/`. We use this as a heuristic
819 /// to represent URL transactions.
820 EventTransaction,
821 /// The number of transaction events processed grouped by transaction name modifications.
822 /// This metric is tagged with:
823 /// - `source_in`: The source of the transaction name before normalization.
824 /// See the [transaction source
825 /// documentation](https://develop.sentry.dev/sdk/event-payloads/properties/transaction_info/)
826 /// for all valid values.
827 /// - `change`: The mechanism that changed the transaction name.
828 /// Either `"none"`, `"pattern"`, `"rule"`, or `"both"`.
829 /// - `source_out`: The source of the transaction name after normalization.
830 TransactionNameChanges,
831 /// Number of HTTP requests reaching Relay.
832 Requests,
833 /// Number of completed HTTP requests.
834 ///
835 /// This metric is tagged with:
836 ///
837 /// - `status_code`: The HTTP status code number.
838 /// - `method`: The HTTP method used in the request in uppercase.
839 /// - `route`: Unique dashed identifier of the endpoint.
840 ResponsesStatusCodes,
841 /// Number of evicted stale projects from the cache.
842 ///
843 /// Relay scans the in-memory project cache for stale entries in a regular interval configured
844 /// by `cache.eviction_interval`.
845 ///
846 /// The cache duration for project states can be configured with the following options:
847 ///
848 /// - `cache.project_expiry`: The time after which a project state counts as expired. It is
849 /// automatically refreshed if a request references the project after it has expired.
850 /// - `cache.project_grace_period`: The time after expiry at which the project state will still
851 /// be used to ingest events. Once the grace period expires, the cache is evicted and new
852 /// requests wait for an update.
853 EvictingStaleProjectCaches,
854 /// Number of refreshes for stale projects in the cache.
855 RefreshStaleProjectCaches,
856 /// Number of times that parsing a metrics bucket item from an envelope failed.
857 MetricBucketsParsingFailed,
858 /// Count extraction of transaction names. Tag with the decision to drop / replace / use original.
859 MetricsTransactionNameExtracted,
860 /// Number of Events with an OpenTelemetry Context
861 ///
862 /// This metric is tagged with:
863 /// - `platform`: The event's platform, such as `"javascript"`.
864 /// - `sdk`: The name of the Sentry SDK sending the transaction. This tag is only set for
865 /// Sentry's SDKs and defaults to "proprietary".
866 OpenTelemetryEvent,
867 /// Number of global config fetches from upstream. Only 2XX responses are
868 /// considered and ignores send errors (e.g. auth or network errors).
869 ///
870 /// This metric is tagged with:
871 /// - `success`: whether deserializing the global config succeeded.
872 GlobalConfigFetched,
873 /// The number of attachments processed in the same envelope as a user_report_v2 event.
874 FeedbackAttachments,
875 /// All COGS tracked values.
876 ///
877 /// This metric is tagged with:
878 /// - `resource_id`: The COGS resource id.
879 /// - `app_feature`: The COGS app feature.
880 CogsUsage,
881 /// The amount of times metrics of a project have been flushed without the project being
882 /// fetched/available.
883 ProjectStateFlushMetricsNoProject,
884 /// Incremented every time a bucket is dropped.
885 ///
886 /// This should only happen when a project state is invalid during graceful shutdown.
887 ///
888 /// This metric is tagged with:
889 /// - `aggregator`: The name of the metrics aggregator (usually `"default"`).
890 BucketsDropped,
891 /// Incremented every time a segment exceeds the expected limit.
892 ReplayExceededSegmentLimit,
893 /// Incremented every time the server accepts a new connection.
894 ServerSocketAccept,
895 /// Incremented every time the server aborts a connection because of an idle timeout.
896 ServerConnectionIdleTimeout,
897 /// The total delay of metric buckets in seconds.
898 ///
899 /// The delay is measured from initial creation of the bucket in an internal Relay
900 /// until it is produced to Kafka.
901 ///
902 /// Use [`Self::MetricDelayCount`] to calculate the average delay.
903 ///
904 /// This metric is tagged with:
905 /// - `namespace`: the metric namespace.
906 #[cfg(feature = "processing")]
907 MetricDelaySum,
908 /// The amount of buckets counted for the [`Self::MetricDelaySum`] metric.
909 ///
910 /// This metric is tagged with:
911 /// - `namespace`: the metric namespace.
912 #[cfg(feature = "processing")]
913 MetricDelayCount,
914 /// The amount of times PlayStation processing was attempted.
915 #[cfg(all(sentry, feature = "processing"))]
916 PlaystationProcessing,
917}
918
919impl CounterMetric for RelayCounters {
920 fn name(&self) -> &'static str {
921 match self {
922 RelayCounters::AsyncPoolFinishedTasks => "async_pool.finished_tasks",
923 RelayCounters::EventCorrupted => "event.corrupted",
924 RelayCounters::EnvelopeAccepted => "event.accepted",
925 RelayCounters::EnvelopeRejected => "event.rejected",
926 RelayCounters::EnvelopeItems => "event.items",
927 RelayCounters::EnvelopeItemBytes => "event.item_bytes",
928 RelayCounters::BufferTryPop => "buffer.try_pop",
929 RelayCounters::BufferSpooledEnvelopes => "buffer.spooled_envelopes",
930 RelayCounters::BufferUnspooledEnvelopes => "buffer.unspooled_envelopes",
931 RelayCounters::BufferProjectChangedEvent => "buffer.project_changed_event",
932 RelayCounters::BufferProjectPending => "buffer.project_pending",
933 RelayCounters::Outcomes => "events.outcomes",
934 RelayCounters::OutcomeQuantity => "events.outcome_quantity",
935 RelayCounters::ProjectStateRequest => "project_state.request",
936 #[cfg(feature = "processing")]
937 RelayCounters::ProjectStateRedis => "project_state.redis.requests",
938 RelayCounters::ProjectUpstreamCompleted => "project_upstream.completed",
939 RelayCounters::ProjectUpstreamFailed => "project_upstream.failed",
940 RelayCounters::ProjectCacheSchedule => "project_cache.schedule",
941 RelayCounters::ServerStarting => "server.starting",
942 #[cfg(feature = "processing")]
943 RelayCounters::ProcessingMessageProduced => "processing.event.produced",
944 RelayCounters::EventProtocol => "event.protocol",
945 RelayCounters::EventTransaction => "event.transaction",
946 RelayCounters::TransactionNameChanges => "event.transaction_name_changes",
947 RelayCounters::Requests => "requests",
948 RelayCounters::ResponsesStatusCodes => "responses.status_codes",
949 RelayCounters::EvictingStaleProjectCaches => "project_cache.eviction",
950 RelayCounters::RefreshStaleProjectCaches => "project_cache.refresh",
951 RelayCounters::MetricBucketsParsingFailed => "metrics.buckets.parsing_failed",
952 RelayCounters::MetricsTransactionNameExtracted => "metrics.transaction_name",
953 RelayCounters::OpenTelemetryEvent => "event.opentelemetry",
954 RelayCounters::GlobalConfigFetched => "global_config.fetch",
955 RelayCounters::FeedbackAttachments => "processing.feedback_attachments",
956 RelayCounters::CogsUsage => "cogs.usage",
957 RelayCounters::ProjectStateFlushMetricsNoProject => "project_state.metrics.no_project",
958 RelayCounters::BucketsDropped => "metrics.buckets.dropped",
959 RelayCounters::ReplayExceededSegmentLimit => "replay.segment_limit_exceeded",
960 RelayCounters::ServerSocketAccept => "server.http.accepted",
961 RelayCounters::ServerConnectionIdleTimeout => "server.http.idle_timeout",
962 #[cfg(feature = "processing")]
963 RelayCounters::MetricDelaySum => "metrics.delay.sum",
964 #[cfg(feature = "processing")]
965 RelayCounters::MetricDelayCount => "metrics.delay.count",
966 #[cfg(all(sentry, feature = "processing"))]
967 RelayCounters::PlaystationProcessing => "processing.playstation",
968 }
969 }
970}
971
972/// Low-cardinality platform that can be used as a statsd tag.
973pub enum PlatformTag {
974 Cocoa,
975 Csharp,
976 Edge,
977 Go,
978 Java,
979 Javascript,
980 Julia,
981 Native,
982 Node,
983 Objc,
984 Other,
985 Perl,
986 Php,
987 Python,
988 Ruby,
989 Swift,
990}
991
992impl PlatformTag {
993 pub fn name(&self) -> &str {
994 match self {
995 Self::Cocoa => "cocoa",
996 Self::Csharp => "csharp",
997 Self::Edge => "edge",
998 Self::Go => "go",
999 Self::Java => "java",
1000 Self::Javascript => "javascript",
1001 Self::Julia => "julia",
1002 Self::Native => "native",
1003 Self::Node => "node",
1004 Self::Objc => "objc",
1005 Self::Other => "other",
1006 Self::Perl => "perl",
1007 Self::Php => "php",
1008 Self::Python => "python",
1009 Self::Ruby => "ruby",
1010 Self::Swift => "swift",
1011 }
1012 }
1013}
1014
1015impl<S: AsRef<str>> From<S> for PlatformTag {
1016 fn from(value: S) -> Self {
1017 match value.as_ref() {
1018 "cocoa" => Self::Cocoa,
1019 "csharp" => Self::Csharp,
1020 "edge" => Self::Edge,
1021 "go" => Self::Go,
1022 "java" => Self::Java,
1023 "javascript" => Self::Javascript,
1024 "julia" => Self::Julia,
1025 "native" => Self::Native,
1026 "node" => Self::Node,
1027 "objc" => Self::Objc,
1028 "perl" => Self::Perl,
1029 "php" => Self::Php,
1030 "python" => Self::Python,
1031 "ruby" => Self::Ruby,
1032 "swift" => Self::Swift,
1033 _ => Self::Other,
1034 }
1035 }
1036}
1037
1038/// Low-cardinality SDK name that can be used as a statsd tag.
1039pub enum ClientName<'a> {
1040 Ruby,
1041 CocoaFlutter,
1042 CocoaReactNative,
1043 Cocoa,
1044 Dotnet,
1045 AndroidReactNative,
1046 AndroidJava,
1047 SpringBoot,
1048 JavascriptBrowser,
1049 Electron,
1050 NestJs,
1051 NextJs,
1052 Node,
1053 React,
1054 Vue,
1055 Native,
1056 Laravel,
1057 Symfony,
1058 Php,
1059 Python,
1060 Other(&'a str),
1061}
1062
1063impl ClientName<'_> {
1064 pub fn name(&self) -> &'static str {
1065 match self {
1066 Self::Ruby => "sentry-ruby",
1067 Self::CocoaFlutter => "sentry.cocoa.flutter",
1068 Self::CocoaReactNative => "sentry.cocoa.react-native",
1069 Self::Cocoa => "sentry.cocoa",
1070 Self::Dotnet => "sentry.dotnet",
1071 Self::AndroidReactNative => "sentry.java.android.react-native",
1072 Self::AndroidJava => "sentry.java.android",
1073 Self::SpringBoot => "sentry.java.spring-boot.jakarta",
1074 Self::JavascriptBrowser => "sentry.javascript.browser",
1075 Self::Electron => "sentry.javascript.electron",
1076 Self::NestJs => "sentry.javascript.nestjs",
1077 Self::NextJs => "sentry.javascript.nextjs",
1078 Self::Node => "sentry.javascript.node",
1079 Self::React => "sentry.javascript.react",
1080 Self::Vue => "sentry.javascript.vue",
1081 Self::Native => "sentry.native",
1082 Self::Laravel => "sentry.php.laravel",
1083 Self::Symfony => "sentry.php.symfony",
1084 Self::Php => "sentry.php",
1085 Self::Python => "sentry.python",
1086 Self::Other(_) => "other",
1087 }
1088 }
1089}
1090
1091impl<'a> From<&'a str> for ClientName<'a> {
1092 fn from(value: &'a str) -> Self {
1093 match value {
1094 "sentry-ruby" => Self::Ruby,
1095 "sentry.cocoa.flutter" => Self::CocoaFlutter,
1096 "sentry.cocoa.react-native" => Self::CocoaReactNative,
1097 "sentry.cocoa" => Self::Cocoa,
1098 "sentry.dotnet" => Self::Dotnet,
1099 "sentry.java.android.react-native" => Self::AndroidReactNative,
1100 "sentry.java.android" => Self::AndroidJava,
1101 "sentry.java.spring-boot.jakarta" => Self::SpringBoot,
1102 "sentry.javascript.browser" => Self::JavascriptBrowser,
1103 "sentry.javascript.electron" => Self::Electron,
1104 "sentry.javascript.nestjs" => Self::NestJs,
1105 "sentry.javascript.nextjs" => Self::NextJs,
1106 "sentry.javascript.node" => Self::Node,
1107 "sentry.javascript.react" => Self::React,
1108 "sentry.javascript.vue" => Self::Vue,
1109 "sentry.native" => Self::Native,
1110 "sentry.php.laravel" => Self::Laravel,
1111 "sentry.php.symfony" => Self::Symfony,
1112 "sentry.php" => Self::Php,
1113 "sentry.python" => Self::Python,
1114 other => Self::Other(other),
1115 }
1116 }
1117}