-
Notifications
You must be signed in to change notification settings - Fork 130
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
Integration test activemq #1497
Integration test activemq #1497
Conversation
…ontrib into scraper-connect
refactor in a single method + reuse available port detect
use fixed port for container-to-container
"activemq.consumer.count", | ||
"The number of consumers currently reading from the broker.", | ||
"consumers", | ||
/* isMonotonic= */ false, |
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.
[for reviewer] isMonotonic=false was added due to updatedDefinition of asserSumWithAttributes.
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.
For all of the 3 metrics that are non-monotonic here I think it was probably a bug in the original test of the groovy version. The fact that they all have current
in their description means that they should represent a value that can go up or down, and thus can't be monotonic.
"activemq.producer.count", | ||
"The number of producers currently attached to the broker.", | ||
"producers", | ||
/* isMonotonic= */ false, |
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.
[for reviewer] isMonotonic=false was added due to updatedDefinition of asserSumWithAttributes.
"activemq.connection.count", | ||
"The total number of current connections.", | ||
"connections", | ||
/* isMonotonic= */ false, |
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.
[for reviewer] isMonotonic=false was added due to updatedDefinition of asserSumWithAttributes.
@@ -58,6 +77,9 @@ public static void main(String[] args) { | |||
} catch (IOException e) { | |||
System.err.println("Unable to connect " + e.getMessage()); | |||
System.exit(2); | |||
} catch (RuntimeException e) { | |||
e.printStackTrace(System.err); |
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.
Simple printing Exception message is not enough here. We lose a lot of information regarding the issue. Stacktrace is better
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.
Once we merge it will be good to update resources folder structure. I did not want to do too much in this PR.
return new GenericContainer<>( | ||
new ImageFromDockerfile() | ||
.withDockerfileFromBuilder( | ||
builder -> builder.from("apache/activemq-classic:5.18.6").build())) |
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.
[for reviewer] Updated activemq docker image to the most recent ActiveMQ Classic version (from rmohr/activemq:5.15.9 used in JMX Metric Gatherer)
} | ||
|
||
@SafeVarargs | ||
static void assertSumWithAttributes( |
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.
[for reviewer] This override method is added to support 'monotonic' flag and metric attributes at he same time.
@robsunday @SylvainJuge all good to merge here? thanks |
@trask yes, given there is no user of this yet there can't be any regression :-). |
thanks, @robsunday mentioned on slack that he may push one more update, will wait for his confirmation |
.withCopyFileToContainer( | ||
MountableFile.forClasspathResource("activemq/env"), "/opt/apache-activemq/bin/env") |
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.
can you add a comment why we need to customize activemq/env? thanks
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.
Finally I got rid of this file at all
Co-authored-by: SylvainJuge <763082+SylvainJuge@users.noreply.github.com>
@@ -10,11 +10,15 @@ rules: | |||
mapping: | |||
ProducerCount: | |||
metric: producer.count | |||
# Unit name inherited from activemq.groovy file. |
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.
[minor] for those adding a TODO
to make sure we don't forget about this could be nice (we are more likely to look for TODOs than read current definitions YAML files).
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.
Eventually we are going to use original *.yaml files from JMX Insights, right? I think we may not need to update this file and added these comments for informational purposes only. But if you have different opinion then I can add TODOs :-), not a problem.
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.
Yes, those are likely to remain "as is", and regarding their location having them in a dedicated folder might also make sense when we reorganize but it's another topic.
I'm just trying to not to forget about this, but a TODO here is probably not the best choice, it's probably better to add this to the issue where we listed all the supported systems for feature parity: open-telemetry/opentelemetry-java-instrumentation#12158 so I've updated it to ensure we don't forget about it.
// Overwrite default ActiveMQ configuration in order to let ActiveMQ use JMX options | ||
// stored in $ACTIVEMQ_JMX_OPTS env variable defined below |
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 not for this PR, but do you know if there is a way to avoid adding the whole env file as an alternative ? For example could an env variable be used instead ? Or maybe as we are in a containers the JAVA_TOOL_OPTIONS
might work as well.
Ideally if we don't have extra files to manage for those containers, the easier it gets to maintain them, even if I agree that this one does not seem very complicated.
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 is actually a very good point. Replacing file with JAVA_TOOL_OPTIONS was trivial and worked. '''env''' file was used in jmx-metrics and ported here, but really was not needed.
Great suggestion!
Removed env file and use JAVA_TOOL_OPTIONS instead to pass JMX options to ActiveMQ
@@ -30,7 +30,6 @@ protected GenericContainer<?> createTargetContainer(int jmxPort) { | |||
"https://tomcat.apache.org/tomcat-9.0-doc/appdev/sample/sample.war", | |||
"/usr/local/tomcat/webapps/ROOT.war") | |||
.build())) | |||
.withEnv("LOCAL_JMX", "no") |
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 is not needed for Tomcat.
Primary goal of this PR is to use JMX Metric Insight to gather ActiveMQ JMX properties while preserving compatibility with JMX Gatherer.
At the moment there are two lines of ActiveMQ product:
This test covers Classic line. Artemis line have different set of JMX attributes, so it should have separate yaml and test (nice summary of differences is here: https://www.datadoghq.com/blog/activemq-architecture-and-metrics/). Artemis support may be included in the future.
Assertions in the ActiveMQ integration test are copied from opentelemetry-java/contrib/jmx-metrics while activemq.yaml is taken from opentelemetry-java-instrumentation/jmx-metrics (JMX Metric Insight)
Minor changes were appiled to both of them. These changes are described as comments in the files.