telemetry_rust/middleware/aws/instrumentation/fluent_builder/
ssm.rs1use super::{utils::*, *};
3
4impl<'a> AwsBuilderInstrument<'a> for GetParameterFluentBuilder {
6 fn build_aws_span(&self) -> AwsSpanBuilder<'a> {
7 let name = self.get_name().clone().unwrap_or_default();
8 let attributes = attributes![
9 self.get_with_decryption()
10 .as_attribute("aws.ssm.with_decryption"),
11 ];
12 SsmSpanBuilder::get_parameter(name).attributes(attributes)
13 }
14}
15impl InstrumentedFluentBuilderOutput for GetParameterOutput {
16 fn extract_attributes(&self) -> impl IntoIterator<Item = KeyValue> {
17 attributes![
18 self.parameter()
19 .map(|p| KeyValue::new("aws.ssm.parameter_version", p.version())),
20 self.parameter()
21 .and_then(|p| p.r#type())
22 .map(|t| KeyValue::new("aws.ssm.type", t.as_str().to_owned())),
23 ]
24 }
25}
26instrument_aws_operation!(aws_sdk_ssm::operation::get_parameter);
27
28impl<'a> AwsBuilderInstrument<'a> for PutParameterFluentBuilder {
29 fn build_aws_span(&self) -> AwsSpanBuilder<'a> {
30 let name = self.get_name().clone().unwrap_or_default();
31 let attributes = attributes![
32 self.get_overwrite().as_attribute("aws.ssm.overwrite"),
33 self.get_type()
34 .as_ref()
35 .map(|t| KeyValue::new("aws.ssm.type", t.as_str().to_owned())),
36 self.get_tier()
37 .as_ref()
38 .map(|t| KeyValue::new("aws.ssm.tier", t.as_str().to_owned())),
39 ];
40 SsmSpanBuilder::put_parameter(name).attributes(attributes)
41 }
42}
43impl InstrumentedFluentBuilderOutput for PutParameterOutput {
44 fn extract_attributes(&self) -> impl IntoIterator<Item = KeyValue> {
45 attributes![
46 Some(KeyValue::new("aws.ssm.parameter_version", self.version(),)),
47 self.tier()
48 .as_ref()
49 .map(|t| KeyValue::new("aws.ssm.tier", t.as_str().to_owned())),
50 ]
51 }
52}
53instrument_aws_operation!(aws_sdk_ssm::operation::put_parameter);
54
55impl<'a> AwsBuilderInstrument<'a> for DeleteParameterFluentBuilder {
56 fn build_aws_span(&self) -> AwsSpanBuilder<'a> {
57 let name = self.get_name().clone().unwrap_or_default();
58 SsmSpanBuilder::delete_parameter(name)
59 }
60}
61impl InstrumentedFluentBuilderOutput for DeleteParameterOutput {}
62instrument_aws_operation!(aws_sdk_ssm::operation::delete_parameter);
63
64impl<'a> AwsBuilderInstrument<'a> for GetParameterHistoryFluentBuilder {
65 fn build_aws_span(&self) -> AwsSpanBuilder<'a> {
66 let name = self.get_name().clone().unwrap_or_default();
67 let attributes = attributes![
68 self.get_with_decryption()
69 .as_attribute("aws.ssm.with_decryption"),
70 self.get_max_results()
71 .map(|v| KeyValue::new("aws.ssm.max_results", v as i64)),
72 ];
73 SsmSpanBuilder::get_parameter_history(name).attributes(attributes)
74 }
75}
76impl InstrumentedFluentBuilderOutput for GetParameterHistoryOutput {
77 fn extract_attributes(&self) -> impl IntoIterator<Item = KeyValue> {
78 attributes![
79 self.parameters()
80 .len()
81 .as_attribute("aws.ssm.parameter_count"),
82 ]
83 }
84}
85instrument_aws_operation!(aws_sdk_ssm::operation::get_parameter_history);
86
87impl<'a> AwsBuilderInstrument<'a> for LabelParameterVersionFluentBuilder {
88 fn build_aws_span(&self) -> AwsSpanBuilder<'a> {
89 let name = self.get_name().clone().unwrap_or_default();
90 let attributes = attributes![
91 self.get_parameter_version()
92 .map(|v| KeyValue::new("aws.ssm.parameter_version", v)),
93 ];
94 SsmSpanBuilder::label_parameter_version(name).attributes(attributes)
95 }
96}
97impl InstrumentedFluentBuilderOutput for LabelParameterVersionOutput {
98 fn extract_attributes(&self) -> impl IntoIterator<Item = KeyValue> {
99 attributes![
100 Some(KeyValue::new(
101 "aws.ssm.parameter_version",
102 self.parameter_version(),
103 )),
104 self.invalid_labels()
105 .len()
106 .as_attribute("aws.ssm.invalid_labels_count"),
107 ]
108 }
109}
110instrument_aws_operation!(aws_sdk_ssm::operation::label_parameter_version);
111
112impl<'a> AwsBuilderInstrument<'a> for UnlabelParameterVersionFluentBuilder {
113 fn build_aws_span(&self) -> AwsSpanBuilder<'a> {
114 let name = self.get_name().clone().unwrap_or_default();
115 let attributes = attributes![
116 self.get_parameter_version()
117 .map(|v| KeyValue::new("aws.ssm.parameter_version", v)),
118 ];
119 SsmSpanBuilder::unlabel_parameter_version(name).attributes(attributes)
120 }
121}
122impl InstrumentedFluentBuilderOutput for UnlabelParameterVersionOutput {
123 fn extract_attributes(&self) -> impl IntoIterator<Item = KeyValue> {
124 attributes![
125 self.removed_labels()
126 .len()
127 .as_attribute("aws.ssm.removed_labels_count"),
128 self.invalid_labels()
129 .len()
130 .as_attribute("aws.ssm.invalid_labels_count"),
131 ]
132 }
133}
134instrument_aws_operation!(aws_sdk_ssm::operation::unlabel_parameter_version);
135
136impl<'a> AwsBuilderInstrument<'a> for GetParametersFluentBuilder {
138 fn build_aws_span(&self) -> AwsSpanBuilder<'a> {
139 let attributes = attributes![
140 self.get_names().as_ref().map(|names| KeyValue::new(
141 "aws.ssm.parameter_count",
142 names.len() as i64
143 )),
144 self.get_with_decryption()
145 .as_attribute("aws.ssm.with_decryption"),
146 ];
147 SsmSpanBuilder::get_parameters().attributes(attributes)
148 }
149}
150impl InstrumentedFluentBuilderOutput for GetParametersOutput {
151 fn extract_attributes(&self) -> impl IntoIterator<Item = KeyValue> {
152 attributes![
153 self.parameters()
154 .len()
155 .as_attribute("aws.ssm.parameter_count"),
156 self.invalid_parameters()
157 .len()
158 .as_attribute("aws.ssm.invalid_parameters_count"),
159 ]
160 }
161}
162instrument_aws_operation!(aws_sdk_ssm::operation::get_parameters);
163
164impl<'a> AwsBuilderInstrument<'a> for DeleteParametersFluentBuilder {
165 fn build_aws_span(&self) -> AwsSpanBuilder<'a> {
166 let attributes =
167 attributes![self.get_names().as_ref().map(|names| KeyValue::new(
168 "aws.ssm.parameter_count",
169 names.len() as i64
170 )),];
171 SsmSpanBuilder::delete_parameters().attributes(attributes)
172 }
173}
174impl InstrumentedFluentBuilderOutput for DeleteParametersOutput {
175 fn extract_attributes(&self) -> impl IntoIterator<Item = KeyValue> {
176 attributes![
177 self.deleted_parameters()
178 .len()
179 .as_attribute("aws.ssm.deleted_count"),
180 self.invalid_parameters()
181 .len()
182 .as_attribute("aws.ssm.invalid_parameters_count"),
183 ]
184 }
185}
186instrument_aws_operation!(aws_sdk_ssm::operation::delete_parameters);
187
188impl<'a> AwsBuilderInstrument<'a> for GetParametersByPathFluentBuilder {
190 fn build_aws_span(&self) -> AwsSpanBuilder<'a> {
191 let path = self.get_path().clone().unwrap_or_default();
192 let attributes = attributes![
193 self.get_recursive().as_attribute("aws.ssm.recursive"),
194 self.get_with_decryption()
195 .as_attribute("aws.ssm.with_decryption"),
196 self.get_max_results()
197 .map(|v| KeyValue::new("aws.ssm.max_results", v as i64)),
198 ];
199 SsmSpanBuilder::get_parameters_by_path(path).attributes(attributes)
200 }
201}
202impl InstrumentedFluentBuilderOutput for GetParametersByPathOutput {
203 fn extract_attributes(&self) -> impl IntoIterator<Item = KeyValue> {
204 attributes![
205 self.parameters()
206 .len()
207 .as_attribute("aws.ssm.parameter_count"),
208 ]
209 }
210}
211instrument_aws_operation!(aws_sdk_ssm::operation::get_parameters_by_path);
212
213impl<'a> AwsBuilderInstrument<'a> for DescribeParametersFluentBuilder {
215 fn build_aws_span(&self) -> AwsSpanBuilder<'a> {
216 let attributes = attributes![
217 self.get_max_results()
218 .map(|v| KeyValue::new("aws.ssm.max_results", v as i64)),
219 ];
220 SsmSpanBuilder::describe_parameters().attributes(attributes)
221 }
222}
223impl InstrumentedFluentBuilderOutput for DescribeParametersOutput {
224 fn extract_attributes(&self) -> impl IntoIterator<Item = KeyValue> {
225 attributes![
226 self.parameters()
227 .len()
228 .as_attribute("aws.ssm.parameter_count"),
229 ]
230 }
231}
232instrument_aws_operation!(aws_sdk_ssm::operation::describe_parameters);