telemetry_rust/middleware/aws/operations/
firehose.rs

1/// AWS Firehose operations
2///
3/// API Reference: https://docs.aws.amazon.com/firehose/latest/APIReference/API_Operations.html
4use crate::{KeyValue, StringValue, semconv};
5
6use super::*;
7
8/// Builder for Firehose-specific OpenTelemetry spans.
9///
10/// This enum serves as a namespace for Firehose operation span builders.
11/// Each operation provides a specific method to create properly configured
12/// spans with Firehose-specific messaging attributes.
13pub enum FirehoseSpanBuilder {}
14
15impl AwsSpanBuilder<'_> {
16    /// Creates a Firehose operation span builder.
17    ///
18    /// This method creates a span builder configured for Firehose operations with
19    /// appropriate messaging semantic attributes.
20    ///
21    /// # Arguments
22    ///
23    /// * `operation_kind` - The type of messaging operation being performed
24    /// * `method` - The Firehose operation method name
25    /// * `stream_name` - Optional stream name for operations that target specific streams
26    pub fn firehose(
27        operation_kind: MessagingOperationKind,
28        method: impl Into<StringValue>,
29        stream_name: Option<impl Into<StringValue>>,
30    ) -> Self {
31        let mut attributes = vec![
32            KeyValue::new(semconv::MESSAGING_SYSTEM, "aws_firehose"),
33            KeyValue::new(semconv::MESSAGING_OPERATION_TYPE, operation_kind.as_str()),
34        ];
35        if let Some(stream_name) = stream_name {
36            attributes.push(KeyValue::new(
37                semconv::MESSAGING_DESTINATION_NAME,
38                stream_name.into(),
39            ))
40        }
41        Self::new(operation_kind.into(), "Firehose", method, attributes)
42    }
43}
44
45macro_rules! firehose_global_operation {
46    ($op: ident) => {
47        impl FirehoseSpanBuilder {
48            #[doc = concat!("Creates a span builder for the Firehose ", stringify!($op), " global operation.")]
49            #[inline]
50            pub fn $op<'a>() -> AwsSpanBuilder<'a> {
51                AwsSpanBuilder::firehose(
52                    MessagingOperationKind::Control,
53                    stringify_camel!($op),
54                    None::<StringValue>,
55                )
56            }
57        }
58    };
59}
60
61macro_rules! firehose_publish_operation {
62    ($op: ident, $kind: expr) => {
63        impl FirehoseSpanBuilder {
64            #[doc = concat!("Creates a span builder for the Firehose ", stringify!($op), " operation.")]
65            ///
66            /// # Arguments
67            ///
68            /// * `stream_name` - The name of the Firehose delivery stream
69            pub fn $op<'a>(stream_name: impl Into<StringValue>) -> AwsSpanBuilder<'a> {
70                AwsSpanBuilder::firehose($kind, stringify_camel!($op), Some(stream_name))
71            }
72        }
73    };
74}
75
76macro_rules! firehose_stream_operation {
77    ($op: ident) => {
78        impl FirehoseSpanBuilder {
79            #[doc = concat!("Creates a span builder for the Firehose ", stringify!($op), " stream operation.")]
80            ///
81            /// # Arguments
82            ///
83            /// * `stream_name` - The name of the Firehose delivery stream
84            pub fn $op<'a>(stream_name: impl Into<StringValue>) -> AwsSpanBuilder<'a> {
85                AwsSpanBuilder::firehose(
86                    MessagingOperationKind::Control,
87                    stringify_camel!($op),
88                    Some(stream_name),
89                )
90            }
91        }
92    };
93}
94
95// publish operation
96firehose_publish_operation!(put_record, MessagingOperationKind::Create);
97firehose_publish_operation!(put_record_batch, MessagingOperationKind::Send);
98
99// global operations
100firehose_global_operation!(list_delivery_streams);
101
102// control plane stream operations
103firehose_stream_operation!(create_delivery_stream);
104firehose_stream_operation!(delete_delivery_stream);
105firehose_stream_operation!(describe_delivery_stream);
106firehose_stream_operation!(list_tags_for_delivery_stream);
107firehose_stream_operation!(start_delivery_stream_encryption);
108firehose_stream_operation!(stop_delivery_stream_encryption);
109firehose_stream_operation!(tag_delivery_stream);
110firehose_stream_operation!(untag_delivery_stream);
111firehose_stream_operation!(update_destination);