jabrena / spring-boot-user-beans

A visual way to increase the developer awareness to minimize the number of Beans in memory.
https://jabrena.github.io/spring-boot-user-beans/
Apache License 2.0
52 stars 3 forks source link

Redesign the JSON graph data structure #85

Open jabrena opened 1 year ago

jabrena commented 1 year ago

Currently, the Graph based on D3.js only use information about Edge to recreate Nodes. Besides, few Edges are false Edges because target is null. With a better Graph representation should be better.

===

public record GraphData(List<BeanNode> nodes, List<Edge> edges) {}
jabrena commented 1 year ago
{
   "edges" : [
      {
         "source" : {
            "beanName" : "ChatGTPProvider",
            "beanPackage" : "io.github.jabrena.userbeans",
            "dependency" : "UNKNOWN"
         },
         "target" : {
            "beanName" : "ChatGTPMapper",
            "beanPackage" : "UNKNOWN",
            "dependency" : "UNKNOWN"
         }
      },
      {
         "source" : {
            "beanName" : "MultipartConfigElement",
            "beanPackage" : "jakarta.servlet",
            "dependency" : "UNKNOWN"
         },
         "target" : {
            "beanName" : "MultipartAutoConfiguration",
            "beanPackage" : "UNKNOWN",
            "dependency" : "UNKNOWN"
         }
      },
      {
         "source" : {
            "beanName" : "MyController",
            "beanPackage" : "info.jab.ms",
            "dependency" : "UNKNOWN"
         },
         "target" : {
            "beanName" : "myService",
            "beanPackage" : "UNKNOWN",
            "dependency" : "UNKNOWN"
         }
      },
      {
         "source" : {
            "beanName" : "UserBeansDependencyService",
            "beanPackage" : "io.github.jabrena.userbeans",
            "dependency" : "UNKNOWN"
         },
         "target" : {
            "beanName" : "UserBeansService",
            "beanPackage" : "UNKNOWN",
            "dependency" : "UNKNOWN"
         }
      },
      {
         "source" : {
            "beanName" : "UserBeansEndpoint",
            "beanPackage" : "io.github.jabrena.userbeans",
            "dependency" : "UNKNOWN"
         },
         "target" : {
            "beanName" : "UserBeansGraphService",
            "beanPackage" : "UNKNOWN",
            "dependency" : "UNKNOWN"
         }
      },
      {
         "source" : {
            "beanName" : "UserBeansEndpoint",
            "beanPackage" : "io.github.jabrena.userbeans",
            "dependency" : "UNKNOWN"
         },
         "target" : {
            "beanName" : "UserBeansExplanationService",
            "beanPackage" : "UNKNOWN",
            "dependency" : "UNKNOWN"
         }
      },
      {
         "source" : {
            "beanName" : "UserBeansExplanationService",
            "beanPackage" : "io.github.jabrena.userbeans",
            "dependency" : "UNKNOWN"
         },
         "target" : {
            "beanName" : "ChatGTPProvider",
            "beanPackage" : "UNKNOWN",
            "dependency" : "UNKNOWN"
         }
      },
      {
         "source" : {
            "beanName" : "UserBeansGraphService",
            "beanPackage" : "io.github.jabrena.userbeans",
            "dependency" : "UNKNOWN"
         },
         "target" : {
            "beanName" : "UserBeansDependencyService",
            "beanPackage" : "UNKNOWN",
            "dependency" : "UNKNOWN"
         }
      },
      {
         "source" : {
            "beanName" : "UserBeansService",
            "beanPackage" : "io.github.jabrena.userbeans",
            "dependency" : "UNKNOWN"
         },
         "target" : {
            "beanName" : "beansEndpoint",
            "beanPackage" : "UNKNOWN",
            "dependency" : "UNKNOWN"
         }
      }
   ],
   "nodes" : [
      {
         "beanName" : "ChatGTPConfig",
         "beanPackage" : "io.github.jabrena.userbeans",
         "dependency" : "UNKNOWN"
      },
      {
         "beanName" : "ChatGTPProvider",
         "beanPackage" : "io.github.jabrena.userbeans",
         "dependency" : "UNKNOWN"
      },
      {
         "beanName" : "MainApplication",
         "beanPackage" : "info.jab.ms",
         "dependency" : "UNKNOWN"
      },
      {
         "beanName" : "MultipartConfigElement",
         "beanPackage" : "jakarta.servlet",
         "dependency" : "UNKNOWN"
      },
      {
         "beanName" : "MyController",
         "beanPackage" : "info.jab.ms",
         "dependency" : "UNKNOWN"
      },
      {
         "beanName" : "MyService",
         "beanPackage" : "info.jab.ms",
         "dependency" : "UNKNOWN"
      },
      {
         "beanName" : "UserBeansDependencyService",
         "beanPackage" : "io.github.jabrena.userbeans",
         "dependency" : "UNKNOWN"
      },
      {
         "beanName" : "UserBeansEndpoint",
         "beanPackage" : "io.github.jabrena.userbeans",
         "dependency" : "UNKNOWN"
      },
      {
         "beanName" : "UserBeansExplanationService",
         "beanPackage" : "io.github.jabrena.userbeans",
         "dependency" : "UNKNOWN"
      },
      {
         "beanName" : "UserBeansGraphService",
         "beanPackage" : "io.github.jabrena.userbeans",
         "dependency" : "UNKNOWN"
      },
      {
         "beanName" : "UserBeansService",
         "beanPackage" : "io.github.jabrena.userbeans",
         "dependency" : "UNKNOWN"
      }
   ]
}
jabrena commented 1 year ago

Fix the tests tomorrow

jabrena commented 1 year ago

I’m the edges, it is not necessary to maintain the package & dependency

jabrena commented 1 year ago
curl -v "http://localhost:8080/actuator/userbeans/graph2?dependency=UNKNOWN" | json_pp
jabrena commented 1 year ago
{
   "edges" : [
      {
         "source" : {
            "beanName" : "ChatGTPProvider"
         },
         "target" : {
            "beanName" : "ChatGTPMapper"
         }
      },
      {
         "source" : {
            "beanName" : "MultipartConfigElement"
         },
         "target" : {
            "beanName" : "MultipartAutoConfiguration"
         }
      },
      {
         "source" : {
            "beanName" : "MyController"
         },
         "target" : {
            "beanName" : "myService"
         }
      },
      {
         "source" : {
            "beanName" : "UserBeansDependencyService"
         },
         "target" : {
            "beanName" : "UserBeansService"
         }
      },
      {
         "source" : {
            "beanName" : "UserBeansEndpoint"
         },
         "target" : {
            "beanName" : "UserBeansGraphService"
         }
      },
      {
         "source" : {
            "beanName" : "UserBeansEndpoint"
         },
         "target" : {
            "beanName" : "UserBeansExplanationService"
         }
      },
      {
         "source" : {
            "beanName" : "UserBeansExplanationService"
         },
         "target" : {
            "beanName" : "ChatGTPProvider"
         }
      },
      {
         "source" : {
            "beanName" : "UserBeansGraphService"
         },
         "target" : {
            "beanName" : "UserBeansDependencyService"
         }
      },
      {
         "source" : {
            "beanName" : "UserBeansService"
         },
         "target" : {
            "beanName" : "beansEndpoint"
         }
      }
   ],
   "nodes" : [
      {
         "beanName" : "ChatGTPConfig",
         "beanPackage" : "io.github.jabrena.userbeans",
         "dependency" : "UNKNOWN"
      },
      {
         "beanName" : "ChatGTPProvider",
         "beanPackage" : "io.github.jabrena.userbeans",
         "dependency" : "UNKNOWN"
      },
      {
         "beanName" : "MainApplication",
         "beanPackage" : "info.jab.ms",
         "dependency" : "UNKNOWN"
      },
      {
         "beanName" : "MultipartConfigElement",
         "beanPackage" : "jakarta.servlet",
         "dependency" : "UNKNOWN"
      },
      {
         "beanName" : "MyController",
         "beanPackage" : "info.jab.ms",
         "dependency" : "UNKNOWN"
      },
      {
         "beanName" : "MyService",
         "beanPackage" : "info.jab.ms",
         "dependency" : "UNKNOWN"
      },
      {
         "beanName" : "UserBeansDependencyService",
         "beanPackage" : "io.github.jabrena.userbeans",
         "dependency" : "UNKNOWN"
      },
      {
         "beanName" : "UserBeansEndpoint",
         "beanPackage" : "io.github.jabrena.userbeans",
         "dependency" : "UNKNOWN"
      },
      {
         "beanName" : "UserBeansExplanationService",
         "beanPackage" : "io.github.jabrena.userbeans",
         "dependency" : "UNKNOWN"
      },
      {
         "beanName" : "UserBeansGraphService",
         "beanPackage" : "io.github.jabrena.userbeans",
         "dependency" : "UNKNOWN"
      },
      {
         "beanName" : "UserBeansService",
         "beanPackage" : "io.github.jabrena.userbeans",
         "dependency" : "UNKNOWN"
      }
   ]
}
jabrena commented 1 year ago

https://github.com/jabrena/spring-boot-user-beans/issues/138

jabrena commented 1 year ago

https://github.com/jabrena/spring-boot-user-beans/issues/111

jabrena commented 1 year ago
curl -v "http://localhost:8080/actuator/userbeans/graph?dependency=micrometer-observation-1.11.0.jar" | json_pp

Improve nodes:

{
   "edges" : [
      {
         "source" : {
            "beanName" : "SimpleObservationRegistry",
            "beanPackage" : "io.micrometer.observation",
            "dependency" : "micrometer-observation-1.11.0.jar"
         },
         "target" : {
            "beanName" : "ObservationAutoConfiguration",
            "beanPackage" : "UNKNOWN",
            "dependency" : "UNKNOWN"
         }
      }
   ],
   "nodes" : [
      {
         "beanName" : "SimpleObservationRegistry",
         "beanPackage" : "io.micrometer.observation",
         "dependency" : "micrometer-observation-1.11.0.jar"
      }
   ]
}
jabrena commented 1 year ago

I need to find a good test strategy