-
Notifications
You must be signed in to change notification settings - Fork 4
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
Dev #3
base: master
Are you sure you want to change the base?
Dev #3
Conversation
rewrote to Azure Bindings Changed filter strategy
rewrote to Azure Bindings Changed filter strategy
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 Michael, I've added some comments below. Please feel free to reach out to me for clarification on any of these points.
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/> | ||
<transformer | ||
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> | ||
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/> |
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.
Please make sure you're shipping a LICENSE.txt and NOTICE.txt along with the existing artifacts. You can find several examples of how this is done in the pom.xml from our recent extensions (Netscaler is a good reference)
|
||
@Override | ||
public String getMonitorName() { | ||
return "Azure Monitoring Extension"; |
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.
"Azure Monitoring Extension" can also go to the Constants class, just like the Default Metric Prefix above.
else { logger.error("The config.yml is not loaded due to previous errors.The task will not run"); } | ||
@Override | ||
protected void doRun(TasksExecutionServiceProvider tasksExecutionServiceProvider) { | ||
List<Map<String,?>> subscriptions = (List<Map<String,?>>)getContextConfiguration().getConfigYml().get("subscriptions"); |
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.
A cleaner approach would be to create a global called configYml, for example, and fetching it from the MonitorContextConfiguration once. I see you've done it several times. You can then use this configYml object to get your subscriptions, serviceFabrics etc.
private final MetricWriteHelper metricWriteHelper; | ||
private final Map<String, ?> subscription; | ||
private final List<Map<String,?>> resourceGroupFilters; | ||
private final CountDownLatch countDownLatch; |
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 a little unclear as to why this CountDownLatch is required. I see you've created another one on line 65 that covers your Azure resources. What is the benefit of having this additional one?
String currentResourceTypeFilter = resourceTypeFilter.get("resourceType").toString(); | ||
AzureMetrics azureMetricsTask = new AzureMetrics( | ||
resourceFilter, | ||
currentResourceGroupFilter, |
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 a very expensive operation (n ^ 4). I understand why it is that way, looking at the current hierarchy in your config.yml but I'm wondering if this can be done more efficiently. Any thoughts?
logger.debug("Metric List is empty"); | ||
} | ||
} else { | ||
metricWriteHelper.transformAndPrintMetrics(finalMetricList); |
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.
We have started publishing a 'Heart Beat' metric per configured instance. It's a 0/1 metric that prints 0 in case of an error/connectivity issues etc and 1 in case of successful metric collection. You can refer to the Netscaler Extension for how this is done.
public class Constants { | ||
public static final String DEFAULT_METRIC_PREFIX = "Custom Metrics|AzureMonitor|"; | ||
public static final String METRIC_SEPARATOR = "|"; | ||
public static Azure.Authenticated azureMonitorAuth = null; |
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.
Is this line needed?
* The copyright notice above does not evidence any actual or intended publication of such source code. | ||
* | ||
*/ | ||
|
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 test class is not needed at all. It does not test anything whatsoever.
* The copyright notice above does not evidence any actual or intended publication of such source code. | ||
* | ||
*/ | ||
|
||
package com.appdynamics.monitors.azure; | ||
|
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 should be comprehensive unit tests for your AzureMetricsProcessor, as that's where most of the heavy lifting is happening. You'll probably have to mock a connection to the Azure API and create some dummy data in your test resources. Again, the Netscaler extension is a good reference point.
try { | ||
url = new URL(input); | ||
} catch (MalformedURLException e) { | ||
logger.error("Error forming our from String {}", input, e); |
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.
"Error forming our URL from String {}".
…be sent when using dimensions as well
No description provided.