Skip to content

Commit

Permalink
Replace OTLP User-Agent spaces with dashes (#5080)
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-berg authored Jan 5, 2023
1 parent 1f975b3 commit a0f4647
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
public final class OtlpUserAgent {

private static final String userAgent = "OTel OTLP Exporter Java/" + readVersion();
private static final String userAgent = "OTel-OTLP-Exporter-Java/" + readVersion();

private static String readVersion() {
Properties properties = new Properties();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class OtlpUserAgentTest {

@Test
void getUserAgent() {
assertThat(OtlpUserAgent.getUserAgent()).matches("OTel OTLP Exporter Java/1\\..*");
assertThat(OtlpUserAgent.getUserAgent()).matches("OTel-OTLP-Exporter-Java/1\\..*");
}

@Test
Expand All @@ -27,6 +27,6 @@ void addUserAgentHeader() {
valueRef.set(value);
});
assertThat(keyRef.get()).isEqualTo("User-Agent");
assertThat(valueRef.get()).matches("OTel OTLP Exporter Java/1\\..*");
assertThat(valueRef.get()).matches("OTel-OTLP-Exporter-Java/1\\..*");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ void export() {
.satisfies(
req ->
assertThat(req.headers().get("User-Agent"))
.matches("OTel OTLP Exporter Java/1\\..*"));
.matches("OTel-OTLP-Exporter-Java/1\\..*"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,9 @@ void export() {
assertThat(httpRequests)
.singleElement()
.satisfies(
req -> {
assertThat(req.headers().get("User-Agent")).matches("OTel OTLP Exporter Java/1\\..*");
});
req ->
assertThat(req.headers().get("User-Agent"))
.matches("OTel-OTLP-Exporter-Java/1\\..*"));
}

@Test
Expand Down

0 comments on commit a0f4647

Please sign in to comment.