Skip to content

Commit 12d88f2

Browse files
adinauerclaude
andcommitted
ref: Limit scope attributes sample to base Spring Boot 4 variant
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f0a2a21 commit 12d88f2

File tree

12 files changed

+6
-69
lines changed

12 files changed

+6
-69
lines changed

sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/MetricController.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ public class MetricController {
1616

1717
@GetMapping("count")
1818
String count() {
19-
Sentry.setAttribute("user.type", "admin");
20-
Sentry.setAttribute("feature.version", 2);
2119
Sentry.metrics().count("countMetric");
2220
return "count metric increased";
2321
}

sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/java/io/sentry/samples/spring/boot4/PersonController.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ Person person(@PathVariable Long id) {
3434
Sentry.addFeatureFlag("outer-feature-flag", true);
3535
Span span = tracer.spanBuilder("spanCreatedThroughOtelApi").startSpan();
3636
try (final @NotNull Scope spanScope = span.makeCurrent()) {
37-
Sentry.setAttribute("user.type", "admin");
38-
Sentry.setAttribute("feature.version", 2);
39-
Sentry.setAttribute("debug.enabled", true);
40-
4137
Sentry.logger().warn("warn Sentry logging");
4238
Sentry.logger().error("error Sentry logging");
4339
Sentry.logger().info("hello %s %s", "there", "world!");

sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ class MetricsSystemTest {
2121
assertEquals(200, restClient.lastKnownStatusCode)
2222

2323
testHelper.ensureMetricsReceived { event, header ->
24-
testHelper.doesContainMetric(event, "countMetric", "counter", 1.0) &&
25-
testHelper.doesMetricHaveAttribute(event, "countMetric", "user.type", "admin") &&
26-
testHelper.doesMetricHaveAttribute(event, "countMetric", "feature.version", 2)
24+
testHelper.doesContainMetric(event, "countMetric", "counter", 1.0)
2725
}
2826
}
2927

sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,7 @@ class PersonSystemTest {
5656
testHelper.ensureLogsReceived { logs, envelopeHeader ->
5757
testHelper.doesContainLogWithBody(logs, "warn Sentry logging") &&
5858
testHelper.doesContainLogWithBody(logs, "error Sentry logging") &&
59-
testHelper.doesContainLogWithBody(logs, "hello there world!") &&
60-
testHelper.doesLogWithBodyHaveAttribute(
61-
logs,
62-
"warn Sentry logging",
63-
"user.type",
64-
"admin",
65-
) &&
66-
testHelper.doesLogWithBodyHaveAttribute(
67-
logs,
68-
"warn Sentry logging",
69-
"feature.version",
70-
2,
71-
) &&
72-
testHelper.doesLogWithBodyHaveAttribute(logs, "warn Sentry logging", "debug.enabled", true)
59+
testHelper.doesContainLogWithBody(logs, "hello there world!")
7360
}
7461
}
7562

sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/MetricController.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ public class MetricController {
1616

1717
@GetMapping("count")
1818
String count() {
19-
Sentry.setAttribute("user.type", "admin");
20-
Sentry.setAttribute("feature.version", 2);
2119
Sentry.metrics().count("countMetric");
2220
return "count metric increased";
2321
}

sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/java/io/sentry/samples/spring/boot4/PersonController.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ Person person(@PathVariable Long id) {
3232
Sentry.addFeatureFlag("transaction-feature-flag", true);
3333
Span span = tracer.spanBuilder("spanCreatedThroughOtelApi").startSpan();
3434
try (final @NotNull Scope spanScope = span.makeCurrent()) {
35-
Sentry.setAttribute("user.type", "admin");
36-
Sentry.setAttribute("feature.version", 2);
37-
Sentry.setAttribute("debug.enabled", true);
38-
3935
Sentry.logger().warn("warn Sentry logging");
4036
Sentry.logger().error("error Sentry logging");
4137
Sentry.logger().info("hello %s %s", "there", "world!");

sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/test/kotlin/io/sentry/systemtest/MetricsSystemTest.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ class MetricsSystemTest {
2121
assertEquals(200, restClient.lastKnownStatusCode)
2222

2323
testHelper.ensureMetricsReceived { event, header ->
24-
testHelper.doesContainMetric(event, "countMetric", "counter", 1.0) &&
25-
testHelper.doesMetricHaveAttribute(event, "countMetric", "user.type", "admin") &&
26-
testHelper.doesMetricHaveAttribute(event, "countMetric", "feature.version", 2)
24+
testHelper.doesContainMetric(event, "countMetric", "counter", 1.0)
2725
}
2826
}
2927

sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/test/kotlin/io/sentry/systemtest/PersonSystemTest.kt

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,7 @@ class PersonSystemTest {
5151
testHelper.ensureLogsReceived { logs, envelopeHeader ->
5252
testHelper.doesContainLogWithBody(logs, "warn Sentry logging") &&
5353
testHelper.doesContainLogWithBody(logs, "error Sentry logging") &&
54-
testHelper.doesContainLogWithBody(logs, "hello there world!") &&
55-
testHelper.doesLogWithBodyHaveAttribute(
56-
logs,
57-
"warn Sentry logging",
58-
"user.type",
59-
"admin",
60-
) &&
61-
testHelper.doesLogWithBodyHaveAttribute(
62-
logs,
63-
"warn Sentry logging",
64-
"feature.version",
65-
2,
66-
) &&
67-
testHelper.doesLogWithBodyHaveAttribute(logs, "warn Sentry logging", "debug.enabled", true)
54+
testHelper.doesContainLogWithBody(logs, "hello there world!")
6855
}
6956
}
7057

sentry-samples/sentry-samples-spring-boot-4-webflux/src/main/java/io/sentry/samples/spring/boot4/MetricController.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ public class MetricController {
1616

1717
@GetMapping("count")
1818
String count() {
19-
Sentry.setAttribute("user.type", "admin");
20-
Sentry.setAttribute("feature.version", 2);
2119
Sentry.metrics().count("countMetric");
2220
return "count metric increased";
2321
}

sentry-samples/sentry-samples-spring-boot-4-webflux/src/main/java/io/sentry/samples/spring/boot4/PersonController.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ public PersonController(PersonService personService) {
2323

2424
@GetMapping("{id}")
2525
Person person(@PathVariable Long id) {
26-
Sentry.setAttribute("user.type", "admin");
27-
Sentry.setAttribute("feature.version", 2);
28-
Sentry.setAttribute("debug.enabled", true);
29-
3026
Sentry.logger().warn("warn Sentry logging");
3127
Sentry.logger().error("error Sentry logging");
3228
Sentry.logger().info("hello %s %s", "there", "world!");

0 commit comments

Comments
 (0)