Skip to main content

telemetry_rust/middleware/aws/operations/
sagemaker_runtime.rs

1/// AWS SageMaker Runtime operations
2///
3/// API Reference: https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_Operations_Amazon_SageMaker_Runtime.html
4use crate::{KeyValue, StringValue};
5
6use super::*;
7
8/// Builder for SageMaker Runtime-specific OpenTelemetry spans.
9///
10/// This enum serves as a namespace for SageMaker Runtime operation span builders.
11/// Each operation provides a specific method to create properly configured
12/// spans with SageMaker Runtime-specific attributes.
13pub enum SageMakerRuntimeSpanBuilder {}
14
15impl AwsSpanBuilder<'_> {
16    /// Creates a SageMaker Runtime operation span builder.
17    ///
18    /// This method creates a span builder configured for SageMaker Runtime inference
19    /// operations with the endpoint name as the primary resource identifier.
20    ///
21    /// # Arguments
22    ///
23    /// * `method` - The SageMaker Runtime operation method name
24    /// * `endpoint_name` - The name of the SageMaker endpoint being invoked
25    pub fn sagemaker_runtime(
26        method: impl Into<StringValue>,
27        endpoint_name: impl Into<StringValue>,
28    ) -> Self {
29        let endpoint_name: StringValue = endpoint_name.into();
30        let attributes =
31            vec![KeyValue::new("aws.sagemaker.endpoint_name", endpoint_name)];
32        Self::client("SageMakerRuntime", method, attributes)
33    }
34}
35
36macro_rules! sagemaker_runtime_endpoint_operation {
37    ($op: ident) => {
38        impl SageMakerRuntimeSpanBuilder {
39            #[doc = concat!("Creates a span builder for the SageMaker Runtime ", stringify!($op), " operation.")]
40            ///
41            /// # Arguments
42            ///
43            /// * `endpoint_name` - The name of the SageMaker endpoint
44            pub fn $op<'a>(endpoint_name: impl Into<StringValue>) -> AwsSpanBuilder<'a> {
45                AwsSpanBuilder::sagemaker_runtime(stringify_camel!($op), endpoint_name)
46            }
47        }
48    };
49}
50
51sagemaker_runtime_endpoint_operation!(invoke_endpoint);
52sagemaker_runtime_endpoint_operation!(invoke_endpoint_async);
53sagemaker_runtime_endpoint_operation!(invoke_endpoint_with_response_stream);