-
Notifications
You must be signed in to change notification settings - Fork 1k
add metric annotation instrumentation #11354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
add metric annotation instrumentation #11354
Conversation
There are some CI failures, firstly you can solve them by referring to https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/contributing/running-tests.md#troubleshooting-ci-test-failures |
f1797c8
to
f7dd6b9
Compare
...entation-annotations/src/main/java/io/opentelemetry/instrumentation/annotations/Counted.java
Outdated
Show resolved
Hide resolved
Hi @steverao, I found that there are lots of fails "to connect to localhost/127.0.0.1:4318". So I want to rerun the task, but I can't see the rerun button. Is it disabled for contributors? |
Yes, you can fix the problems firstly and push relevant commits. It will trigger to rerun the CI tasks. |
I mean I guest the failure is caused by the CI run time environment crush..... if it's able to rerun a task, It might save some time.... |
815bbfd
to
95f0f0d
Compare
f9657ec
to
5ab650b
Compare
I turn it ready for reviewing, and get some questions for discuss:
|
5024350
to
54866bf
Compare
54866bf
to
21cbf96
Compare
Ping, I'm really looking forward to this. Are these on track to be available soon? |
@Counted("example.with.static.attributes.count") | ||
@StaticAttribute(name = "key1", value = "value1") | ||
@StaticAttribute(name = "key2", value = "value2") | ||
@StaticAttribute(name = "key2", value = "value2") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 32 and 33 are the same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for late reply, I went to a family travel last week and come back just now. I think it's testing the key overlay case, so change it to:
@Counted("example.with.static.attributes.count")
@StaticAttribute(name = "key1", value = "value1")
@StaticAttribute(name = "key2", value = "value3")
@StaticAttribute(name = "key2", value = "value2")
and for TimedExample, change it to:
@Timed(name = "example.with.static.attributes.duration")
@StaticAttribute(name = "key1", value = "value1")
@StaticAttribute(name = "key2", value = "value3")
@StaticAttribute(name = "key2", value = "value2")
public void exampleWithStaticAttributes() {}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM for the renaming of value
to name
@Override | ||
public <REQUEST, RESPONSE> Object end( | ||
Instrumenter<REQUEST, RESPONSE> instrumenter, | ||
AsyncOperationCallback<REQUEST, RESPONSE> handler, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for continuing of this.
I still have doubts about these async interfaces and how generic their names are.
This line is a perfect example of the problem. The interface is AsyncOperationCallback
but we end up calling the attribute handler
because it's more convenient but too abstract to actually mean anything in the code. What is it handling? business logic, telemetry?
If we cannot use the name of the interface as a name of an instance in the code, something is wrong.
On this comment #11354 (comment),
@Duncan-tree-zhou suggested AsyncEndHandler
or AsyncCallback#onEnd
and we ended up with AsyncOperationCallback#onEnd
. In my mind I always ask: AsyncOperationCallback
why? To where?
We also have AsyncOperationEndStrategy.java, AsyncOperationEndSupport
If we look at the package name:
io.opentelemetry.instrumentation.api.annotation.support.async.AsyncOperationCallback
, it already includes async
.
Probably we need some brainstorm around these names and what they actually do. Imagine some newbie looking at code using this... At first glance it doesn't seem related with telemetry.
What if we use one of:
InstrumentationCallback
TelemetryCallback
TelemetryObserver
I think InstrumentationCallback
better aligns with the current OTel practice and also answer: why we do the callback and to where.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…e we don't have test task on it.
* <p>By default, the Counter instrument will have the following attributes: | ||
* | ||
* <ul> | ||
* <li><b>code.namespace:</b> The fully qualified name of the class whose method is invoked. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm really looking forward for this to be merged. However I've noticed that code.namespace
and code.function
have been deprecated in the semantic conventions and has been replaced by code.function.name
in the which is the fully qualified name. Should this be updated in this PR as well?
refer to #7030
add metric annotation instrumentation