Skip to content

Conversation

@oleg-nenashev
Copy link
Member

@oleg-nenashev oleg-nenashev commented Aug 3, 2018

Version of #3557, but with a single LogStorage as proposed by @jglick . The previous implementation had separate LoggingMethod and LogBrowser implementation directly in the core, but with this change I will need to move it to External Logging API.

Proposed Changelog Entries

  • Major RFE: JENKINS-52692 - Developer: Introduce new LogStorage API and LogStorageFactory extension point
  • RFE: JENKINS-52867 - Developer: Introduce new API for deleting Run logs

Submitter checklist

  • JIRA issue is well described
  • Changelog entry appropriate for the audience affected by the change (users or developer, depending on the change). Examples
    * Use the Internal: prefix if the change has no user-visible impact (API, test frameworks, etc.)
  • Appropriate autotests or explanation to why this change has no tests
  • For dependency updates: links to external changelogs and, if possible, full diffs

@carlossg @jenkinsci/code-reviewers I will appreciate feedback about the preferred approach

Xing Yan and others added 29 commits September 17, 2016 11:42
…-task-logging-poc

# Conflicts:
#	core/src/main/java/hudson/model/AbstractProject.java
#	core/src/main/java/hudson/model/Job.java
#	core/src/main/java/hudson/model/Run.java
# Conflicts:
#	core/src/main/java/hudson/model/Job.java
#	core/src/main/java/hudson/model/Run.java
@oleg-nenashev oleg-nenashev added the work-in-progress The PR is under active development, not ready to the final review label Aug 3, 2018
@oleg-nenashev oleg-nenashev requested a review from jglick August 7, 2018 09:04
@oleg-nenashev
Copy link
Member Author

Test failures are unrelated - UC issues

@oleg-nenashev oleg-nenashev requested a review from carlossg August 9, 2018 12:59
@oleg-nenashev oleg-nenashev removed the work-in-progress The PR is under active development, not ready to the final review label Aug 9, 2018
@oleg-nenashev
Copy link
Member Author

@jenkinsci/cloud-native-sig I have addressed all comments in this change. Tests have been also added. IMO it is ready for review.

Copy link
Contributor

@carlossg carlossg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from my limited knowledge

Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main questions are about the relationship to jenkinsci/workflow-job-plugin#27 and specifically when and how the log storage is selected; see https://github.com/jenkinsci/workflow-api-plugin/pull/17/files#diff-1d162ef4f3f75e09c30e1f8e52e36b01R118.


// Produce correct logger
// TODO: Consider merging with create Launcher
l = getLogStorage().decorateLauncher(l, getBuild(), currentNode, listener);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should not need this.

* @throws InterruptedException Was interrupted while decorating listeners
*/
@Nonnull
public Launcher decorateLauncher(@Nonnull Launcher original,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove. I cannot foresee any reason why we would ever need this, even with external sinks implemented via external processes—these should not be touching the user process being launched.


/**
* Log storage associated with this build, if any.
* @since TODO
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for @since on private stuff, only public APIs.

}

if (logStorage == null) {
logStorage = new CompatFileLogStorage(this);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather keep it null and just return CompatFileLogStorage on demand so we do not touch the serial form unless you are actually using a nondefault implementation. Compare Run.getArtifactManager() vs. Run.artifactManager. You might need to introduce a pickLogStorage() correspondingly.

/**
* Returns {@code true} if the log file is no longer being updated.
*/
public boolean isLoggingFinished();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider isLoggingComplete (or isLoggingCompleted) by analogy with LargeText parameters?

@ExportedBean
public abstract class LogStorage<T extends Loggable> {

protected transient T loggable;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to delete this and pass a T to any method which might need it. Make this an interface while you are at it.

* @throws InterruptedException Operation was interrupted
*/
@Nonnull
public abstract AnnotatedLargeText<T> overallLog() throws IOException, InterruptedException;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename to getLogText for consistency with Run.

return gzF;
}
//If both fail, return the standard, uncompressed log file
return rawF;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider removing the historical gzip hacks and at best make this into a LogStorageFactory that detects log.gz existence for compatibility reasons (but never does this for new builds).

* @since TODO
*/
@Restricted(Beta.class)
public class NoopLogStorage extends LogStorage {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still in use?

* @since TODO
*/
@Restricted(Beta.class)
public abstract class StreamLogStorage extends LogStorage {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just delete it, since the hard parts are the read methods anyway; createBuildListener should become trivial.

Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A tip for killing StreamLogStorage.


// Global log filter
for (ConsoleLogFilter filter : ConsoleLogFilter.all()) {
logger = filter.decorateLogger(build, logger);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest moving this to a protected method in RunExecution

final Job<?, ?> project = build.getParent();

// Project specific log filters
if (project instanceof BuildableItemWithBuildWrappers && build instanceof AbstractBuild) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

…and then override that in AbstractBuildExecution, cleaning this mistake up at last.

WorkflowRun does not yet support ConsoleLogFilter.all() but that can be dealt with separately: https://github.com/jenkinsci/workflow-job-plugin/pull/27/files#diff-68f690dbd3fa2d9fb89d6af3f8fd7216R218

@oleg-nenashev oleg-nenashev added the work-in-progress The PR is under active development, not ready to the final review label Aug 11, 2018
* @since 1.349
*/
public @Nonnull InputStream getLogInputStream() throws IOException {
File logFile = getLogFile();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For more current ideas about these methods, see overloads in WorkflowRun edited during jenkinsci/workflow-job-plugin#114 etc.

@jglick
Copy link
Member

jglick commented Apr 2, 2019

This was abandoned and does not need to be left open.

@jglick jglick closed this Apr 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-more-reviews Complex change, which would benefit from more eyes work-in-progress The PR is under active development, not ready to the final review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants