extjvm

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2023 License: MIT Imports: 43 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TargetIDPrefix = "com.github.steadybit.extension_jvm"
)

Variables

View Source
var (
	DataSourcePlugin       = common.GetJarPath("discovery-java-javaagent.jar")
	DataSourceMarkerClass  = "javax.sql.DataSource"
	DataSourceApplications = sync.Map{} // map[Pid int32]DataSourceApplication
)
View Source
var (
	JavaagentInitJar = common.GetJarPath("javaagent-init.jar")
	JavaagentMainJar = common.GetJarPath("javaagent-main.jar")

	SocketTimeout = 10 * time.Second
)
View Source
var (
	ClasspathExcludes   = []string{"IntelliJ IDEA", "surefirebooter", "Eclipse"}
	CommandlineExcludes = []string{"IntelliJ IDEA", "com.intellij.idea.Main", "jetbrains.buildServer.agent.Launcher",
		"jetbrains.buildServer.agent.AgentMain", "org.jetbrains.jps.cmdline.BuildMain", "org.jetbrains.idea.maven.server.RemoteMavenServer",
		"org.jetbrains.jps.cmdline.Launcher", "org.jetbrains.plugins.scala.nailgun.NailgunRunner", "sun.tools.",
		"com.steadybit.javaagent.ExternalJavaagentAttachment", "steadybit.agent.disable-jvm-attachment",
		"-XX:+DisableAttachMechanism", "-Dcom.ibm.tools.attach.enable=no", "com.steadybit.agent.application.SteadybitAgentApplication",
		"com.steadybit.agent.application.SteadybitOutpostApplication"}
)
View Source
var (
	SpringPlugin                       = common.GetJarPath("discovery-springboot-javaagent.jar")
	SpringMarkerClass                  = "org.springframework.context.ApplicationContext"
	SpringBootMarkerClass              = "org.springframework.boot.ApplicationRunner"
	SpringJdbcTemplateBeanClass        = "org.springframework.jdbc.core.JdbcTemplate"
	SpringResttemplateBeanClass        = "org.springframework.web.client.RestTemplate"
	SpringResttemplateBuilderBeanClass = "org.springframework.boot.web.client.RestTemplateBuilder"
	SpringWebclientBeanClass           = "org.springframework.web.reactive.function.client.WebClient"
	SpringWebclientBuilderBeanClass    = "org.springframework.web.reactive.function.client.WebClient$Builder"

	SpringApplications = sync.Map{} // map[Pid int32]SpringApplication
)

Functions

func AddAttachedListener

func AddAttachedListener(attachedListener AttachedListener)

func AddAutoloadAgentPlugin

func AddAutoloadAgentPlugin(plugin string, markerClass string)

func AddJVMListener

func AddJVMListener()

func AddListener

func AddListener(listener Listener)

func DataSourceDiscover

func DataSourceDiscover(jvm *jvm.JavaVm)

func DeactivateDataSourceDiscovery

func DeactivateDataSourceDiscovery()

func DeactivateSpringDiscovery

func DeactivateSpringDiscovery()

func GetCleanSocketCommandResult

func GetCleanSocketCommandResult(response io.Reader) (string, error)

func GetDiscoveryList

func GetDiscoveryList() discovery_kit_api.DiscoveryList

func GetJVMs

func GetJVMs() []jvm.JavaVm

func GetTarget

func GetTarget(pid int32) *jvm.JavaVm

func HasAgentPlugin

func HasAgentPlugin(jvm *jvm.JavaVm, plugin string) bool

func HasClassLoaded

func HasClassLoaded(jvm *jvm.JavaVm, className string) bool

func InitDataSourceDiscovery

func InitDataSourceDiscovery()

func InitDiscovery

func InitDiscovery()

func InitSpringDiscovery

func InitSpringDiscovery()

func InstallSignalHandler

func InstallSignalHandler()

func LoadAgentPlugin

func LoadAgentPlugin(jvm *jvm.JavaVm, plugin string, args string) (bool, error)

func Prepare

func Prepare(jvm *jvm.JavaVm, configJson string) (string, int)

func RegisterDiscoveryHandlers

func RegisterDiscoveryHandlers()

func RemoveAutoloadAgentPlugin

func RemoveAutoloadAgentPlugin(plugin string, markerClass string)

func RemoveListener

func RemoveListener(listener Listener)

func SendCommandToAgent

func SendCommandToAgent(jvm *jvm.JavaVm, command string, args string) bool

func SendCommandToAgentViaSocket

func SendCommandToAgentViaSocket[T any](jvm *jvm.JavaVm, command string, args string, handler func(rc string, response io.Reader) T) *T

func Start

func Start(jvm *jvm.JavaVm, callbackUrl string) error

func StartAttachment

func StartAttachment()

func StartDataSourceDiscovery

func StartDataSourceDiscovery()

func StartSpringDiscovery

func StartSpringDiscovery()

func Stop

func Stop(jvm *jvm.JavaVm) bool

func UnloadAgentPlugin

func UnloadAgentPlugin(jvm *jvm.JavaVm, plugin string) (bool, error)

Types

type AttachJvmWork

type AttachJvmWork struct {
	// contains filtered or unexported fields
}

type AttachedListener

type AttachedListener interface {
	JvmAttachedSuccessfully(jvm *jvm.JavaVm)
	AttachedProcessStopped(jvm *jvm.JavaVm)
}

type AttackState

type AttackState struct {
	Duration     time.Duration
	Pid          int32
	ConfigJson   string
	EndpointPort int
	CallbackUrl  string
}

type AutoloadPlugin

type AutoloadPlugin struct {
	MarkerClass string
	Plugin      string
}

type ControllerDelayState

type ControllerDelayState struct {
	Delay       time.Duration
	DelayJitter bool
	*ControllerState
}

type ControllerExceptionState

type ControllerExceptionState struct {
	ErroneousCallRate int
	*ControllerState
}

type ControllerState

type ControllerState struct {
	Pattern        string
	Method         string
	HandlerMethods []string
	*AttackState
}

type DataSourceApplication

type DataSourceApplication struct {
	Pid                   int32
	DataSourceConnections []DataSourceConnection
}

func GetDataSourceApplications

func GetDataSourceApplications() []DataSourceApplication

type DataSourceConnection

type DataSourceConnection struct {
	Pid          int32
	DatabaseType string
	JdbcUrl      string
}

type DataSourceDiscovery

type DataSourceDiscovery struct{}

func (DataSourceDiscovery) AttachedProcessStopped

func (s DataSourceDiscovery) AttachedProcessStopped(jvm *jvm.JavaVm)

func (DataSourceDiscovery) JvmAttachedSuccessfully

func (s DataSourceDiscovery) JvmAttachedSuccessfully(jvm *jvm.JavaVm)

type HttpClientDelayState

type HttpClientDelayState struct {
	Delay       time.Duration
	DelayJitter bool
	HostAddress string
	*AttackState
}

type HttpClientStatusState

type HttpClientStatusState struct {
	ErroneousCallRate int
	HttpMethods       []string
	HostAddress       string
	UrlPath           string
	FailureCauses     []string
	*AttackState
}

type HttpRequest

type HttpRequest struct {
	Address        string `json:"address"`
	Scheme         string `json:"scheme"`
	Timeout        int    `json:"timeout"`
	CircuitBreaker bool   `json:"circuitBreaker"`
}

type JavaExtensionFacade

type JavaExtensionFacade struct{}

func (JavaExtensionFacade) AddedJvm

func (j JavaExtensionFacade) AddedJvm(jvm *jvm.JavaVm)

func (JavaExtensionFacade) RemovedJvm

func (j JavaExtensionFacade) RemovedJvm(jvm *jvm.JavaVm)

type JavaMethodDelayState

type JavaMethodDelayState struct {
	Delay       time.Duration
	DelayJitter bool
	ClassName   string
	MethodName  string
	*AttackState
}

type JavaMethodExceptionState

type JavaMethodExceptionState struct {
	ClassName         string
	MethodName        string
	ErroneousCallRate int
	*AttackState
}

type JavaVMS

type JavaVMS struct{}

func (*JavaVMS) NewHotspotProcess

func (j *JavaVMS) NewHotspotProcess(p *process.Process) bool

func (*JavaVMS) NewJavaProcess

func (j *JavaVMS) NewJavaProcess(p *process.Process) bool

type JdbcTemplateDelayState

type JdbcTemplateDelayState struct {
	Delay       time.Duration
	DelayJitter bool
	Operations  string
	JdbcUrl     string
	*AttackState
}

type JdbcTemplateExceptionState

type JdbcTemplateExceptionState struct {
	ErroneousCallRate int
	Operations        string
	JdbcUrl           string
	*AttackState
}

type Listener

type Listener interface {
	AddedJvm(jvm *jvm.JavaVm)
	RemovedJvm(jvm *jvm.JavaVm)
}

type LoadPluginJvmWork

type LoadPluginJvmWork struct {
	// contains filtered or unexported fields
}

type SpringApplication

type SpringApplication struct {
	Name               string
	Pid                int32
	SpringBoot         bool
	UsingJdbcTemplate  bool
	UsingHttpClient    bool
	MvcMappings        *[]SpringMvcMapping
	HttpClientRequests *[]HttpRequest
}

func FindSpringApplication

func FindSpringApplication(pid int32) *SpringApplication

func GetSpringApplications

func GetSpringApplications() []SpringApplication

type SpringDiscovery

type SpringDiscovery struct{}

func (SpringDiscovery) AttachedProcessStopped

func (s SpringDiscovery) AttachedProcessStopped(jvm *jvm.JavaVm)

func (SpringDiscovery) JvmAttachedSuccessfully

func (s SpringDiscovery) JvmAttachedSuccessfully(jvm *jvm.JavaVm)

type SpringMvcMapping

type SpringMvcMapping struct {
	Consumes          []string `json:"consumes"`
	Headers           []string `json:"headers"`
	Methods           []string `json:"methods"`
	Params            []string `json:"params"`
	Produces          []string `json:"produces"`
	Patterns          []string `json:"patterns"`
	HandlerClass      string   `json:"handlerClass"`
	HandlerName       string   `json:"handlerName"`
	HandlerDescriptor string   `json:"handlerDescriptor"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL