relay_conventions/
consts.rs

1macro_rules! convention_attributes {
2    ($($name:ident => $attr:literal,)*) => {
3        $(pub const $name: &str = $attr;)*
4
5        #[test]
6        fn test_attributes_defined_in_conventions() {
7            $(
8                assert!(crate::attribute_info($name).is_some());
9            )*
10        }
11    };
12}
13
14// Attributes which can also be found in Sentry conventions.
15convention_attributes!(
16    BROWSER_NAME => "sentry.browser.name",
17    BROWSER_VERSION => "sentry.browser.version",
18    CLIENT_ADDRESS => "client.address",
19    CLIENT_SAMPLE_RATE => "sentry.client_sample_rate",
20    DB_QUERY_TEXT => "db.query.text",
21    DB_STATEMENT => "db.statement",
22    DB_SYSTEM => "db.system",
23    DB_SYSTEM_NAME => "db.system.name",
24    DB_OPERATION_NAME => "db.operation.name",
25    DB_COLLECTION_NAME => "db.collection.name",
26    DESCRIPTION => "sentry.description",
27    DSC_ENVIRONMENT => "sentry.dsc.environment",
28    DSC_PUBLIC_KEY => "sentry.dsc.public_key",
29    DSC_RELEASE => "sentry.dsc.release",
30    DSC_SAMPLED => "sentry.dsc.sampled",
31    DSC_SAMPLE_RATE => "sentry.dsc.sample_rate",
32    DSC_TRACE_ID => "sentry.dsc.trace_id",
33    DSC_TRANSACTION => "sentry.dsc.transaction",
34    ENVIRONMENT => "sentry.environment",
35    EVENT_NAME => "event.name",
36    FAAS_TRIGGER => "faas.trigger",
37    GEN_AI_COST_INPUT_TOKENS => "gen_ai.cost.input_tokens",
38    GEN_AI_COST_OUTPUT_TOKENS => "gen_ai.cost.output_tokens",
39    GEN_AI_COST_TOTAL_TOKENS => "gen_ai.cost.total_tokens",
40    GEN_AI_OPERATION_TYPE => "gen_ai.operation.type",
41    GEN_AI_OPERATION_NAME => "gen_ai.operation.name",
42    GEN_AI_REQUEST_MODEL => "gen_ai.request.model",
43    GEN_AI_RESPONSE_MODEL => "gen_ai.response.model",
44    GEN_AI_RESPONSE_TPS => "gen_ai.response.tokens_per_second",
45    GEN_AI_SYSTEM => "gen_ai.system",
46    GEN_AI_USAGE_INPUT_CACHED_TOKENS => "gen_ai.usage.input_tokens.cached",
47    GEN_AI_USAGE_INPUT_CACHE_WRITE_TOKENS => "gen_ai.usage.input_tokens.cache_write",
48    GEN_AI_USAGE_INPUT_TOKENS => "gen_ai.usage.input_tokens",
49    GEN_AI_USAGE_OUTPUT_REASONING_TOKENS => "gen_ai.usage.output_tokens.reasoning",
50    GEN_AI_USAGE_OUTPUT_TOKENS => "gen_ai.usage.output_tokens",
51    GEN_AI_USAGE_TOTAL_TOKENS => "gen_ai.usage.total_tokens",
52    GRAPHQL_OPERATION => "sentry.graphql.operation",
53    HTTP_PREFETCH => "sentry.http.prefetch",
54    HTTP_REQUEST_METHOD => "http.request.method",
55    HTTP_RESPONSE_STATUS_CODE => "http.response.status_code",
56    HTTP_ROUTE => "http.route",
57    HTTP_TARGET => "http.target",
58    IS_REMOTE => "sentry.is_remote",
59    MESSAGING_SYSTEM => "messaging.system",
60    NORMALIZED_DB_QUERY => "sentry.normalized_db_query",
61    NORMALIZED_DB_QUERY_HASH => "sentry.normalized_db_query.hash",
62    OBSERVED_TIMESTAMP_NANOS => "sentry.observed_timestamp_nanos",
63    OP => "sentry.op",
64    ORIGIN => "sentry.origin",
65    PLATFORM => "sentry.platform",
66    PROFILE_ID => "sentry.profile_id",
67    RELEASE => "sentry.release",
68    RESOURCE_RENDER_BLOCKING_STATUS => "resource.render_blocking_status",
69    RPC_GRPC_STATUS_CODE => "rpc.grpc.status_code",
70    RPC_SERVICE => "rpc.service",
71    SEGMENT_ID => "sentry.segment.id",
72    SEGMENT_NAME => "sentry.segment.name",
73    SENTRY_ACTION => "sentry.action",
74    SENTRY_CATEGORY => "sentry.category",
75    SENTRY_DOMAIN => "sentry.domain",
76    SENTRY_GROUP => "sentry.group",
77    SENTRY_NORMALIZED_DESCRIPTION => "sentry.normalized_description",
78    SENTRY_STATUS_CODE => "sentry.status_code",
79    SERVER_ADDRESS => "server.address",
80    SPAN_KIND => "sentry.kind",
81    STATUS_MESSAGE => "sentry.status.message",
82    UI_COMPONENT_NAME => "ui.component_name",
83    URL_FULL => "url.full",
84    URL_PATH => "url.path",
85    URL_SCHEME => "url.scheme",
86    URL_DOMAIN => "url.domain",
87    USER_AGENT_ORIGINAL => "user_agent.original",
88    USER_GEO_CITY => "user.geo.city",
89    USER_GEO_COUNTRY_CODE => "user.geo.country_code",
90    USER_GEO_REGION => "user.geo.region",
91    USER_GEO_SUBDIVISION => "user.geo.subdivision",
92);
93
94/// Attributes which are in use by Relay but are not yet defined in the Sentry conventions.
95///
96/// Really do not add to this list, at all, ever. The only reason this opt-out even exists to make a
97/// transition easier for attributes which Relay already uses but aren't yet in conventions.
98mod not_yet_defined {
99    // The legacy http request method attribute used by transactions spans.
100    // Could not be added to sentry conventions at the time due to an attribute naming conflict that
101    // requires updating the sentry conventions code gen.
102    // TODO: replace with conventions defined attribute name once the conventions code gen is updated.
103    pub const LEGACY_HTTP_REQUEST_METHOD: &str = "http.request_method";
104
105    pub const WAS_TRANSACTION: &str = "sentry.was_transaction";
106}
107pub use self::not_yet_defined::*;