Skip to content
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

Elastic agent status report endpoint #4164

Merged

Conversation

GaneshSPatil
Copy link
Contributor

@GaneshSPatil GaneshSPatil commented Jan 8, 2018

TO BE MERGED for 18.2

Done
  • Add a route to display agent status report page for each elastic agent
  • Redirect to agent status report page from build details page
Pending
  • Replace/Add a link from agent details page to agent status report (only for elastic agents).

@GaneshSPatil GaneshSPatil added this to the Release 18.2 milestone Jan 8, 2018
Copy link
Contributor

@bdpiprava bdpiprava left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -32,16 +32,27 @@ def show
render_plugin_error e
end

def show
@view_title = 'Plugin Status Report'
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we change it to Agent status report(agentid) ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, should the actions be agent_status and plugin_status over index and show?

@@ -29,7 +29,11 @@
<span>Not yet assigned</span>
{/if}
#if ( $elasticProfilePluginId && $userHasAdministratorRights )
<a href="$req.getContextPath()/admin/status_reports/$elasticProfilePluginId" class="btn-primary btn-small status-report-btn-small">Check Plugin Status</a>
{if build.build_assigned_date != -1}
Copy link
Contributor

Choose a reason for hiding this comment

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

@gocd/committers --- With this implementation if plugin has not implemented agent-status-report call it will raise UnhandledRequestTypeException. We will update the document saying both the call is mandatory if plugin supports status_report capability. Is this okay ?

@ketan
Copy link
Member

ketan commented Jan 8, 2018 via email

def show
@view_title = 'Plugin Status Report'
@page_header = 'Plugin Status Report'
@agent_status_report = elastic_agent_extension.getAgentStatusReport(params[:plugin_id], params[:elastic_agent_id])
Copy link
Contributor

Choose a reason for hiding this comment

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

What should be the behaviour when an agent is not assigned?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@maheshp -- If the job is not assigned yet, it shows the plugin status report instead of Agent Status Report button. The check is done here

Going forward, we will add Errors and Warnings sections to the EA endpoint, which will tell errors regarding agent, job assignment failure, cluster, etc.

Copy link
Contributor

Choose a reason for hiding this comment

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

Please correct me if I am wrong. I thought an agent status report would be more useful in cases where an agent is not yet assigned. I thought the plugin through the agent status report should be able to answer questions around the status of the agent creation, wouldn't this be possible since we send the job identifier to the plugin.

@GaneshSPatil
Copy link
Contributor Author

Changes done as part of the current PR:

  • Introduce Agent Status Report endpoint

    • Add agent-status-report endpoint in Elastic Agent Extension V2
    • Following information is sent to plugin as part of request body
      • Elastic Agent Id
      • Job Identifier
  • Define route for Agent Status Report Page

    • Using Elastic Agent ID
      Route URL: /go/admin/status_reports/<PLUGIN_ID>/<ELASTIC_AGENT_ID>
    • Using Job ID (in case of elastic agent id is not available)
      Route URL: /go/admin/status_reports/<PLUGIN_ID>/unassigned?job_id=<JOB_ID>

Note: Based on the information available in the context from which the agent-status-report page is referred, either one of the elastic_agent_id or job_identifier field will be sent to plugin as part of request body.

@bdpiprava bdpiprava changed the title [WIP] Elastic agent status report endpoint Elastic agent status report endpoint Jan 31, 2018
@bdpiprava bdpiprava force-pushed the elastic-agent-status-report-endpoint branch 6 times, most recently from cc3ad6a to 3be6fbe Compare February 9, 2018 12:42
GaneshSPatil and others added 14 commits February 15, 2018 07:53
* In case of job being assigned to an agent, show 'Check Agent Status' button which will redirect to elastic agent status report page
* In case of job not being assigned yet, show 'Check Plugin Status' button which will redirect to plugin status report page
* Show status report link only for elastic agents
* Show original agent job history page link in case of plugin doesn't support status reports
* Rename method from index and show to plugin_status and agent_status respectively
* Fix view title and page header
* Change the agent-status-report page to include job_id as route instead of elastic_agent_id
* Agent status report request receives elastic_agent_id and job_identifier as part of request body
* If the job is not yet assigned, the elastic_agent_id field will be null
* The route url for agent status report is '/go/admin/status_reports/<ELASTIC_PLUGIN_ID>/<JOB_ID>'
@bdpiprava bdpiprava force-pushed the elastic-agent-status-report-endpoint branch from 3be6fbe to 478dde1 Compare February 15, 2018 02:24
@sheroy sheroy mentioned this pull request Feb 15, 2018
36 tasks
@varshavaradarajan varshavaradarajan merged commit 5169983 into gocd:master Feb 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants