Instana U

 View Only
Expand all | Collapse all

Get application stack through the API

  • 1.  Get application stack through the API

    Posted Mon September 11, 2023 03:33 AM

    Hi all,

    I'm trying to retrieve the whole application stack (AP > service > process > host) through the Instana API.

    Currently I'm using the following API requests:

    • {{baseURL}}/api/application-monitoring/applications?nameFilter=xxx

    • {{baseURL}}/api/application-monitoring/topology/services?applicationId=xxx&applicationBoundaryScope=ALL

    • {{baseURL}}/api/infrastructure-monitoring/topology

    With the result of the above API requests, I can retrieve all required entities. But I'm missing the link between service and process. 

    Does someone know which API endpoint can provide this missing link?

    Thanks in advance!



    ------------------------------
    Kind regards,
    Jurgen Roels
    Brussels, Belgium
    ------------------------------


  • 2.  RE: Get application stack through the API

    Posted Tue September 12, 2023 10:23 AM

    Hi Jurgen

    do you have more of such (good) questions? ;-) seriously ....

    I discussed with engineering and while we can do this in the UI, we do not currently expose this functionality in the API.

    However, if its a feature request, they would upvote it to put it one the agenda.

    Do you know AHA! https://automation-management.ideas.ibm.com/?project=INSTANA to add your RFE? If you prefer, I can add it for you, but customer requests have more weight ...

    Let me know? cheers

    Tom



    ------------------------------
    Tom Tammann
    ------------------------------



  • 3.  RE: Get application stack through the API
    Best Answer

    Posted Tue September 12, 2023 02:37 PM

    Hi Jurgen

    my colleague @Farhad Ferdowsian made me aware of the following (rather hidden) functionality.

    Use
    /api/application-monitoring/applications/services?includeSnapshotIds=true
    to get a list of Services AND their SnapshotIds,  then loop through the Snapshots with
    /api/infrastructure-monitoring/snapshots/:id

    the response will contain "plugins" which reveal the infra entities.

    And while a hidden feature, I could argue, that traversing the graph is rather expensive and a more "surgical" approach could be the right way, even if it takes a bit more effort...

    Best regards

    Tom



    ------------------------------
    Tom Tammann
    ------------------------------



  • 4.  RE: Get application stack through the API

    Posted Wed September 13, 2023 02:14 AM

    Thanks for the feedback @Tom Tammann!

    I've created the feature request: https://automation-management.ideas.ibm.com/ideas/INSTANA-I-1840

    In the meanwhile, I'll try to work with the workaround your colleague @Farhad Ferdowsian suggested.



    ------------------------------
    Kind regards,
    Jurgen Roels
    Brussels, Belgium
    ------------------------------



  • 5.  RE: Get application stack through the API

    Posted Wed September 13, 2023 09:02 AM

    Hi Jurgen

    talking more to engineers, my hunch that such a new feature is potentially very expensive (hence dangerous if put in the wrong hands ;-) ), could you please elaborate your use case and how you use the exported graph?

    Much appreciated!

    Tom



    ------------------------------
    Tom Tammann
    ------------------------------



  • 6.  RE: Get application stack through the API

    Posted Wed September 13, 2023 09:15 AM

    Hi Tom,

    What do you mean with 'dangerous if put in the wrong hands'?

    We would like to export the application stack to our own database. Afterwards, this data will be imported in another tool to construct a cmdb.

     



    ------------------------------
    Kind regards,
    Jurgen Roels
    Brussels, Belgium
    ------------------------------



  • 7.  RE: Get application stack through the API

    Posted Wed September 13, 2023 10:57 AM

    Apologies for my flippant remark. My experience tells me that users are not always aware on the implications of their actions/request (nor should they be theoretically). Still, if you have a huge graph AND exported it every second, it WILL tax the system. Other vendors sometimes charge per query etc. Instana promotes "fair use". I hope that makes sense.

    And cmdb makes total sense. Just for curiosity, will the further usage include security use cases and/or do you use ServiceNow? Should I connect you to a Product Manager for a deeper conversation?

    Best regards

    Tom



    ------------------------------
    Tom Tammann
    ------------------------------



  • 8.  RE: Get application stack through the API

    Posted Thu September 14, 2023 03:54 AM

    Hi Tom,

    Ok, that makes sense :) The goal is to execute this once a day or less. So the impact on the system should be limited. 

    I'll contact you via a direct message for more information, but a deeper converstation can always be interesting.



    ------------------------------
    Kind regards,
    Jurgen Roels
    Brussels, Belgium
    ------------------------------



  • 9.  RE: Get application stack through the API

    Posted 21 days ago
    Edited by Albert Chung 21 days ago

    Hi Jurgen,

    I am from Instana dev team.  I recently completed a feature where you can make an API call to retrieve all the Processes (with metrics) that are mapped to an application name or a service name.  Here are sample curl commands.

    Application Name -> Processes

    curl -XPOST https://foo-bar.instana.rocks/api/infrastructure-monitoring/analyze/entities -H "Content-Type: application/json" -H "authorization: apiToken $apiToken" -d '{"timeFrame":{"to":1718895396498,"windowSize":3600000},"tagFilterExpression":{"type":"TAG_FILTER","name":"application.name","operator":"EQUALS","entity":"NOT_APPLICABLE","value":"team x","tagDefinition":{"name":"application.name","type":"STRING","path":[{"label":"Others"},{"label":"application"},{"label":"name"}]}},"pagination":{"retrievalSize":20},"type":"process","metrics":[{"metric":"cpu.user","aggregation":"MEAN","label":"CPU Usage (User)"},{"metric":"mem.virtual","aggregation":"MEAN","label":"Virtual Memory"}],"order":{"by":"label","direction":"ASC"}}'

    Service Name -> Processes

    curl -XPOST https://foo-bar.instana.rocks/api/infrastructure-monitoring/analyze/entities -H "Content-Type: application/json" -H "authorization: apiToken $apiToken" -d '{"timeFrame":{"to":1718895396498,"windowSize":3600000},"tagFilterExpression":{"type":"TAG_FILTER","name":"service.name","operator":"EQUALS","entity":"NOT_APPLICABLE","value":"cart","tagDefinition":{"name":"service.name","type":"STRING","path":[{"label":"Others"},{"label":"service"},{"label":"name"}]}},"pagination":{"retrievalSize":20},"type":"process","metrics":[{"metric":"cpu.user","aggregation":"MEAN","label":"CPU Usage (User)"},{"metric":"mem.virtual","aggregation":"MEAN","label":"Virtual Memory"}],"order":{"by":"label","direction":"ASC"}}'

    This feature is currently behind a feature flag.  Can you tell me what is your tenant unit?  We can enable it for your TU so you can try it and provide feedback.

    Thanks,

    Albert



    ------------------------------
    Albert Chung
    ------------------------------



  • 10.  RE: Get application stack through the API

    Posted 21 days ago

    Also, I just learned today that this new capability could help you

    https://instana.github.io/openapi/#operation/getApplicationInfrastructure



    ------------------------------
    Tom Tammann
    ------------------------------