Jump to content
c7aesa7r

Chrome memory leak on dispatchEvent

Recommended Posts

		const focusEvent = new FocusEvent('focus', {
			bubbles: true	
		});

		// Trigger the input value in the search box
		const inputEvent = new InputEvent('input', {
			bubbles: true
		});

        // Send enter
		const keyEvent = new KeyboardEvent('keydown', {
			code: 'Enter',
			key: 'Enter',
			keyCode: 13,
			view: window,
			bubbles: true
		});

		let search = document.querySelector('#side > div._1Ra05 > div > label > div > div._1awRl.copyable-text.selectable-text');

		function searchList(name = "") {
			try {
				search.textContent = name;
				search.dispatchEvent(focusEvent);
				search.dispatchEvent(inputEvent);
				search.dispatchEvent(keyEvent);

				search.removeEventListener('focus', focusEvent);
				search.removeEventListener('input', inputEvent);
				search.removeEventListener('keydown', keyEvent);

			} catch { console.log(error); };
		}

 

I'm using `puppeteer` and inside

await page.evaluate(async ({

I have a loop that calls the function searchList on each `100 ms`, the problem is the browser memory usage is growing constantly, after 30min its over 1GB of ram.

I discovered that whos causing it is the `search.dispatchEvent` lines, when i comment they, the memory does not increase.

I "tried" to solve it adding:
```                
search.removeEventListener('focus', focusEvent);
search.removeEventListener('input', inputEvent);
search.removeEventListener('keydown', keyEvent);
```

But it did not change anything in relation to the mem increasing over time, does someone have any idea what else i could try to stop or release the mem growing?

 

Obs: Copiei meu post do stackoverflow por isso está em ingles, se alguém poder ajudar agradeço.

Share this post


Link to post
Share on other sites

Bom eu vi que você explicou o que está acontecendo de problema mas não se atentou em explicar o funcionamento da sua logica e sua intensão relacionado a business acho que faltou saber qual o seu objetivo em disparar e chamar o método searchList a cada 100 ms sendo que explicou chamar um await mas ele não retorna uma promise? assim você estaria chamando varias vezes o método asyncronous de forma syncrono e nunca espera a resposta do método await sua explicação está muito confusa!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • By Rodrigo Biaggio
      Pessoal, alguém consegue me ajudar? Eu preciso pegar os dados de um array, mas não estou conseguindo. 
       
      <!DOCTYPE html> <!-- Inicio do html --> <html lang="pt"> <!-- Inicio do head --> <head> <meta charset="utf-8"> <script src='https://kit.fontawesome.com/a076d05399.js'></script> <link rel="icon" type="imagem/png" href="images/dynatrace.png" /> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"> <script src="https://unpkg.com/@popperjs/core@2/dist/umd/popper.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script src="https://unpkg.com/@popperjs/core@2"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script> <meta http-equiv="x-ua-compatible" content="ie=edge"> <!-- CSS Customizado --> <link href="css/ambiente-monitorado.css" rel="stylesheet"> </head> <!-- Fim do head --> <!-- Inicio do body --> <body> <header> <title>Dynatrace Managed</title> <!-- Inicio do nav fixado no topo--> <div id="nav"> <nav class="navbar navbar-inverse navbar-fixed-top"> <!-- Inicio div container-fluid --> <div class="container-fluid"> <div class="navbar-header"> <!-- Imagem do logo da Dynatrace a esquerda --> <a class="navbar-brand" href="#"><img id="imagem-logo-dynatrace" src="images/dynatrace.png" width="30px" height="30px" alt="Logo Principal" title="Logo Dynatrace"></a> </div> <!-- Inicio ul nav com opções das páginas --> <ul class="nav navbar-nav nav-custom"> <li><a href="index.html">Home</a></li> <li class="active"><a href="ambiente-monitorado.html">Ambientes Monitorados</a> <li><a href="arquitetura.html">Arquitetura Dynatrace</a></li> <li><a href="#">Downtime</a></li> <li><a href="#">Indicadores</a></li> <li><a href="como-funciona.html">Licenças</a></li> <li><a href="#">Métricas</a></li> </ul> <!-- Fim ul nav com opções das páginas --> <!-- Inicio ul nav da diretia, com search e login --> <ul class="nav navbar-nav navbar-right nav-custom"> <!-- Icone e botão login --> <li><a href="#"><span class="glyphicon glyphicon-log-in"></span> Login</a></li> <!-- Inicio form do search --> <form class="navbar-form navbar-left" action="/action_page.php"> <div class="input-group"> <!-- Input do search --> <input type="text" class="form-control" placeholder="Search" name="search"> <div class="input-group-btn"> <!-- Botão de submit do search --> <button class="btn btn-default" type="submit"> <!-- Icone do search --> <i class="glyphicon glyphicon-search"></i> </button> </div> <!-- Fim div input-group-btn --> </div> <!-- Fim div input-group --> </form> <!-- Fim form do search --> </ul> <!-- Fim ul nav da diretia, com search e login --> </div> <!-- Fim div container-fluid --> </nav> </div> <!-- Fim do nav fixado no topo--> </header> <div id="div-main"> <div id="div-botoes-pesquisa"> <button class="button-title btn btn-info" id="button-buscar-licencas-ambiente" data-toggle="tooltip" aria-pressed="false"><i class="fas fa-bezier-curve fa-2x" aria-hidden="true" title="Por Ambiente"></i></button> <button class="button-title btn btn-info" id="button-buscar-licencas-servidor"><i class="fas fa-server fa-2x" aria-hidden="true" title="Por Servidor"></i></button><br><br> <input class="form-control mr-sm-2" type="text" id="input-search-host-group" name="filtro" placeholder="Filtrar"> </div> <div id="div-mostra-total-licencas"></div> <div id="div-table-licencas" class="div-table-licencas table-responsive"> <table class="table table-striped table-hover table-bordered" id="table-licencas"> <thead> <tr> <th class="linha-titulo-tabela">Problema</th> <th class="linha-titulo-tabela">Camada Impactada</th> <th class="linha-titulo-tabela">Status</th> <th class="linha-titulo-tabela">Tipo Erro</th> <th class="linha-titulo-tabela">Usuários Impactados</th> </tr> </thead> <tbody id="table-body"> </tbody> </table> </div> <div id="demo"></div> </div> <script src="js/api-get-problems.js"></script> <script src="js/disable-button.js"></script> <script src="js/filtrar-search-licencas.js"></script> </body> <!-- Fim do body --> </html> <!-- Fim do html --> $(document).ready(function() { const Url=''; $("#button-buscar-licencas-ambiente").click(function(){ $.ajax({ url: Url, type:"GET", success: function(result){ console.log(result); var problema = result.problems; var userimpactado = result.problems.impactAnalysis; $.each(problema, function(i, value) { console.log('The value at arr[' + i + '] is: ' + value.displayId); var newRow = $('<tr class="linha-table">'); var cols = ""; cols += '<td class="displayId" id="displayId">' + value.displayId + '</td>'; cols += '<td class="impactLevel" id="impactLevel">' + value.impactLevel + '</td>'; cols += '<td class="status" id="status">' + value.status + '</td>'; cols += '<td class="title" id="title">' + value.title + '</td>'; cols += '<td class="estimatedAffectedUsers" id="estimatedAffectedUsers">' + value.impactAnalysis.impacts.estimatedAffectedUsers + '</td>'; newRow.append(cols); $("#table-licencas").append(newRow); }); }, error:function(error){ console.log('Error ${error}') } }); }); }); Preciso pegar as informações dos campos 
      estimatedAffectedUsers:  numberOfPotentiallyAffectedServiceCalls:    Cada value.displayId pode ter 1 ou mais impactedEntity.   impactAnalysis: {
      impacts: [
      {
      impactType: "SERVICE",
      impactedEntity: {
      entityId: {
      id: "SERVICE-034769111916BA3B",
      type: "SERVICE"
      },
      name: ""
      },
      estimatedAffectedUsers: 0,
      numberOfPotentiallyAffectedServiceCalls: 4496
      },
      {
      impactType: "APPLICATION",
      impactedEntity: {
      entityId: {
      id: "APPLICATION-A8D06FDBBA2EE7F6",
      type: "APPLICATION"
      },
      name: ""
      },
      estimatedAffectedUsers: 2
      },
      {
      impactType: "SERVICE",
      impactedEntity: {
      entityId: {
      id: "SERVICE-B7A98E7FDD81118A",
      type: "SERVICE"
      },
      name: "online-importer-server-v*"
      },
      estimatedAffectedUsers: 0,
      numberOfPotentiallyAffectedServiceCalls: 775
      },
      {
      impactType: "SERVICE",
      impactedEntity: {
      entityId: {
      id: "SERVICE-D773255CD13D8968",
      type: "SERVICE"
      },
      name: ""
      },
      estimatedAffectedUsers: 1,
      numberOfPotentiallyAffectedServiceCalls: 34
      }
      ]  
    • By Rodrigo Biaggio
      Pessoal, alguém consegue me ajudar? Eu preciso pegar os dados de um array, mas não estou conseguindo. 
       
      <!DOCTYPE html> <!-- Inicio do html --> <html lang="pt"> <!-- Inicio do head --> <head> <meta charset="utf-8"> <script src='https://kit.fontawesome.com/a076d05399.js'></script> <link rel="icon" type="imagem/png" href="images/dynatrace.png" /> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"> <script src="https://unpkg.com/@popperjs/core@2/dist/umd/popper.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script src="https://unpkg.com/@popperjs/core@2"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script> <meta http-equiv="x-ua-compatible" content="ie=edge"> <!-- CSS Customizado --> <link href="css/ambiente-monitorado.css" rel="stylesheet"> </head> <!-- Fim do head --> <!-- Inicio do body --> <body> <header> <title>Dynatrace Managed</title> <!-- Inicio do nav fixado no topo--> <div id="nav"> <nav class="navbar navbar-inverse navbar-fixed-top"> <!-- Inicio div container-fluid --> <div class="container-fluid"> <div class="navbar-header"> <!-- Imagem do logo da Dynatrace a esquerda --> <a class="navbar-brand" href="#"><img id="imagem-logo-dynatrace" src="images/dynatrace.png" width="30px" height="30px" alt="Logo Principal" title="Logo Dynatrace"></a> </div> <!-- Inicio ul nav com opções das páginas --> <ul class="nav navbar-nav nav-custom"> <li><a href="index.html">Home</a></li> <li class="active"><a href="ambiente-monitorado.html">Ambientes Monitorados</a> <li><a href="arquitetura.html">Arquitetura Dynatrace</a></li> <li><a href="#">Downtime</a></li> <li><a href="#">Indicadores</a></li> <li><a href="como-funciona.html">Licenças</a></li> <li><a href="#">Métricas</a></li> </ul> <!-- Fim ul nav com opções das páginas --> <!-- Inicio ul nav da diretia, com search e login --> <ul class="nav navbar-nav navbar-right nav-custom"> <!-- Icone e botão login --> <li><a href="#"><span class="glyphicon glyphicon-log-in"></span> Login</a></li> <!-- Inicio form do search --> <form class="navbar-form navbar-left" action="/action_page.php"> <div class="input-group"> <!-- Input do search --> <input type="text" class="form-control" placeholder="Search" name="search"> <div class="input-group-btn"> <!-- Botão de submit do search --> <button class="btn btn-default" type="submit"> <!-- Icone do search --> <i class="glyphicon glyphicon-search"></i> </button> </div> <!-- Fim div input-group-btn --> </div> <!-- Fim div input-group --> </form> <!-- Fim form do search --> </ul> <!-- Fim ul nav da diretia, com search e login --> </div> <!-- Fim div container-fluid --> </nav> </div> <!-- Fim do nav fixado no topo--> </header> <div id="div-main"> <div id="div-botoes-pesquisa"> <button class="button-title btn btn-info" id="button-buscar-licencas-ambiente" data-toggle="tooltip" aria-pressed="false"><i class="fas fa-bezier-curve fa-2x" aria-hidden="true" title="Por Ambiente"></i></button> <button class="button-title btn btn-info" id="button-buscar-licencas-servidor"><i class="fas fa-server fa-2x" aria-hidden="true" title="Por Servidor"></i></button><br><br> <input class="form-control mr-sm-2" type="text" id="input-search-host-group" name="filtro" placeholder="Filtrar"> </div> <div id="div-mostra-total-licencas"></div> <div id="div-table-licencas" class="div-table-licencas table-responsive"> <table class="table table-striped table-hover table-bordered" id="table-licencas"> <thead> <tr> <th class="linha-titulo-tabela">Problema</th> <th class="linha-titulo-tabela">Camada Impactada</th> <th class="linha-titulo-tabela">Status</th> <th class="linha-titulo-tabela">Tipo Erro</th> <th class="linha-titulo-tabela">Usuários Impactados</th> </tr> </thead> <tbody id="table-body"> </tbody> </table> </div> <div id="demo"></div> </div> <script src="js/api-get-problems.js"></script> <script src="js/disable-button.js"></script> <script src="js/filtrar-search-licencas.js"></script> </body> <!-- Fim do body --> </html> <!-- Fim do html --> $(document).ready(function() { const Url=''; $("#button-buscar-licencas-ambiente").click(function(){ $.ajax({ url: Url, type:"GET", success: function(result){ console.log(result); var problema = result.problems; var userimpactado = result.problems.impactAnalysis; $.each(problema, function(i, value) { console.log('The value at arr[' + i + '] is: ' + value.displayId); var newRow = $('<tr class="linha-table">'); var cols = ""; cols += '<td class="displayId" id="displayId">' + value.displayId + '</td>'; cols += '<td class="impactLevel" id="impactLevel">' + value.impactLevel + '</td>'; cols += '<td class="status" id="status">' + value.status + '</td>'; cols += '<td class="title" id="title">' + value.title + '</td>'; cols += '<td class="estimatedAffectedUsers" id="estimatedAffectedUsers">' + value.impactAnalysis.impacts.estimatedAffectedUsers + '</td>'; newRow.append(cols); $("#table-licencas").append(newRow); }); }, error:function(error){ console.log('Error ${error}') } }); }); }); Preciso pegar as informações dos campos 
      estimatedAffectedUsers: 0, numberOfPotentiallyAffectedServiceCalls: 4496   Cada value.displayId pode ter 1 ou mais impactedEntity.
      impactAnalysis: {
      impacts: [
      {
      impactType: "SERVICE",
      impactedEntity: {
      entityId: {
      id: "SERVICE-034769111916BA3B",
      type: "SERVICE"
      },
      name: "alsb3-soa:80"
      },
      estimatedAffectedUsers: 0,
      numberOfPotentiallyAffectedServiceCalls: 4496
      },
      {
      impactType: "APPLICATION",
      impactedEntity: {
      entityId: {
      id: "APPLICATION-A8D06FDBBA2EE7F6",
      type: "APPLICATION"
      },
      name: "Meu Vivo PJ - Web"
      },
      estimatedAffectedUsers: 2
      },
      {
      impactType: "SERVICE",
      impactedEntity: {
      entityId: {
      id: "SERVICE-B7A98E7FDD81118A",
      type: "SERVICE"
      },
      name: "online-importer-server-v*"
      },
      estimatedAffectedUsers: 0,
      numberOfPotentiallyAffectedServiceCalls: 775
      },
      {
      impactType: "SERVICE",
      impactedEntity: {
      entityId: {
      id: "SERVICE-D773255CD13D8968",
      type: "SERVICE"
      },
      name: "Nginx-WebServer-MeuVivoEmpresas:443"
      },
      estimatedAffectedUsers: 1,
      numberOfPotentiallyAffectedServiceCalls: 34
      }
      ]
    • By Rodrigo Biaggio
      Pessoal, alguém consegue me ajudar? Eu preciso pegar os dados de um array, mas não estou conseguindo. 
       
      <!DOCTYPE html> <!-- Inicio do html --> <html lang="pt"> <!-- Inicio do head --> <head> <meta charset="utf-8"> <script src='https://kit.fontawesome.com/a076d05399.js'></script> <link rel="icon" type="imagem/png" href="images/dynatrace.png" /> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"> <script src="https://unpkg.com/@popperjs/core@2/dist/umd/popper.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script src="https://unpkg.com/@popperjs/core@2"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script> <meta http-equiv="x-ua-compatible" content="ie=edge"> <!-- CSS Customizado --> <link href="css/ambiente-monitorado.css" rel="stylesheet"> </head> <!-- Fim do head --> <!-- Inicio do body --> <body> <header> <title>Dynatrace Managed</title> <!-- Inicio do nav fixado no topo--> <div id="nav"> <nav class="navbar navbar-inverse navbar-fixed-top"> <!-- Inicio div container-fluid --> <div class="container-fluid"> <div class="navbar-header"> <!-- Imagem do logo da Dynatrace a esquerda --> <a class="navbar-brand" href="#"><img id="imagem-logo-dynatrace" src="images/dynatrace.png" width="30px" height="30px" alt="Logo Principal" title="Logo Dynatrace"></a> </div> <!-- Inicio ul nav com opções das páginas --> <ul class="nav navbar-nav nav-custom"> <li><a href="index.html">Home</a></li> <li class="active"><a href="ambiente-monitorado.html">Ambientes Monitorados</a> <li><a href="arquitetura.html">Arquitetura Dynatrace</a></li> <li><a href="#">Downtime</a></li> <li><a href="#">Indicadores</a></li> <li><a href="como-funciona.html">Licenças</a></li> <li><a href="#">Métricas</a></li> </ul> <!-- Fim ul nav com opções das páginas --> <!-- Inicio ul nav da diretia, com search e login --> <ul class="nav navbar-nav navbar-right nav-custom"> <!-- Icone e botão login --> <li><a href="#"><span class="glyphicon glyphicon-log-in"></span> Login</a></li> <!-- Inicio form do search --> <form class="navbar-form navbar-left" action="/action_page.php"> <div class="input-group"> <!-- Input do search --> <input type="text" class="form-control" placeholder="Search" name="search"> <div class="input-group-btn"> <!-- Botão de submit do search --> <button class="btn btn-default" type="submit"> <!-- Icone do search --> <i class="glyphicon glyphicon-search"></i> </button> </div> <!-- Fim div input-group-btn --> </div> <!-- Fim div input-group --> </form> <!-- Fim form do search --> </ul> <!-- Fim ul nav da diretia, com search e login --> </div> <!-- Fim div container-fluid --> </nav> </div> <!-- Fim do nav fixado no topo--> </header> <div id="div-main"> <div id="div-botoes-pesquisa"> <button class="button-title btn btn-info" id="button-buscar-licencas-ambiente" data-toggle="tooltip" aria-pressed="false"><i class="fas fa-bezier-curve fa-2x" aria-hidden="true" title="Por Ambiente"></i></button> <button class="button-title btn btn-info" id="button-buscar-licencas-servidor"><i class="fas fa-server fa-2x" aria-hidden="true" title="Por Servidor"></i></button><br><br> <input class="form-control mr-sm-2" type="text" id="input-search-host-group" name="filtro" placeholder="Filtrar"> </div> <div id="div-mostra-total-licencas"></div> <div id="div-table-licencas" class="div-table-licencas table-responsive"> <table class="table table-striped table-hover table-bordered" id="table-licencas"> <thead> <tr> <th class="linha-titulo-tabela">Problema</th> <th class="linha-titulo-tabela">Camada Impactada</th> <th class="linha-titulo-tabela">Status</th> <th class="linha-titulo-tabela">Tipo Erro</th> <th class="linha-titulo-tabela">Usuários Impactados</th> </tr> </thead> <tbody id="table-body"> </tbody> </table> </div> <div id="demo"></div> </div> <script src="js/api-get-problems.js"></script> <script src="js/disable-button.js"></script> <script src="js/filtrar-search-licencas.js"></script> </body> <!-- Fim do body --> </html> <!-- Fim do html --> $(document).ready(function() { const Url=''; $("#button-buscar-licencas-ambiente").click(function(){ $.ajax({ url: Url, type:"GET", success: function(result){ console.log(result); var problema = result.problems; var userimpactado = result.problems.impactAnalysis; $.each(problema, function(i, value) { console.log('The value at arr[' + i + '] is: ' + value.displayId); var newRow = $('<tr class="linha-table">'); var cols = ""; cols += '<td class="displayId" id="displayId">' + value.displayId + '</td>'; cols += '<td class="impactLevel" id="impactLevel">' + value.impactLevel + '</td>'; cols += '<td class="status" id="status">' + value.status + '</td>'; cols += '<td class="title" id="title">' + value.title + '</td>'; cols += '<td class="estimatedAffectedUsers" id="estimatedAffectedUsers">' + value.impactAnalysis.impacts.estimatedAffectedUsers + '</td>'; newRow.append(cols); $("#table-licencas").append(newRow); }); }, error:function(error){ console.log('Error ${error}') } }); }); }); Preciso pegar as informações dos campos 
      estimatedAffectedUsers: 0, numberOfPotentiallyAffectedServiceCalls: 4496   Cada value.displayId pode ter 1 ou mais impactedEntity.
      impactAnalysis: {
      impacts: [
      {
      impactType: "SERVICE",
      impactedEntity: {
      entityId: {
      id: "SERVICE-034769111916BA3B",
      type: "SERVICE"
      },
      name: "alsb3-soa:80"
      },
      estimatedAffectedUsers: 0,
      numberOfPotentiallyAffectedServiceCalls: 4496
      },
      {
      impactType: "APPLICATION",
      impactedEntity: {
      entityId: {
      id: "APPLICATION-A8D06FDBBA2EE7F6",
      type: "APPLICATION"
      },
      name: "Meu Vivo PJ - Web"
      },
      estimatedAffectedUsers: 2
      },
      {
      impactType: "SERVICE",
      impactedEntity: {
      entityId: {
      id: "SERVICE-B7A98E7FDD81118A",
      type: "SERVICE"
      },
      name: "online-importer-server-v*"
      },
      estimatedAffectedUsers: 0,
      numberOfPotentiallyAffectedServiceCalls: 775
      },
      {
      impactType: "SERVICE",
      impactedEntity: {
      entityId: {
      id: "SERVICE-D773255CD13D8968",
      type: "SERVICE"
      },
      name: "Nginx-WebServer-MeuVivoEmpresas:443"
      },
      estimatedAffectedUsers: 1,
      numberOfPotentiallyAffectedServiceCalls: 34
      }
      ]
    • By Rodrigo Biaggio
      Pessoal, alguém consegue me ajudar? Eu preciso pegar os dados de um array, mas não estou conseguindo. 
       
      <!DOCTYPE html> <!-- Inicio do html --> <html lang="pt"> <!-- Inicio do head --> <head> <meta charset="utf-8"> <script src='https://kit.fontawesome.com/a076d05399.js'></script> <link rel="icon" type="imagem/png" href="images/dynatrace.png" /> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"> <script src="https://unpkg.com/@popperjs/core@2/dist/umd/popper.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script src="https://unpkg.com/@popperjs/core@2"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script> <meta http-equiv="x-ua-compatible" content="ie=edge"> <!-- CSS Customizado --> <link href="css/ambiente-monitorado.css" rel="stylesheet"> </head> <!-- Fim do head --> <!-- Inicio do body --> <body> <header> <title>Dynatrace Managed</title> <!-- Inicio do nav fixado no topo--> <div id="nav"> <nav class="navbar navbar-inverse navbar-fixed-top"> <!-- Inicio div container-fluid --> <div class="container-fluid"> <div class="navbar-header"> <!-- Imagem do logo da Dynatrace a esquerda --> <a class="navbar-brand" href="#"><img id="imagem-logo-dynatrace" src="images/dynatrace.png" width="30px" height="30px" alt="Logo Principal" title="Logo Dynatrace"></a> </div> <!-- Inicio ul nav com opções das páginas --> <ul class="nav navbar-nav nav-custom"> <li><a href="index.html">Home</a></li> <li class="active"><a href="ambiente-monitorado.html">Ambientes Monitorados</a> <li><a href="arquitetura.html">Arquitetura Dynatrace</a></li> <li><a href="#">Downtime</a></li> <li><a href="#">Indicadores</a></li> <li><a href="como-funciona.html">Licenças</a></li> <li><a href="#">Métricas</a></li> </ul> <!-- Fim ul nav com opções das páginas --> <!-- Inicio ul nav da diretia, com search e login --> <ul class="nav navbar-nav navbar-right nav-custom"> <!-- Icone e botão login --> <li><a href="#"><span class="glyphicon glyphicon-log-in"></span> Login</a></li> <!-- Inicio form do search --> <form class="navbar-form navbar-left" action="/action_page.php"> <div class="input-group"> <!-- Input do search --> <input type="text" class="form-control" placeholder="Search" name="search"> <div class="input-group-btn"> <!-- Botão de submit do search --> <button class="btn btn-default" type="submit"> <!-- Icone do search --> <i class="glyphicon glyphicon-search"></i> </button> </div> <!-- Fim div input-group-btn --> </div> <!-- Fim div input-group --> </form> <!-- Fim form do search --> </ul> <!-- Fim ul nav da diretia, com search e login --> </div> <!-- Fim div container-fluid --> </nav> </div> <!-- Fim do nav fixado no topo--> </header> <div id="div-main"> <div id="div-botoes-pesquisa"> <button class="button-title btn btn-info" id="button-buscar-licencas-ambiente" data-toggle="tooltip" aria-pressed="false"><i class="fas fa-bezier-curve fa-2x" aria-hidden="true" title="Por Ambiente"></i></button> <button class="button-title btn btn-info" id="button-buscar-licencas-servidor"><i class="fas fa-server fa-2x" aria-hidden="true" title="Por Servidor"></i></button><br><br> <input class="form-control mr-sm-2" type="text" id="input-search-host-group" name="filtro" placeholder="Filtrar"> </div> <div id="div-mostra-total-licencas"></div> <div id="div-table-licencas" class="div-table-licencas table-responsive"> <table class="table table-striped table-hover table-bordered" id="table-licencas"> <thead> <tr> <th class="linha-titulo-tabela">Problema</th> <th class="linha-titulo-tabela">Camada Impactada</th> <th class="linha-titulo-tabela">Status</th> <th class="linha-titulo-tabela">Tipo Erro</th> <th class="linha-titulo-tabela">Usuários Impactados</th> </tr> </thead> <tbody id="table-body"> </tbody> </table> </div> <div id="demo"></div> </div> <script src="js/api-get-problems.js"></script> <script src="js/disable-button.js"></script> <script src="js/filtrar-search-licencas.js"></script> </body> <!-- Fim do body --> </html> <!-- Fim do html --> $(document).ready(function() { const Url=''; $("#button-buscar-licencas-ambiente").click(function(){ $.ajax({ url: Url, type:"GET", success: function(result){ console.log(result); var problema = result.problems; var userimpactado = result.problems.impactAnalysis; $.each(problema, function(i, value) { console.log('The value at arr[' + i + '] is: ' + value.displayId); var newRow = $('<tr class="linha-table">'); var cols = ""; cols += '<td class="displayId" id="displayId">' + value.displayId + '</td>'; cols += '<td class="impactLevel" id="impactLevel">' + value.impactLevel + '</td>'; cols += '<td class="status" id="status">' + value.status + '</td>'; cols += '<td class="title" id="title">' + value.title + '</td>'; cols += '<td class="estimatedAffectedUsers" id="estimatedAffectedUsers">' + value.impactAnalysis.impacts.estimatedAffectedUsers + '</td>'; newRow.append(cols); $("#table-licencas").append(newRow); }); }, error:function(error){ console.log('Error ${error}') } }); }); }); Preciso pegar as informações dos campos 
      estimatedAffectedUsers: 0, numberOfPotentiallyAffectedServiceCalls: 4496   Cada value.displayId pode ter 1 ou mais impactedEntity.
      impactAnalysis: 
        {
      impacts:    [   { impactType: "SERVICE", impactedEntity:    { entityId:    { id: "SERVICE-034769111916BA3B", type: "SERVICE" }, name: "" }, estimatedAffectedUsers: 0, numberOfPotentiallyAffectedServiceCalls: 4496 },   { impactType: "APPLICATION", impactedEntity:    { entityId:    { id: "APPLICATION-A8D06FDBBA2EE7F6", type: "APPLICATION" }, name: "Meu Vivo PJ - Web" }, estimatedAffectedUsers: 2 },   { impactType: "SERVICE", impactedEntity:    { entityId:    { id: "SERVICE-B7A98E7FDD81118A", type: "SERVICE" }, name: "online-importer-server-v*" }, estimatedAffectedUsers: 0, numberOfPotentiallyAffectedServiceCalls: 775 },   { impactType: "SERVICE", impactedEntity:    { entityId:    { id: "SERVICE-D773255CD13D8968", type: "SERVICE" }, name: "" }, estimatedAffectedUsers: 1, numberOfPotentiallyAffectedServiceCalls: 34 }
    • By Rodrigo Biaggio
      Pessoal, alguém consegue me ajudar? Eu preciso pegar os dados de um array, mas não estou conseguindo. 
       
      <!DOCTYPE html> <!-- Inicio do html --> <html lang="pt"> <!-- Inicio do head --> <head> <meta charset="utf-8"> <script src='https://kit.fontawesome.com/a076d05399.js'></script> <link rel="icon" type="imagem/png" href="images/dynatrace.png" /> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"> <script src="https://unpkg.com/@popperjs/core@2/dist/umd/popper.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script src="https://unpkg.com/@popperjs/core@2"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script> <meta http-equiv="x-ua-compatible" content="ie=edge"> <!-- CSS Customizado --> <link href="css/ambiente-monitorado.css" rel="stylesheet"> </head> <!-- Fim do head --> <!-- Inicio do body --> <body> <header> <title>Dynatrace Managed</title> <!-- Inicio do nav fixado no topo--> <div id="nav"> <nav class="navbar navbar-inverse navbar-fixed-top"> <!-- Inicio div container-fluid --> <div class="container-fluid"> <div class="navbar-header"> <!-- Imagem do logo da Dynatrace a esquerda --> <a class="navbar-brand" href="#"><img id="imagem-logo-dynatrace" src="images/dynatrace.png" width="30px" height="30px" alt="Logo Principal" title="Logo Dynatrace"></a> </div> <!-- Inicio ul nav com opções das páginas --> <ul class="nav navbar-nav nav-custom"> <li><a href="index.html">Home</a></li> <li class="active"><a href="ambiente-monitorado.html">Ambientes Monitorados</a> <li><a href="arquitetura.html">Arquitetura Dynatrace</a></li> <li><a href="#">Downtime</a></li> <li><a href="#">Indicadores</a></li> <li><a href="como-funciona.html">Licenças</a></li> <li><a href="#">Métricas</a></li> </ul> <!-- Fim ul nav com opções das páginas --> <!-- Inicio ul nav da diretia, com search e login --> <ul class="nav navbar-nav navbar-right nav-custom"> <!-- Icone e botão login --> <li><a href="#"><span class="glyphicon glyphicon-log-in"></span> Login</a></li> <!-- Inicio form do search --> <form class="navbar-form navbar-left" action="/action_page.php"> <div class="input-group"> <!-- Input do search --> <input type="text" class="form-control" placeholder="Search" name="search"> <div class="input-group-btn"> <!-- Botão de submit do search --> <button class="btn btn-default" type="submit"> <!-- Icone do search --> <i class="glyphicon glyphicon-search"></i> </button> </div> <!-- Fim div input-group-btn --> </div> <!-- Fim div input-group --> </form> <!-- Fim form do search --> </ul> <!-- Fim ul nav da diretia, com search e login --> </div> <!-- Fim div container-fluid --> </nav> </div> <!-- Fim do nav fixado no topo--> </header> <div id="div-main"> <div id="div-botoes-pesquisa"> <button class="button-title btn btn-info" id="button-buscar-licencas-ambiente" data-toggle="tooltip" aria-pressed="false"><i class="fas fa-bezier-curve fa-2x" aria-hidden="true" title="Por Ambiente"></i></button> <button class="button-title btn btn-info" id="button-buscar-licencas-servidor"><i class="fas fa-server fa-2x" aria-hidden="true" title="Por Servidor"></i></button><br><br> <input class="form-control mr-sm-2" type="text" id="input-search-host-group" name="filtro" placeholder="Filtrar"> </div> <div id="div-mostra-total-licencas"></div> <div id="div-table-licencas" class="div-table-licencas table-responsive"> <table class="table table-striped table-hover table-bordered" id="table-licencas"> <thead> <tr> <th class="linha-titulo-tabela">Problema</th> <th class="linha-titulo-tabela">Camada Impactada</th> <th class="linha-titulo-tabela">Status</th> <th class="linha-titulo-tabela">Tipo Erro</th> <th class="linha-titulo-tabela">Usuários Impactados</th> </tr> </thead> <tbody id="table-body"> </tbody> </table> </div> <div id="demo"></div> </div> <script src="js/api-get-problems.js"></script> <script src="js/disable-button.js"></script> <script src="js/filtrar-search-licencas.js"></script> </body> <!-- Fim do body --> </html> <!-- Fim do html --> $(document).ready(function() { const Url=''; $("#button-buscar-licencas-ambiente").click(function(){ $.ajax({ url: Url, type:"GET", success: function(result){ console.log(result); var problema = result.problems; var userimpactado = result.problems.impactAnalysis; $.each(problema, function(i, value) { console.log('The value at arr[' + i + '] is: ' + value.displayId); var newRow = $('<tr class="linha-table">'); var cols = ""; cols += '<td class="displayId" id="displayId">' + value.displayId + '</td>'; cols += '<td class="impactLevel" id="impactLevel">' + value.impactLevel + '</td>'; cols += '<td class="status" id="status">' + value.status + '</td>'; cols += '<td class="title" id="title">' + value.title + '</td>'; cols += '<td class="estimatedAffectedUsers" id="estimatedAffectedUsers">' + value.impactAnalysis.impacts.estimatedAffectedUsers + '</td>'; newRow.append(cols); $("#table-licencas").append(newRow); }); }, error:function(error){ console.log('Error ${error}') } }); }); }); Preciso pegar as informações dos campos 
      estimatedAffectedUsers: 0, numberOfPotentiallyAffectedServiceCalls: 4496   Cada value.displayId pode ter 1 ou mais impactedEntity.
      impactAnalysis: 
        {
      impacts:    [   { impactType: "SERVICE", impactedEntity:    { entityId:    { id: "SERVICE-034769111916BA3B", type: "SERVICE" }, name: "" }, estimatedAffectedUsers: 0, numberOfPotentiallyAffectedServiceCalls: 4496 },   { impactType: "APPLICATION", impactedEntity:    { entityId:    { id: "APPLICATION-A8D06FDBBA2EE7F6", type: "APPLICATION" }, name: "Meu Vivo PJ - Web" }, estimatedAffectedUsers: 2 },   { impactType: "SERVICE", impactedEntity:    { entityId:    { id: "SERVICE-B7A98E7FDD81118A", type: "SERVICE" }, name: "online-importer-server-v*" }, estimatedAffectedUsers: 0, numberOfPotentiallyAffectedServiceCalls: 775 },   { impactType: "SERVICE", impactedEntity:    { entityId:    { id: "SERVICE-D773255CD13D8968", type: "SERVICE" }, name: "" }, estimatedAffectedUsers: 1, numberOfPotentiallyAffectedServiceCalls: 34 }
×

Important Information

Ao usar o fórum, você concorda com nossos Terms of Use.