-
Notifications
You must be signed in to change notification settings - Fork 872
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
Add Apolloconfig Inst #12794
base: main
Are you sure you want to change the base?
Add Apolloconfig Inst #12794
Conversation
8e921aa
to
e6ad0ff
Compare
instrumentation/apolloconfig/apolloconfig-2.0.0/javaagent/build.gradle.kts
Outdated
Show resolved
Hide resolved
instrumentation/apolloconfig/apolloconfig-2.0.0/javaagent/build.gradle.kts
Outdated
Show resolved
Hide resolved
...lemetry/javaagent/instrumentation/apolloconfig/v2_0_0/ApolloConfigInstrumentationModule.java
Outdated
Show resolved
Hide resolved
...a/io/opentelemetry/javaagent/instrumentation/apolloconfig/v2_0_0/ApolloConfigSingletons.java
Outdated
Show resolved
Hide resolved
...in/java/io/opentelemetry/instrumentation/apolloconfig/v2_0_0/ApolloRepositoryChangeTest.java
Outdated
Show resolved
Hide resolved
...lemetry/javaagent/instrumentation/apolloconfig/v2_0_0/ApolloConfigInstrumentationModule.java
Outdated
Show resolved
Hide resolved
return; | ||
} | ||
|
||
context = instrumenter().start(parentContext, namespace); |
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.
perhaps instead of spans this should be modeled as events?
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.
The logic of this library is roughly as follows
- watch ( http long pull. etc. )
- notify (Our current advise point)
- listener1:spring env update
- listener2:spring event
- listener3:user custom,may have call
- ...
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.
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.
an event sounds like a good option here
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 am not very familiar with event signals, which look like logs. I am not sure whether to remove span and replace it with event or add an event based on span.
If it is just one line of event log, I don't think it is helpful. The detailed background is as follows #12787 (comment)
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.
it looks like this has been added to today's Java APAC-friendly meeting, let's chat then
...try/javaagent/instrumentation/apolloconfig/v2_0_0/ApolloRepositoryChangeInstrumentation.java
Outdated
Show resolved
Hide resolved
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.
Don't forget to add the framework to document.
031bb5f
to
f657fc4
Compare
...a/io/opentelemetry/javaagent/instrumentation/apolloconfig/v1_0_0/ApolloConfigSingletons.java
Outdated
Show resolved
Hide resolved
...lemetry/javaagent/instrumentation/apolloconfig/v1_0_0/ApolloConfigInstrumentationModule.java
Outdated
Show resolved
Hide resolved
392c710
to
8b836ae
Compare
Sorry, this is related hyperlink, you can check it out. |
8b836ae
to
0e437e7
Compare
...aagent/instrumentation/apolloconfig/apolloclient/v1_1/ApolloConfigInstrumentationModule.java
Outdated
Show resolved
Hide resolved
0e437e7
to
f75200a
Compare
...lemetry/javaagent/instrumentation/apolloconfig/apolloclient/v1_0/ApolloConfigSingletons.java
Outdated
Show resolved
Hide resolved
...lemetry/javaagent/instrumentation/apolloconfig/apolloclient/v1_0/ApolloConfigSingletons.java
Outdated
Show resolved
Hide resolved
...try/javaagent/instrumentation/apolloconfig/apolloclient/v1_0/ApolloRepositoryChangeTest.java
Outdated
Show resolved
Hide resolved
...try/javaagent/instrumentation/apolloconfig/apolloclient/v1_0/ApolloRepositoryChangeTest.java
Show resolved
Hide resolved
...try/javaagent/instrumentation/apolloconfig/apolloclient/v1_0/ApolloRepositoryChangeTest.java
Outdated
Show resolved
Hide resolved
instrumentation/apolloconfig-apolloclient-1.0/javaagent/build.gradle.kts
Outdated
Show resolved
Hide resolved
instrumentation/apolloconfig-apolloclient-1.0/javaagent/build.gradle.kts
Outdated
Show resolved
Hide resolved
instrumentation/apolloconfig-apolloclient-1.0/javaagent/build.gradle.kts
Outdated
Show resolved
Hide resolved
@AutoService(InstrumentationModule.class) | ||
public class ApolloConfigInstrumentationModule extends InstrumentationModule { | ||
public ApolloConfigInstrumentationModule() { | ||
super("apolloconfig-apolloclient", "apolloconfig-apolloclient-1.0"); |
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.
maybe apolloconfig-client
? I guess the package name and module name could also be adjusted accordingly.
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.
...lemetry/javaagent/instrumentation/apolloconfig/apolloclient/v1_0/ApolloConfigSingletons.java
Outdated
Show resolved
Hide resolved
...aagent/instrumentation/apolloconfig/apolloclient/v1_0/ApolloConfigInstrumentationModule.java
Show resolved
Hide resolved
de53eb9
to
310cb41
Compare
310cb41
to
b69e561
Compare
@Advice.Local("otelContext") Context context, | ||
@Advice.Local("otelScope") Scope scope) { | ||
Context parentContext = currentContext(); | ||
String repeat = parentContext.get(REPOSITORY_CHANGE_REPEAT_CONTEXT_KEY); |
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.
usually we use CallDepth
to instrument only the outer most call, see
Line 78 in 57c7cf2
callDepth = CallDepth.forClass(Path.class); |
library("com.ctrip.framework.apollo:apollo-client:1.0.0") | ||
|
||
testImplementation("com.ctrip.framework.apollo:apollo-client:1.1.0") | ||
testImplementation(project(":testing-common")) |
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.
you don't need to add explicit dependency to testing-common
, it is already added elsewhere
|
||
library("com.ctrip.framework.apollo:apollo-client:1.0.0") | ||
|
||
testImplementation("com.ctrip.framework.apollo:apollo-client:1.1.0") |
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.
You could use testCompileOnly("com.ctrip.framework.apollo:apollo-client:1.1.0")
that way tests would run with 1.0.0
. Then you will have to make TestConfigRepository
and TestRepositoryChangeListener
private to avoid junit looking for test methods there.
@Nullable Throwable error) {} | ||
}; | ||
|
||
INSTRUMENTER = |
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.
This was discussed at the sig meeting yesterday and the consensus was that events might be more appropriate for this use case. What do you think about creating an event instead of a span? If you plan to watch the recording of the sig meeting then this was discussed at the end of the meeting.
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 didn't quite understand the definition of events before. Is it this https://opentelemetry.io/docs/specs/otel/logs/event-api/
Is there a link about the meeting?
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.
See
Line 242 in 57c7cf2
eventLogger.builder(EVENT_NAME_INFO).setAttributes(builder.build()).emit(); |
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.
Thank you for your careful review. I took a quick look at the meeting and found some deviations. It is true that this framework is mainly popular in China. I will add some detailed explanations in the issue tomorrow.
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.
Hi, I added some information, hope it helps. #12787 (comment)
#12787
First commit, please help review