CLOUDSTACK-8677: Call-home functionality for CloudStack#625
Conversation
|
cloudstack-pull-rats #130 SUCCESS |
|
cloudstack-pull-requests #828 UNSTABLE |
There was a problem hiding this comment.
with the new style config (ConfigKey), this isn't needed is it? It should insert the default if it doesn't find the value.
There was a problem hiding this comment.
Hmm, I don't know. I wrote this code in 2014 and was that in there by now? I'm just doing this because I assumed it was still required.
Maybe @bhaisaab knows?
There was a problem hiding this comment.
@wido
@DaanHoogland is correct. DB query to insert new config items is not required now.
There was a problem hiding this comment.
But only if you use new style ConfigKey!
|
any way to verify this? |
There was a problem hiding this comment.
Is this resource as well closed? Do we want to close resources in exception path as well.
|
cloudstack-pull-rats #131 SUCCESS |
|
cloudstack-pull-requests #829 UNSTABLE |
|
cloudstack-pull-analysis #63 UNSTABLE |
|
cloudstack-pull-analysis #64 UNSTABLE |
There was a problem hiding this comment.
It seems we are using a singleton pattern here, but it seems not thread safe?
There was a problem hiding this comment.
Can you explain that a bit more? I think I'm missing some knowledge here
There was a problem hiding this comment.
@wido look at my comment at line 123. you are writing a field that can be written from several locations at once. It needs guarding against programmers not communicating while coding.
There was a problem hiding this comment.
It seems the purpose is to make only one instance of usagereporter available per process and so we added getInstance() method, where user calls the getInstance() to get the object reference, in that scenario,
- Make the constructor private. create the object only when s_instance is null. Otherwise, s_instance will be new reference with each new object creation.
- It seems we have two overloaded variants of getInstance, not sure which one is called and when to use?
- Then, if getInstance is called to get an instance of UsageReporter and is static, do we want to use lock getinstance code to make it critical section, synchronize and avoid race conditions, if multiple threads are calling getInstance at the same time, its like two threads using getInstance at the sametime first time to create an object.
|
@wido you are introducing two findbugs findings, can you look at those? |
|
@DaanHoogland I will. Although I don't understand why these are happening |
There was a problem hiding this comment.
A public (instance) constructor writes to a static variable. I think you can make the constructor private and assign the static from getInstance(). First check for null and then assign if needed or return the existing object.
public static UsageReporter getInstance(Map<String, String> configs) {
if (s_instance == null) {
s_instance = new UsageReporter(); //make sure it is private so it can only be called from here
s_instance.init(configs);
}
return s_instance;
}
|
cloudstack-pull-rats #135 SUCCESS |
|
cloudstack-pull-requests #833 UNSTABLE |
|
cloudstack-pull-analysis #68 UNSTABLE |
There was a problem hiding this comment.
so findbugs doesn't like my solution either and it is right ;)
new_instance = new UsageReporter();
new_instance.init(configs);
s_instance = new_instance;
would be better. maybe even in a synchronised block to prevent to synchronous call to getInstance resulting in two instances of a singleton present.
There was a problem hiding this comment.
Please add synchronized block or make that method synchronized for safety. That should address the warning reported by findbug.
|
cloudstack-pull-rats #150 SUCCESS |
|
cloudstack-pull-requests #848 UNSTABLE |
|
cloudstack-pull-analysis #83 UNSTABLE |
|
I still don't know why travis fails. It fails on a storage part, but this commit doesn't touch anything from the storage. So I can't see why. |
|
cloudstack-pull-rats #173 SUCCESS |
|
@wido not sure if these are related but please have a look at https://builds.apache.org/job/cloudstack-pull-analysis/83/org.apache.cloudstack$cloud-core/testReport/ |
|
@DaanHoogland I see, but I'm not even getting near that code. So it's unclear to me why this PR seems unstable. |
|
let's find out. it might reveal some totally unrelated problem due to .... I never saw the serialization tests before AFAIR but will look at them now ;) |
There was a problem hiding this comment.
cs.gson.version is defined a second time here.
|
I confirmed the problem in the failing test is in the newer gson version. Hope this works with the older gson. testing ... 1-2 to bad, it doesn't |
|
cloudstack-pull-analysis #106 UNSTABLE |
|
@DaanHoogland I need 2.3.1 for this patch to work. It builds with 2.3.1, but not with 1.7.2 |
|
cloudstack-pull-rats #174 SUCCESS |
|
cloudstack-pull-requests #872 UNSTABLE |
|
cloudstack-pull-analysis #107 UNSTABLE |
|
I just don't know why the tests keep failing on this one. They seem to fail on code not touched by this PR at all. Really want to get this in to 4.6. |
|
@wido I am pretty sure acs code has a problem with the new gson version (see https://builds.apache.org/job/cloudstack-pull-requests/872/org.apache.cloudstack$cloud-core/testReport/) |
|
@DaanHoogland You are right. There has been a change between GSON 1.7 and 2.0 which causes a failure of the tests. Looking into this, but my Java Reflecting knowledge is low and that makes it hard to figure this out. |
|
cloudstack-pull-rats #211 SUCCESS |
|
cloudstack-pull-requests #908 UNSTABLE |
|
cloudstack-pull-analysis #144 UNSTABLE |
|
I have create a issue regarding the new Gson version: https://issues.apache.org/jira/browse/CLOUDSTACK-8708 |
|
This will be turned ON by default ? |
|
@Runseb Yes, indeed. But the PR is not ready to merge yet, it's blocked by a GSON issue which I don't know how to resolve. This is what @DaanHoogland found out: "the gson issue is with primitive types. support was explicitely dropped and these are used in the tests. We should make sure they are not used in the real code and adjust the test. (ref PR625 and CLOUDSTACK-8708)" But yes, this should go on the ML and very, very clearly in the Release Notes. |
|
@wido can you implement this as a plugin instead of core feature? Also do we want cloudstack to report statistics on each run; I suggest to have it as a plugin with a small db entry (global setting or a separate db) to track the last time+version we sent the payload/report and we can report that on each upgrade and perform checks every time cloudstack runs. This also needs to have a global lock in case of multiple mgmt servers. |
|
@bhaisaab Isn't it already a plug-in? Don't know if the PR is the right way to discuss it, but I also want to know how many Instances and cloud is running. So not only on upgrades. So it can send diagnostics every 7 days (default) and that way we can see how clouds grow and such. We know the install data and after that we see the growth. |
c2eb3ec to
2a9117d
Compare
With this commit the Management Server will be default generate a anonymous Usage report every 7 (seven) days and submit this information back to the Apache CloudStack project. These anonymous reports do NOT contain any information about Instance names, subnets, etc. It only contains numbers about how CloudStack is being used. This information is vital for the project to gain more insight in how CloudStack is being used. Users can turn the reporting off by setting usage.report.interval to 0 (zero) More information: http://cloudstack.apache.org/call-home.html
|
|
||
| public class AtomicGsonAdapter extends TypeAdapter<AtomicLongMap> { | ||
|
|
||
| public AtomicLongMap<Object> read(JsonReader reader) throws IOException { |
There was a problem hiding this comment.
Hi @wido,
Why don't you turn this method "void", so you could remove the "return null;" line.
|
This will probably never merge. Closing for now. |
Co-authored-by: Pearl Dsilva <pearl.dsilva@shapeblue.com> Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
With this commit the Management Server will be default generate a anonymous Usage
report every 7 (seven) days and submit this information back to the Apache CloudStack project.
These anonymous reports do NOT contain any information about Instance names, subnets, etc. It only
contains numbers about how CloudStack is being used.
This information is vital for the project to gain more insight in how CloudStack is being used.
Users can turn the reporting off by setting usage.report.interval to 0 (zero)