Skip to content

Commit

Permalink
test: test dst_labels
Browse files Browse the repository at this point in the history
  • Loading branch information
bruce-personio committed Sep 14, 2023
1 parent f8be66a commit 677f48c
Show file tree
Hide file tree
Showing 5 changed files with 144 additions and 3 deletions.
12 changes: 12 additions & 0 deletions .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

106 changes: 106 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 14 additions & 2 deletions linkerd/app/integration/src/tests/telemetry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -622,11 +622,11 @@ mod outbound_dst_labels {
let (
Fixture {
client,
metrics: _metrics,
metrics,
proxy: _proxy,
_profile,
dst_tx,
labels: _labels,
labels,
..
},
addr,
Expand All @@ -647,6 +647,18 @@ mod outbound_dst_labels {

info!("client.get(/)");
assert_eq!(client.get("/").await, "hello");

let labels = labels
.label("dst_addr_label", "foo")
.label("dst_set_label", "bar");

for &metric in &[
"request_total",
"response_total",
"response_latency_ms_count",
] {
labels.metric(metric).assert_in(&metrics).await;
}
}
}

Expand Down
7 changes: 6 additions & 1 deletion linkerd/app/outbound/src/http/concrete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,13 @@ where
dst_labels.remove("pod");
dst_labels.remove("pod_template_hash");

let label_iterator = match dst_labels.is_empty() {

Check failure on line 355 in linkerd/app/outbound/src/http/concrete.rs

View workflow job for this annotation

GitHub Actions / clippy

error[E0716]: temporary value dropped while borrowed --> linkerd/app/outbound/src/http/concrete.rs:357:22 | 355 | let label_iterator = match dst_labels.is_empty() { | -------------- borrow later stored here 356 | true => dst_labels.iter(), 357 | false => self.metadata.labels().iter() | ^^^^^^^^^^^^^^^^^^^^^^ - temporary value is freed at the end of this statement | | | creates a temporary value which is freed while still in use | help: consider using a `let` binding to create a longer lived value | 355 ~ let binding = self.metadata.labels(); 356 ~ let label_iterator = match dst_labels.is_empty() { 357 | true => dst_labels.iter(), 358 ~ false => binding.iter() |

Check failure on line 355 in linkerd/app/outbound/src/http/concrete.rs

View workflow job for this annotation

GitHub Actions / docs

error[E0716]: temporary value dropped while borrowed --> linkerd/app/outbound/src/http/concrete.rs:357:22 | 355 | let label_iterator = match dst_labels.is_empty() { | -------------- borrow later stored here 356 | true => dst_labels.iter(), 357 | false => self.metadata.labels().iter() | ^^^^^^^^^^^^^^^^^^^^^^ - temporary value is freed at the end of this statement | | | creates a temporary value which is freed while still in use | help: consider using a `let` binding to create a longer lived value | 355 ~ let binding = self.metadata.labels(); 356 ~ let label_iterator = match dst_labels.is_empty() { 357 | true => dst_labels.iter(), 358 ~ false => binding.iter() |

Check failure on line 355 in linkerd/app/outbound/src/http/concrete.rs

View workflow job for this annotation

GitHub Actions / package (amd64, gnu)

error[E0716]: temporary value dropped while borrowed --> linkerd/app/outbound/src/http/concrete.rs:357:22 | 355 | let label_iterator = match dst_labels.is_empty() { | -------------- borrow later stored here 356 | true => dst_labels.iter(), 357 | false => self.metadata.labels().iter() | ^^^^^^^^^^^^^^^^^^^^^^ - temporary value is freed at the end of this statement | | | creates a temporary value which is freed while still in use | help: consider using a `let` binding to create a longer lived value | 355 ~ let binding = self.metadata.labels(); 356 ~ let label_iterator = match dst_labels.is_empty() { 357 | true => dst_labels.iter(), 358 ~ false => binding.iter() |

Check failure on line 355 in linkerd/app/outbound/src/http/concrete.rs

View workflow job for this annotation

GitHub Actions / package (arm64, gnu)

error[E0716]: temporary value dropped while borrowed --> linkerd/app/outbound/src/http/concrete.rs:357:22 | 355 | let label_iterator = match dst_labels.is_empty() { | -------------- borrow later stored here 356 | true => dst_labels.iter(), 357 | false => self.metadata.labels().iter() | ^^^^^^^^^^^^^^^^^^^^^^ - temporary value is freed at the end of this statement | | | creates a temporary value which is freed while still in use | help: consider using a `let` binding to create a longer lived value | 355 ~ let binding = self.metadata.labels(); 356 ~ let label_iterator = match dst_labels.is_empty() { 357 | true => dst_labels.iter(), 358 ~ false => binding.iter() |

Check failure on line 355 in linkerd/app/outbound/src/http/concrete.rs

View workflow job for this annotation

GitHub Actions / package (arm, gnu)

error[E0716]: temporary value dropped while borrowed --> linkerd/app/outbound/src/http/concrete.rs:357:22 | 355 | let label_iterator = match dst_labels.is_empty() { | -------------- borrow later stored here 356 | true => dst_labels.iter(), 357 | false => self.metadata.labels().iter() | ^^^^^^^^^^^^^^^^^^^^^^ - temporary value is freed at the end of this statement | | | creates a temporary value which is freed while still in use | help: consider using a `let` binding to create a longer lived value | 355 ~ let binding = self.metadata.labels(); 356 ~ let label_iterator = match dst_labels.is_empty() { 357 | true => dst_labels.iter(), 358 ~ false => binding.iter() |
true => dst_labels.iter(),
false => self.metadata.labels().iter()

Check failure on line 357 in linkerd/app/outbound/src/http/concrete.rs

View workflow job for this annotation

GitHub Actions / clippy

error[E0716]: temporary value dropped while borrowed --> linkerd/app/outbound/src/http/concrete.rs:357:22 | 355 | let label_iterator = match dst_labels.is_empty() { | -------------- borrow later stored here 356 | true => dst_labels.iter(), 357 | false => self.metadata.labels().iter() | ^^^^^^^^^^^^^^^^^^^^^^ - temporary value is freed at the end of this statement | | | creates a temporary value which is freed while still in use | help: consider using a `let` binding to create a longer lived value | 355 ~ let binding = self.metadata.labels(); 356 ~ let label_iterator = match dst_labels.is_empty() { 357 | true => dst_labels.iter(), 358 ~ false => binding.iter() |

Check failure on line 357 in linkerd/app/outbound/src/http/concrete.rs

View workflow job for this annotation

GitHub Actions / clippy

error[E0716]: temporary value dropped while borrowed --> linkerd/app/outbound/src/http/concrete.rs:357:22 | 355 | let label_iterator = match dst_labels.is_empty() { | -------------- borrow later stored here 356 | true => dst_labels.iter(), 357 | false => self.metadata.labels().iter() | ^^^^^^^^^^^^^^^^^^^^^^ - temporary value is freed at the end of this statement | | | creates a temporary value which is freed while still in use | help: consider using a `let` binding to create a longer lived value | 355 ~ let binding = self.metadata.labels(); 356 ~ let label_iterator = match dst_labels.is_empty() { 357 | true => dst_labels.iter(), 358 ~ false => binding.iter() |

Check failure on line 357 in linkerd/app/outbound/src/http/concrete.rs

View workflow job for this annotation

GitHub Actions / docs

error[E0716]: temporary value dropped while borrowed --> linkerd/app/outbound/src/http/concrete.rs:357:22 | 355 | let label_iterator = match dst_labels.is_empty() { | -------------- borrow later stored here 356 | true => dst_labels.iter(), 357 | false => self.metadata.labels().iter() | ^^^^^^^^^^^^^^^^^^^^^^ - temporary value is freed at the end of this statement | | | creates a temporary value which is freed while still in use | help: consider using a `let` binding to create a longer lived value | 355 ~ let binding = self.metadata.labels(); 356 ~ let label_iterator = match dst_labels.is_empty() { 357 | true => dst_labels.iter(), 358 ~ false => binding.iter() |

Check failure on line 357 in linkerd/app/outbound/src/http/concrete.rs

View workflow job for this annotation

GitHub Actions / docs

error[E0716]: temporary value dropped while borrowed --> linkerd/app/outbound/src/http/concrete.rs:357:22 | 355 | let label_iterator = match dst_labels.is_empty() { | -------------- borrow later stored here 356 | true => dst_labels.iter(), 357 | false => self.metadata.labels().iter() | ^^^^^^^^^^^^^^^^^^^^^^ - temporary value is freed at the end of this statement | | | creates a temporary value which is freed while still in use | help: consider using a `let` binding to create a longer lived value | 355 ~ let binding = self.metadata.labels(); 356 ~ let label_iterator = match dst_labels.is_empty() { 357 | true => dst_labels.iter(), 358 ~ false => binding.iter() |

Check failure on line 357 in linkerd/app/outbound/src/http/concrete.rs

View workflow job for this annotation

GitHub Actions / package (amd64, gnu)

error[E0716]: temporary value dropped while borrowed --> linkerd/app/outbound/src/http/concrete.rs:357:22 | 355 | let label_iterator = match dst_labels.is_empty() { | -------------- borrow later stored here 356 | true => dst_labels.iter(), 357 | false => self.metadata.labels().iter() | ^^^^^^^^^^^^^^^^^^^^^^ - temporary value is freed at the end of this statement | | | creates a temporary value which is freed while still in use | help: consider using a `let` binding to create a longer lived value | 355 ~ let binding = self.metadata.labels(); 356 ~ let label_iterator = match dst_labels.is_empty() { 357 | true => dst_labels.iter(), 358 ~ false => binding.iter() |

Check failure on line 357 in linkerd/app/outbound/src/http/concrete.rs

View workflow job for this annotation

GitHub Actions / package (amd64, gnu)

error[E0716]: temporary value dropped while borrowed --> linkerd/app/outbound/src/http/concrete.rs:357:22 | 355 | let label_iterator = match dst_labels.is_empty() { | -------------- borrow later stored here 356 | true => dst_labels.iter(), 357 | false => self.metadata.labels().iter() | ^^^^^^^^^^^^^^^^^^^^^^ - temporary value is freed at the end of this statement | | | creates a temporary value which is freed while still in use | help: consider using a `let` binding to create a longer lived value | 355 ~ let binding = self.metadata.labels(); 356 ~ let label_iterator = match dst_labels.is_empty() { 357 | true => dst_labels.iter(), 358 ~ false => binding.iter() |

Check failure on line 357 in linkerd/app/outbound/src/http/concrete.rs

View workflow job for this annotation

GitHub Actions / package (arm64, gnu)

error[E0716]: temporary value dropped while borrowed --> linkerd/app/outbound/src/http/concrete.rs:357:22 | 355 | let label_iterator = match dst_labels.is_empty() { | -------------- borrow later stored here 356 | true => dst_labels.iter(), 357 | false => self.metadata.labels().iter() | ^^^^^^^^^^^^^^^^^^^^^^ - temporary value is freed at the end of this statement | | | creates a temporary value which is freed while still in use | help: consider using a `let` binding to create a longer lived value | 355 ~ let binding = self.metadata.labels(); 356 ~ let label_iterator = match dst_labels.is_empty() { 357 | true => dst_labels.iter(), 358 ~ false => binding.iter() |

Check failure on line 357 in linkerd/app/outbound/src/http/concrete.rs

View workflow job for this annotation

GitHub Actions / package (arm64, gnu)

error[E0716]: temporary value dropped while borrowed --> linkerd/app/outbound/src/http/concrete.rs:357:22 | 355 | let label_iterator = match dst_labels.is_empty() { | -------------- borrow later stored here 356 | true => dst_labels.iter(), 357 | false => self.metadata.labels().iter() | ^^^^^^^^^^^^^^^^^^^^^^ - temporary value is freed at the end of this statement | | | creates a temporary value which is freed while still in use | help: consider using a `let` binding to create a longer lived value | 355 ~ let binding = self.metadata.labels(); 356 ~ let label_iterator = match dst_labels.is_empty() { 357 | true => dst_labels.iter(), 358 ~ false => binding.iter() |

Check failure on line 357 in linkerd/app/outbound/src/http/concrete.rs

View workflow job for this annotation

GitHub Actions / package (arm, gnu)

error[E0716]: temporary value dropped while borrowed --> linkerd/app/outbound/src/http/concrete.rs:357:22 | 355 | let label_iterator = match dst_labels.is_empty() { | -------------- borrow later stored here 356 | true => dst_labels.iter(), 357 | false => self.metadata.labels().iter() | ^^^^^^^^^^^^^^^^^^^^^^ - temporary value is freed at the end of this statement | | | creates a temporary value which is freed while still in use | help: consider using a `let` binding to create a longer lived value | 355 ~ let binding = self.metadata.labels(); 356 ~ let label_iterator = match dst_labels.is_empty() { 357 | true => dst_labels.iter(), 358 ~ false => binding.iter() |

Check failure on line 357 in linkerd/app/outbound/src/http/concrete.rs

View workflow job for this annotation

GitHub Actions / package (arm, gnu)

error[E0716]: temporary value dropped while borrowed --> linkerd/app/outbound/src/http/concrete.rs:357:22 | 355 | let label_iterator = match dst_labels.is_empty() { | -------------- borrow later stored here 356 | true => dst_labels.iter(), 357 | false => self.metadata.labels().iter() | ^^^^^^^^^^^^^^^^^^^^^^ - temporary value is freed at the end of this statement | | | creates a temporary value which is freed while still in use | help: consider using a `let` binding to create a longer lived value | 355 ~ let binding = self.metadata.labels(); 356 ~ let label_iterator = match dst_labels.is_empty() { 357 | true => dst_labels.iter(), 358 ~ false => binding.iter() |
};

OutboundEndpointLabels {
labels: prefix_labels("dst", dst_labels.iter()),
labels: prefix_labels("dst", label_iterator),
server_id: self.param(),
}
}
Expand Down

0 comments on commit 677f48c

Please sign in to comment.