Skip to content

Commit 5d33384

Browse files
change value to name
1 parent 3b946f0 commit 5d33384

File tree

8 files changed

+33
-31
lines changed

8 files changed

+33
-31
lines changed

instrumentation-annotations-incubator/src/main/java/io/opentelemetry/instrumentation/annotations/incubator/Attribute.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@
3737
* `javac`, the parameter name will be used instead. If the parameter name is not available, e.g.,
3838
* because the code was not compiled with that flag, the attribute will be ignored.
3939
*/
40-
String value() default "";
40+
String name() default "";
4141
}

instrumentation-annotations-incubator/src/main/java/io/opentelemetry/instrumentation/annotations/incubator/Counted.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
* <p>The name should follow the metric naming rules: <a
4141
* href="https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#instrument-name-syntax">https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#instrument-name-syntax</a>
4242
*/
43-
String value();
43+
String name();
4444

4545
/**
4646
* Description of the metric.

instrumentation-annotations-incubator/src/main/java/io/opentelemetry/instrumentation/annotations/incubator/Timed.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
* <p>The name should follow the metric naming rules: <a
4141
* href="https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#instrument-naming-rule">https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#instrument-naming-rule</a>
4242
*/
43-
String value();
43+
String name();
4444

4545
/**
4646
* Description for the metric.

instrumentation-annotations-incubator/src/test/java/io/opentelemetry/instrumentation/annotations/incubator/CountedUsageExamples.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77

88
public class CountedUsageExamples {
99

10-
@Counted("customizedName")
10+
@Counted(name = "customizedName")
1111
public void method() {}
1212

13-
@Counted("methodWithAttributes")
14-
public void attributes(@Attribute String attribute1, @Attribute("attribute2") long attribute2) {}
13+
@Counted(name = "methodWithAttributes")
14+
public void attributes(
15+
@Attribute String attribute1, @Attribute(name = "attribute2") long attribute2) {}
1516
}

instrumentation-annotations-incubator/src/test/java/io/opentelemetry/instrumentation/annotations/incubator/TimedUsageExamples.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77

88
public class TimedUsageExamples {
99

10-
@Timed("customizedName")
10+
@Timed(name = "customizedName")
1111
public void method() {}
1212

13-
@Timed("methodWithAttributes")
14-
public void attributes(@Attribute String attribute1, @Attribute("attribute2") long attribute2) {}
13+
@Timed(name = "methodWithAttributes")
14+
public void attributes(
15+
@Attribute String attribute1, @Attribute(name = "attribute2") long attribute2) {}
1516
}

instrumentation/opentelemetry-instrumentation-annotations/opentelemetry-instrumentation-annotations-incubator/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/instrumentationannotations/incubator/counted/CountedExample.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,42 +18,42 @@ public class CountedExample {
1818
public static final String METRIC_UNIT = "ms";
1919
public static final String TO_STRING = "I am a to string object.";
2020

21-
@Counted(METRIC_NAME)
21+
@Counted(name = METRIC_NAME)
2222
public void exampleWithName() {}
2323

24-
@Counted(value = "example.with.description.count", description = METRIC_DESCRIPTION)
24+
@Counted(name = "example.with.description.count", description = METRIC_DESCRIPTION)
2525
public void exampleWithDescription() {}
2626

27-
@Counted(value = "example.with.unit.count", unit = METRIC_UNIT)
27+
@Counted(name = "example.with.unit.count", unit = METRIC_UNIT)
2828
public void exampleWithUnit() {}
2929

30-
@Counted("example.with.static.attributes.count")
30+
@Counted(name = "example.with.static.attributes.count")
3131
@StaticAttribute(name = "key1", value = "value1")
3232
@StaticAttribute(name = "key2", value = "value2")
3333
@StaticAttribute(name = "key2", value = "value2")
3434
public void exampleWithStaticAttributes() {}
3535

36-
@Counted("example.with.attributes.count")
36+
@Counted(name = "example.with.attributes.count")
3737
public void exampleWithAttributes(
3838
@Attribute String attribute1,
39-
@Attribute("custom_attr1") long attribute2,
40-
@Attribute("custom_attr2") ToStringObject toStringObject) {}
39+
@Attribute(name = "custom_attr1") long attribute2,
40+
@Attribute(name = "custom_attr2") ToStringObject toStringObject) {}
4141

42-
@Counted(value = "example.with.return.count")
42+
@Counted(name = "example.with.return.count")
4343
@ReturnValueAttribute("returnValue")
4444
public ToStringObject exampleWithReturnValueAttribute() {
4545
return new ToStringObject();
4646
}
4747

48-
@Counted("example.with.exception.count")
48+
@Counted(name = "example.with.exception.count")
4949
public void exampleWithException() {
5050
throw new IllegalStateException("test exception.");
5151
}
5252

53-
@Counted("example.ignore.count")
53+
@Counted(name = "example.ignore.count")
5454
public void exampleIgnore() {}
5555

56-
@Counted(value = "example.completable.future.count")
56+
@Counted(name = "example.completable.future.count")
5757
@ReturnValueAttribute("returnValue")
5858
public CompletableFuture<String> completableFuture(CompletableFuture<String> future) {
5959
return future;

instrumentation/opentelemetry-instrumentation-annotations/opentelemetry-instrumentation-annotations-incubator/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/instrumentationannotations/incubator/timed/TimedExample.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,38 +16,38 @@ public class TimedExample {
1616
public static final String METRIC_DESCRIPTION = "I am the description.";
1717
public static final String TO_STRING = "I am a to string object.";
1818

19-
@Timed(METRIC_NAME)
19+
@Timed(name = METRIC_NAME)
2020
public void exampleWithName() {}
2121

22-
@Timed(value = "example.with.description.duration", description = METRIC_DESCRIPTION)
22+
@Timed(name = "example.with.description.duration", description = METRIC_DESCRIPTION)
2323
public void exampleWithDescription() {}
2424

25-
@Timed("example.with.static.attributes.duration")
25+
@Timed(name = "example.with.static.attributes.duration")
2626
@StaticAttribute(name = "key1", value = "value1")
2727
@StaticAttribute(name = "key2", value = "value2")
2828
public void exampleWithStaticAttributes() {}
2929

30-
@Timed("example.with.attributes.duration")
30+
@Timed(name = "example.with.attributes.duration")
3131
public void exampleWithAttributes(
3232
@Attribute String attribute1,
33-
@Attribute("custom_attr1") long attribute2,
34-
@Attribute("custom_attr2") TimedExample.ToStringObject toStringObject) {}
33+
@Attribute(name = "custom_attr1") long attribute2,
34+
@Attribute(name = "custom_attr2") TimedExample.ToStringObject toStringObject) {}
3535

36-
@Timed("example.ignore.duration")
36+
@Timed(name = "example.ignore.duration")
3737
public void exampleIgnore() {}
3838

39-
@Timed("example.with.exception.duration")
39+
@Timed(name = "example.with.exception.duration")
4040
public void exampleWithException() {
4141
throw new IllegalStateException("test");
4242
}
4343

44-
@Timed(value = "example.with.return.duration")
44+
@Timed(name = "example.with.return.duration")
4545
@ReturnValueAttribute("returnValue")
4646
public ToStringObject exampleWithReturnValueAttribute() {
4747
return new ToStringObject();
4848
}
4949

50-
@Timed(value = "example.completable.future.duration")
50+
@Timed(name = "example.completable.future.duration")
5151
@ReturnValueAttribute("returnValue")
5252
public CompletableFuture<String> completableFuture(CompletableFuture<String> future) {
5353
return future;

instrumentation/opentelemetry-instrumentation-annotations/opentelemetry-instrumentation-annotations-incubator/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/instrumentationannotations/incubator/timed/TimedInstrumentationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ void testExampleWithException() {
122122
}
123123

124124
@Test
125-
void testExampleWithReturnValueAttribute() {
125+
void testExampleWithReturnNameAttribute() {
126126
new TimedExample().exampleWithReturnValueAttribute();
127127
testing.waitAndAssertMetrics(
128128
TIMED_INSTRUMENTATION_NAME,

0 commit comments

Comments
 (0)