-
Notifications
You must be signed in to change notification settings - Fork 108
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 Logz.io support #74
base: master
Are you sure you want to change the base?
Conversation
* fixing for travis tests * using foreach for Java7 support
Is it a must to support Java7 before merging? |
I'll do my best to merge #70 ASAP, in the meantime you can just rebase your branch over that one |
src/main/java/jenkins/plugins/logstash/persistence/LogstashIndexerDao.java
Outdated
Show resolved
Hide resolved
src/main/java/jenkins/plugins/logstash/LogstashConfiguration.java
Outdated
Show resolved
Hide resolved
src/main/java/jenkins/plugins/logstash/persistence/LogzioDao.java
Outdated
Show resolved
Hide resolved
src/main/java/jenkins/plugins/logstash/persistence/LogzioDao.java
Outdated
Show resolved
Hide resolved
src/main/java/jenkins/plugins/logstash/persistence/LogzioDao.java
Outdated
Show resolved
Hide resolved
src/main/java/jenkins/plugins/logstash/persistence/LogzioDao.java
Outdated
Show resolved
Hide resolved
src/test/java/jenkins/plugins/logstash/LogstashConfigurationMigrationTest.java
Outdated
Show resolved
Hide resolved
src/main/java/jenkins/plugins/logstash/persistence/LogzioDao.java
Outdated
Show resolved
Hide resolved
src/main/java/jenkins/plugins/logstash/persistence/LogzioDao.java
Outdated
Show resolved
Hide resolved
src/main/java/jenkins/plugins/logstash/persistence/LogzioDao.java
Outdated
Show resolved
Hide resolved
src/main/java/jenkins/plugins/logstash/persistence/LogzioDao.java
Outdated
Show resolved
Hide resolved
src/test/java/jenkins/plugins/logstash/persistence/LogzioDaoTest.java
Outdated
Show resolved
Hide resolved
@mwinter69 @jakub-bochenski Done. I did find a problem with |
@idohalevi I don't think synchronizing on the list is enough I see two approaches here:
One more problem I see with reusing the instance is: if an un-sendable message (one that is causing an exception in sendToLogzio) gets into the list it will be stuck there permanently blocking all builds from sending data. |
@jakub-bochenski @mwinter69 |
@idohalevi follow the changes here: https://github.com/jenkinsci/logstash-plugin/pull/71/files#diff-bddec744c0206f7f355a27d666bfda1f |
…into dev # Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit. update from upstream
add close method
@jakub-bochenski Done:) --- sorry for taking the time to handle this... |
No worries, thanks for taking the time to finish it |
src/main/java/jenkins/plugins/logstash/LogstashBuildWrapper.java
Outdated
Show resolved
Hide resolved
This shouldn't include the whole of #71, please just add the part required for the |
@jakub-bochenski |
remove unused methods
* return any cached but non-sent data back for persisting. | ||
* The return value of script is the payload to be persisted unless null. | ||
*/ | ||
public class LogstashScriptProcessor implements LogstashPayloadProcessor{ |
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 don't think you need this implmentation, just the interface
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.
Even the interface is not needed. Actually the complete #71 should be taken out of 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.
We need a close hook for the build. It's not available on master, so I suggested to use the same approach as #71
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.
What helps an interface when there is no implementation?
The close is added to the LogstashWriter in order to properly terminate the LogstashPayloadProcessor.
#71 modifies the ConsoleLogFilter to add the PayloadProcessor to the LogstashWriter.
There is nothing comparable 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.
How do you suggest we should continue with this?
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.
Let me try to explain again.
This code needs to perform actions on build close as per #74 (comment)
AFAIK we have currently no way to notify an IndexerDao
that a build has finished.
#71 added a way to do it, so I suggested to reuse the same approach.
Maybe at this point the best way to proceed is to forget about #71 and just add a way to notify the IndexerDao
.
We can worry about the overlap with #71 when/if it's merged
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.
#71 added a feature to close the LogstashWriter, which is specific to a build but it is not interacting with the Dao as the scriptprocessor is only used in the writer.
The dao is a kind of a singleton in Jenkins. We only create a new Dao, when we have a configuration change and the new will only be used for new builds.
If I understand it right the shipper has to be used in the dao. So when the writer calls dao.push which does the actual writing to the indexer, how does the dao know which shipper to use? I don't see any nice solution here other than having a dao per build. But this would be a change in concept how this plugin is working. The writer would hold the reference to the dao and can be easily closed.
This is a bigger change in how the plugin works.
But even then one will need synchronization as in pipeline jobs you also have parallel execution within a single build and thus concurrent calls to the list.
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, I think I meant the LogstashWriter instead of IndexerDao
The idea is to create a new shipper instance per build to avoid concurrency issues. Not sure if that would work for parallel stages in pipeline though.
On a different note: I'm rather busy lately and don't want to block it. I would be happy to accept whatever solution you and @idohalevi can agree on
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.
@jakub-bochenski @mwinter69
How do you suggest to continue?
* @param payload the JSON payload that has been constructed so far. | ||
* @return The formatted JSON object, can be null to ignore this payload. | ||
*/ | ||
JSONObject process(JSONObject payload) throws Exception; |
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 think we actually only need the finish() method, not process().
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.
@jakub-bochenski
Currently, finish()
uses process()
. How would you like it to be instead?
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.
AFAIR finish only uses process to call it with null arg. Anyhow check the comment above (#74 (comment)) it might make this point moot
I think it's still pulling in too much. Maybe an easier approach would be to take your original version and try to pick the needed changes onto it from scratch instead of trying to modify current state. |
} | ||
} |
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 revert the complete file to its original state. You just changed indentation.
No description provided.