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    /// Number of project state HTTP requests.
734    ///
735    /// Relay updates projects in batches. Every update cycle, Relay requests
736    /// `limits.max_concurrent_queries` batches of `cache.batch_size` projects from the upstream.
737    /// The duration of these requests is reported via `project_state.request.duration`.
738    ///
739    /// Note that after an update loop has completed, there may be more projects pending updates.
740    /// This is indicated by `project_state.pending`.
741    ProjectStateRequest,
742    /// Number of times a project state is requested from the central Redis cache.
743    ///
744    /// This metric is tagged with:
745    ///  - `hit`: One of:
746    ///     - `revision`: the cached version was validated to be up to date using its revision.
747    ///     - `project_config`: the request was handled by the cache.
748    ///     - `project_config_revision`: the request was handled by the cache and the revision did
749    ///       not change.
750    ///     - `false`: the request will be sent to the sentry endpoint.
751    #[cfg(feature = "processing")]
752    ProjectStateRedis,
753    /// Number of times a project had a fetch scheduled.
754    ProjectCacheSchedule,
755    /// Number of times an upstream request for a project config is completed.
756    ///
757    /// Completion can be because a result was returned or because the config request was
758    /// dropped after there still was no response after a timeout.  This metrics has tags
759    /// for `result` and `attempts` indicating whether it was succesful or a timeout and how
760    /// many attempts were made respectively.
761    ProjectUpstreamCompleted,
762    /// Number of times an upstream request for a project config failed.
763    ///
764    /// Failure can happen, for example, when there's a network error. Refer to
765    /// [`UpstreamRequestError`](crate::services::upstream::UpstreamRequestError) for all cases.
766    ProjectUpstreamFailed,
767    /// Number of Relay server starts.
768    ///
769    /// This can be used to track unwanted restarts due to crashes or termination.
770    ServerStarting,
771    /// Number of messages placed on the Kafka queues.
772    ///
773    /// When Relay operates as Sentry service and an Envelope item is successfully processed, each
774    /// Envelope item results in a dedicated message on one of the ingestion topics on Kafka.
775    ///
776    /// This metric is tagged with:
777    ///  - `event_type`: The kind of message produced to Kafka.
778    ///  - `namespace` (only for metrics): The namespace that the metric belongs to.
779    ///  - `is_segment` (only for event_type span): `true` the span is the root of a segment.
780    ///  - `has_parent` (only for event_type span): `false` if the span is the root of a trace.
781    ///  - `platform` (only for event_type span): The platform from which the span was spent.
782    ///  - `metric_type` (only for event_type metric): The metric type, counter, distribution,
783    ///    gauge or set.
784    ///  - `metric_encoding` (only for event_type metric): The encoding used for distribution and
785    ///    set metrics.
786    ///
787    /// The message types can be:
788    ///
789    ///  - `event`: An error or transaction event. Error events are sent to `ingest-events`,
790    ///    transactions to `ingest-transactions`, and errors with attachments are sent to
791    ///    `ingest-attachments`.
792    ///  - `attachment`: An attachment file associated with an error event, sent to
793    ///    `ingest-attachments`.
794    ///  - `user_report`: A message from the user feedback dialog, sent to `ingest-events`.
795    ///  - `session`: A release health session update, sent to `ingest-sessions`.
796    #[cfg(feature = "processing")]
797    ProcessingMessageProduced,
798    /// Number of events that hit any of the store-like endpoints: Envelope, Store, Security,
799    /// Minidump, Unreal.
800    ///
801    /// The events are counted before they are rate limited, filtered, or processed in any way.
802    ///
803    /// This metric is tagged with:
804    ///  - `version`: The event protocol version number defaulting to `7`.
805    EventProtocol,
806    /// The number of transaction events processed by the source of the transaction name.
807    ///
808    /// This metric is tagged with:
809    ///  - `platform`: The event's platform, such as `"javascript"`.
810    ///  - `source`: The source of the transaction name on the client. See the [transaction source
811    ///    documentation](https://develop.sentry.dev/sdk/event-payloads/properties/transaction_info/)
812    ///    for all valid values.
813    ///  - `contains_slashes`: Whether the transaction name contains `/`. We use this as a heuristic
814    ///    to represent URL transactions.
815    EventTransaction,
816    /// The number of transaction events processed grouped by transaction name modifications.
817    /// This metric is tagged with:
818    ///  - `source_in`: The source of the transaction name before normalization.
819    ///    See the [transaction source
820    ///    documentation](https://develop.sentry.dev/sdk/event-payloads/properties/transaction_info/)
821    ///    for all valid values.
822    ///  - `change`: The mechanism that changed the transaction name.
823    ///    Either `"none"`, `"pattern"`, `"rule"`, or `"both"`.
824    ///  - `source_out`: The source of the transaction name after normalization.
825    TransactionNameChanges,
826    /// Number of HTTP requests reaching Relay.
827    Requests,
828    /// Number of completed HTTP requests.
829    ///
830    /// This metric is tagged with:
831    ///
832    ///  - `status_code`: The HTTP status code number.
833    ///  - `method`: The HTTP method used in the request in uppercase.
834    ///  - `route`: Unique dashed identifier of the endpoint.
835    ResponsesStatusCodes,
836    /// Number of evicted stale projects from the cache.
837    ///
838    /// Relay scans the in-memory project cache for stale entries in a regular interval configured
839    /// by `cache.eviction_interval`.
840    ///
841    /// The cache duration for project states can be configured with the following options:
842    ///
843    ///  - `cache.project_expiry`: The time after which a project state counts as expired. It is
844    ///    automatically refreshed if a request references the project after it has expired.
845    ///  - `cache.project_grace_period`: The time after expiry at which the project state will still
846    ///    be used to ingest events. Once the grace period expires, the cache is evicted and new
847    ///    requests wait for an update.
848    EvictingStaleProjectCaches,
849    /// Number of refreshes for stale projects in the cache.
850    RefreshStaleProjectCaches,
851    /// Number of times that parsing a metrics bucket item from an envelope failed.
852    MetricBucketsParsingFailed,
853    /// Count extraction of transaction names. Tag with the decision to drop / replace / use original.
854    MetricsTransactionNameExtracted,
855    /// Number of Events with an OpenTelemetry Context
856    ///
857    /// This metric is tagged with:
858    ///  - `platform`: The event's platform, such as `"javascript"`.
859    ///  - `sdk`: The name of the Sentry SDK sending the transaction. This tag is only set for
860    ///    Sentry's SDKs and defaults to "proprietary".
861    OpenTelemetryEvent,
862    /// Number of global config fetches from upstream. Only 2XX responses are
863    /// considered and ignores send errors (e.g. auth or network errors).
864    ///
865    /// This metric is tagged with:
866    ///  - `success`: whether deserializing the global config succeeded.
867    GlobalConfigFetched,
868    /// The number of attachments processed in the same envelope as a user_report_v2 event.
869    FeedbackAttachments,
870    /// All COGS tracked values.
871    ///
872    /// This metric is tagged with:
873    /// - `resource_id`: The COGS resource id.
874    /// - `app_feature`: The COGS app feature.
875    CogsUsage,
876    /// The amount of times metrics of a project have been flushed without the project being
877    /// fetched/available.
878    ProjectStateFlushMetricsNoProject,
879    /// Incremented every time a bucket is dropped.
880    ///
881    /// This should only happen when a project state is invalid during graceful shutdown.
882    ///
883    /// This metric is tagged with:
884    ///  - `aggregator`: The name of the metrics aggregator (usually `"default"`).
885    BucketsDropped,
886    /// Incremented every time a segment exceeds the expected limit.
887    ReplayExceededSegmentLimit,
888    /// Incremented every time the server accepts a new connection.
889    ServerSocketAccept,
890    /// Incremented every time the server aborts a connection because of an idle timeout.
891    ServerConnectionIdleTimeout,
892    /// The total delay of metric buckets in seconds.
893    ///
894    /// The delay is measured from initial creation of the bucket in an internal Relay
895    /// until it is produced to Kafka.
896    ///
897    /// Use [`Self::MetricDelayCount`] to calculate the average delay.
898    ///
899    /// This metric is tagged with:
900    /// - `namespace`: the metric namespace.
901    #[cfg(feature = "processing")]
902    MetricDelaySum,
903    /// The amount of buckets counted for the [`Self::MetricDelaySum`] metric.
904    ///
905    /// This metric is tagged with:
906    /// - `namespace`: the metric namespace.
907    #[cfg(feature = "processing")]
908    MetricDelayCount,
909    /// The amount of times PlayStation processing was attempted.
910    #[cfg(all(sentry, feature = "processing"))]
911    PlaystationProcessing,
912}
913
914impl CounterMetric for RelayCounters {
915    fn name(&self) -> &'static str {
916        match self {
917            RelayCounters::AsyncPoolFinishedTasks => "async_pool.finished_tasks",
918            RelayCounters::EventCorrupted => "event.corrupted",
919            RelayCounters::EnvelopeAccepted => "event.accepted",
920            RelayCounters::EnvelopeRejected => "event.rejected",
921            RelayCounters::EnvelopeItems => "event.items",
922            RelayCounters::EnvelopeItemBytes => "event.item_bytes",
923            RelayCounters::BufferTryPop => "buffer.try_pop",
924            RelayCounters::BufferSpooledEnvelopes => "buffer.spooled_envelopes",
925            RelayCounters::BufferUnspooledEnvelopes => "buffer.unspooled_envelopes",
926            RelayCounters::BufferProjectChangedEvent => "buffer.project_changed_event",
927            RelayCounters::BufferProjectPending => "buffer.project_pending",
928            RelayCounters::Outcomes => "events.outcomes",
929            RelayCounters::ProjectStateRequest => "project_state.request",
930            #[cfg(feature = "processing")]
931            RelayCounters::ProjectStateRedis => "project_state.redis.requests",
932            RelayCounters::ProjectUpstreamCompleted => "project_upstream.completed",
933            RelayCounters::ProjectUpstreamFailed => "project_upstream.failed",
934            RelayCounters::ProjectCacheSchedule => "project_cache.schedule",
935            RelayCounters::ServerStarting => "server.starting",
936            #[cfg(feature = "processing")]
937            RelayCounters::ProcessingMessageProduced => "processing.event.produced",
938            RelayCounters::EventProtocol => "event.protocol",
939            RelayCounters::EventTransaction => "event.transaction",
940            RelayCounters::TransactionNameChanges => "event.transaction_name_changes",
941            RelayCounters::Requests => "requests",
942            RelayCounters::ResponsesStatusCodes => "responses.status_codes",
943            RelayCounters::EvictingStaleProjectCaches => "project_cache.eviction",
944            RelayCounters::RefreshStaleProjectCaches => "project_cache.refresh",
945            RelayCounters::MetricBucketsParsingFailed => "metrics.buckets.parsing_failed",
946            RelayCounters::MetricsTransactionNameExtracted => "metrics.transaction_name",
947            RelayCounters::OpenTelemetryEvent => "event.opentelemetry",
948            RelayCounters::GlobalConfigFetched => "global_config.fetch",
949            RelayCounters::FeedbackAttachments => "processing.feedback_attachments",
950            RelayCounters::CogsUsage => "cogs.usage",
951            RelayCounters::ProjectStateFlushMetricsNoProject => "project_state.metrics.no_project",
952            RelayCounters::BucketsDropped => "metrics.buckets.dropped",
953            RelayCounters::ReplayExceededSegmentLimit => "replay.segment_limit_exceeded",
954            RelayCounters::ServerSocketAccept => "server.http.accepted",
955            RelayCounters::ServerConnectionIdleTimeout => "server.http.idle_timeout",
956            #[cfg(feature = "processing")]
957            RelayCounters::MetricDelaySum => "metrics.delay.sum",
958            #[cfg(feature = "processing")]
959            RelayCounters::MetricDelayCount => "metrics.delay.count",
960            #[cfg(all(sentry, feature = "processing"))]
961            RelayCounters::PlaystationProcessing => "processing.playstation",
962        }
963    }
964}
965
966/// Low-cardinality platform that can be used as a statsd tag.
967pub enum PlatformTag {
968    Cocoa,
969    Csharp,
970    Edge,
971    Go,
972    Java,
973    Javascript,
974    Julia,
975    Native,
976    Node,
977    Objc,
978    Other,
979    Perl,
980    Php,
981    Python,
982    Ruby,
983    Swift,
984}
985
986impl PlatformTag {
987    pub fn name(&self) -> &str {
988        match self {
989            Self::Cocoa => "cocoa",
990            Self::Csharp => "csharp",
991            Self::Edge => "edge",
992            Self::Go => "go",
993            Self::Java => "java",
994            Self::Javascript => "javascript",
995            Self::Julia => "julia",
996            Self::Native => "native",
997            Self::Node => "node",
998            Self::Objc => "objc",
999            Self::Other => "other",
1000            Self::Perl => "perl",
1001            Self::Php => "php",
1002            Self::Python => "python",
1003            Self::Ruby => "ruby",
1004            Self::Swift => "swift",
1005        }
1006    }
1007}
1008
1009impl<S: AsRef<str>> From<S> for PlatformTag {
1010    fn from(value: S) -> Self {
1011        match value.as_ref() {
1012            "cocoa" => Self::Cocoa,
1013            "csharp" => Self::Csharp,
1014            "edge" => Self::Edge,
1015            "go" => Self::Go,
1016            "java" => Self::Java,
1017            "javascript" => Self::Javascript,
1018            "julia" => Self::Julia,
1019            "native" => Self::Native,
1020            "node" => Self::Node,
1021            "objc" => Self::Objc,
1022            "perl" => Self::Perl,
1023            "php" => Self::Php,
1024            "python" => Self::Python,
1025            "ruby" => Self::Ruby,
1026            "swift" => Self::Swift,
1027            _ => Self::Other,
1028        }
1029    }
1030}
1031
1032/// Low-cardinality SDK name that can be used as a statsd tag.
1033pub enum ClientName<'a> {
1034    Ruby,
1035    CocoaFlutter,
1036    CocoaReactNative,
1037    Cocoa,
1038    Dotnet,
1039    AndroidReactNative,
1040    AndroidJava,
1041    SpringBoot,
1042    JavascriptBrowser,
1043    Electron,
1044    NestJs,
1045    NextJs,
1046    Node,
1047    React,
1048    Vue,
1049    Native,
1050    Laravel,
1051    Symfony,
1052    Php,
1053    Python,
1054    Other(&'a str),
1055}
1056
1057impl ClientName<'_> {
1058    pub fn name(&self) -> &'static str {
1059        match self {
1060            Self::Ruby => "sentry-ruby",
1061            Self::CocoaFlutter => "sentry.cocoa.flutter",
1062            Self::CocoaReactNative => "sentry.cocoa.react-native",
1063            Self::Cocoa => "sentry.cocoa",
1064            Self::Dotnet => "sentry.dotnet",
1065            Self::AndroidReactNative => "sentry.java.android.react-native",
1066            Self::AndroidJava => "sentry.java.android",
1067            Self::SpringBoot => "sentry.java.spring-boot.jakarta",
1068            Self::JavascriptBrowser => "sentry.javascript.browser",
1069            Self::Electron => "sentry.javascript.electron",
1070            Self::NestJs => "sentry.javascript.nestjs",
1071            Self::NextJs => "sentry.javascript.nextjs",
1072            Self::Node => "sentry.javascript.node",
1073            Self::React => "sentry.javascript.react",
1074            Self::Vue => "sentry.javascript.vue",
1075            Self::Native => "sentry.native",
1076            Self::Laravel => "sentry.php.laravel",
1077            Self::Symfony => "sentry.php.symfony",
1078            Self::Php => "sentry.php",
1079            Self::Python => "sentry.python",
1080            Self::Other(_) => "other",
1081        }
1082    }
1083}
1084
1085impl<'a> From<&'a str> for ClientName<'a> {
1086    fn from(value: &'a str) -> Self {
1087        match value {
1088            "sentry-ruby" => Self::Ruby,
1089            "sentry.cocoa.flutter" => Self::CocoaFlutter,
1090            "sentry.cocoa.react-native" => Self::CocoaReactNative,
1091            "sentry.cocoa" => Self::Cocoa,
1092            "sentry.dotnet" => Self::Dotnet,
1093            "sentry.java.android.react-native" => Self::AndroidReactNative,
1094            "sentry.java.android" => Self::AndroidJava,
1095            "sentry.java.spring-boot.jakarta" => Self::SpringBoot,
1096            "sentry.javascript.browser" => Self::JavascriptBrowser,
1097            "sentry.javascript.electron" => Self::Electron,
1098            "sentry.javascript.nestjs" => Self::NestJs,
1099            "sentry.javascript.nextjs" => Self::NextJs,
1100            "sentry.javascript.node" => Self::Node,
1101            "sentry.javascript.react" => Self::React,
1102            "sentry.javascript.vue" => Self::Vue,
1103            "sentry.native" => Self::Native,
1104            "sentry.php.laravel" => Self::Laravel,
1105            "sentry.php.symfony" => Self::Symfony,
1106            "sentry.php" => Self::Php,
1107            "sentry.python" => Self::Python,
1108            other => Self::Other(other),
1109        }
1110    }
1111}