Documentation ¶
Overview ¶
package theater
Português: Monta um teatro de containers com senas lineares ou de caos, permitindo ao desenvolvedor montar em sua máquina de trabalho testes de micro caos durante o desenvolvimento das suas aplicações.
Para entender melhor o uso de senários de micro caos, imagine o desenvolvimento de aplicações se comunicando com outras aplicações, onde a pausa e reinício aleatórios dos containers ajuda a entender melhor o comportamento do projeto quando algo dá errado e a comunicação falha.
Index ¶
- Constants
- type Chaos
- type Configuration
- func (e *Configuration) AddASceneOfChaosSettingFilterOnTheContainersStandardOutputToStartCaos(match, filter, search, replace string) (configuration *Configuration)
- func (e *Configuration) AddASceneOfChaosSettingPauseDuration(min, max time.Duration) (configuration *Configuration)
- func (e *Configuration) AddASceneOfChaosSettingRestartInterval(min, max time.Duration) (configuration *Configuration)
- func (e *Configuration) AddASceneOfChaosSettingRestartIntervalRestartController(probability float64, limit int) (configuration *Configuration)
- func (e *Configuration) AddASceneOfChaosSettingStartDuration(min, max time.Duration) (configuration *Configuration)
- func (e *Configuration) AddASceneOfChaosSettingStartDurationRestartFilterOnTheContainersStandardOutput(match, filter, search, replace string) (configuration *Configuration)
- func (e *Configuration) AddASceneOfChaosSettingUnpauseDuration(min, max time.Duration) (configuration *Configuration)
- func (e *Configuration) AddASceneSettingFilterOnTheContainersStandardOutputToEndEvent(match, filter, search, replace string) (configuration *Configuration)
- func (e *Configuration) AddASceneSettingFilterOnTheContainersStandardOutputToFailEvent(match, filter, search, replace string) (configuration *Configuration)
- func (e *Configuration) AddFilterToCaptureInformationOnTheContainersStandardOutputForStatsLog(label, match, filter, search, replace string) (configuration *Configuration)
- func (e *Configuration) SetASceneLinearFlag() (configuration *Configuration)
- func (e *Configuration) SetContainerStatsLogPath(path string) (configuration *Configuration)
- type Event
- type LogFilter
- type Restart
- type Theater
- func (e *Theater) AddCacheConfig(container *Configuration) (err error)
- func (e *Theater) AddContainerConfiguration(container *Configuration) (err error)
- func (e *Theater) AddContainerConfigurationToPrologueScene(container *Configuration) (err error)
- func (e *Theater) GetChannels() (eventChannel *chan Event)
- func (e *Theater) GetImageExpirationTime() (expiration time.Duration)
- func (e *Theater) Init() (err error)
- func (e *Theater) SetImageExpirationTime(expiration time.Duration)
- func (e *Theater) SetLogFields(logFlags int64)
- type Timers
Constants ¶
const ( // KAll // // English: Enable all values to log KAll = 0x8FFFFFFFFFFFFFF // KReadingTime // // English: Reading time KReadingTime = 0b0000000000000000000000000000000000000000000000000000000000000001 // KCurrentNumberOfOidsInTheCGroup // // English: Linux specific stats, not populated on Windows. Current is the number of pids in the cgroup KCurrentNumberOfOidsInTheCGroup = 0b0000000000000000000000000000000000000000000000000000000000000010 // KLimitOnTheNumberOfPidsInTheCGroup // // English: Linux specific stats, not populated on Windows. Limit is the hard limit on the number of pids in the cgroup. A "Limit" of 0 means that there is no limit. KLimitOnTheNumberOfPidsInTheCGroup = 0b0000000000000000000000000000000000000000000000000000000000000100 // KTotalCPUTimeConsumed // // English: Total CPU time consumed. (Units: nanoseconds on Linux, Units: 100's of nanoseconds on Windows) KTotalCPUTimeConsumed = 0b0000000000000000000000000000000000000000000000000000000000001000 // KTotalCPUTimeConsumedPerCore // // English: Total CPU time consumed. (Units: nanoseconds on Linux, Units: 100's of nanoseconds on Windows) KTotalCPUTimeConsumedPerCore = 0b0000000000000000000000000000000000000000000000000000000000010000 // KTimeSpentByTasksOfTheCGroupInKernelMode // // English: Time spent by tasks of the cgroup in kernel mode (Units: nanoseconds on Linux). Time spent by all container processes in kernel mode (Units: 100's of nanoseconds on Windows.Not populated for Hyper-V Containers.) KTimeSpentByTasksOfTheCGroupInKernelMode = 0b0000000000000000000000000000000000000000000000000000000000100000 // KTimeSpentByTasksOfTheCGroupInUserMode // // English: Time spent by tasks of the cgroup in user mode (Units: nanoseconds on Linux). Time spent by all container processes in user mode (Units: 100's of nanoseconds on Windows. Not populated for Hyper-V Containers) KTimeSpentByTasksOfTheCGroupInUserMode = 0b0000000000000000000000000000000000000000000000000000000001000000 // KSystemUsage // // English: System Usage. Linux only. KSystemUsage = 0b0000000000000000000000000000000000000000000000000000000010000000 // KOnlineCPUs // // English: Online CPUs. Linux only. KOnlineCPUs = 0b0000000000000000000000000000000000000000000000000000000100000000 // KNumberOfPeriodsWithThrottlingActive // // English: Throttling Data. Linux only. Number of periods with throttling active. KNumberOfPeriodsWithThrottlingActive = 0b0000000000000000000000000000000000000000000000000000001000000000 // KNumberOfPeriodsWhenTheContainerHitsItsThrottlingLimit // // English: Throttling Data. Linux only. Number of periods when the container hits its throttling limit. KNumberOfPeriodsWhenTheContainerHitsItsThrottlingLimit = 0b0000000000000000000000000000000000000000000000000000010000000000 // KAggregateTimeTheContainerWasThrottledForInNanoseconds // // English: Throttling Data. Linux only. Aggregate time the container was throttled for in nanoseconds. KAggregateTimeTheContainerWasThrottledForInNanoseconds = 0b0000000000000000000000000000000000000000000000000000100000000000 // KTotalPreCPUTimeConsumed // // English: Total CPU time consumed per core (Units: nanoseconds on Linux). Not used on Windows. KTotalPreCPUTimeConsumed = 0b0000000000000000000000000000000000000000000000000001000000000000 // KTotalPreCPUTimeConsumedPerCore // // English: Total CPU time consumed per core (Units: nanoseconds on Linux). Not used on Windows. KTotalPreCPUTimeConsumedPerCore = 0b0000000000000000000000000000000000000000000000000010000000000000 // KTimeSpentByPreCPUTasksOfTheCGroupInKernelMode // // English: Time spent by tasks of the cgroup in kernel mode (Units: nanoseconds on Linux) - Time spent by all container processes in kernel mode (Units: 100's of nanoseconds on Windows - Not populated for Hyper-V Containers.) KTimeSpentByPreCPUTasksOfTheCGroupInKernelMode = 0b0000000000000000000000000000000000000000000000000100000000000000 // KTimeSpentByPreCPUTasksOfTheCGroupInUserMode // // English: Time spent by tasks of the cgroup in user mode (Units: nanoseconds on Linux) - Time spent by all container processes in user mode (Units: 100's of nanoseconds on Windows. Not populated for Hyper-V Containers) KTimeSpentByPreCPUTasksOfTheCGroupInUserMode = 0b0000000000000000000000000000000000000000000000001000000000000000 // KPreCPUSystemUsage // // English: System Usage. (Linux only) KPreCPUSystemUsage = 0b0000000000000000000000000000000000000000000000010000000000000000 // KOnlinePreCPUs // // English: Online CPUs. (Linux only) KOnlinePreCPUs = 0b0000000000000000000000000000000000000000000000100000000000000000 // KAggregatePreCPUTimeTheContainerWasThrottled // // English: Throttling Data. (Linux only) - Aggregate time the container was throttled for in nanoseconds KAggregatePreCPUTimeTheContainerWasThrottled = 0b0000000000000000000000000000000000000000000001000000000000000000 // KNumberOfPeriodsWithPreCPUThrottlingActive // // English: Throttling Data. (Linux only) - Number of periods with throttling active KNumberOfPeriodsWithPreCPUThrottlingActive = 0b0000000000000000000000000000000000000000000010000000000000000000 // KNumberOfPeriodsWhenTheContainerPreCPUHitsItsThrottlingLimit // // English: Throttling Data. (Linux only) - Number of periods when the container hits its throttling limit. KNumberOfPeriodsWhenTheContainerPreCPUHitsItsThrottlingLimit = 0b0000000000000000000000000000000000000000000100000000000000000000 // KCurrentResCounterUsageForMemory // // English: Current res_counter usage for memory KCurrentResCounterUsageForMemory = 0b0000000000000000000000000000000000000000001000000000000000000000 // KMaximumUsageEverRecorded // // English: Maximum usage ever recorded KMaximumUsageEverRecorded = 0b0000000000000000000000000000000000000000010000000000000000000000 // KNumberOfTimesMemoryUsageHitsLimits // // English: Number of times memory usage hits limits KNumberOfTimesMemoryUsageHitsLimits = 0b0000000000000000000000000000000000000000100000000000000000000000 // KMemoryLimit // // English: Memory limit KMemoryLimit = 0b0000000000000000000000000000000000000001000000000000000000000000 // KCommittedBytes // // English: Committed bytes KCommittedBytes = 0b0000000000000000000000000000000000000010000000000000000000000000 // KPeakCommittedBytes // // English: Peak committed bytes KPeakCommittedBytes = 0b0000000000000000000000000000000000000100000000000000000000000000 // KPrivateWorkingSet // // English: Private working set KPrivateWorkingSet = 0b0000000000000000000000000000000000001000000000000000000000000000 KBlkioIoServiceBytesRecursive = 0b0000000000000000000000000000000000010000000000000000000000000000 KBlkioIoServicedRecursive = 0b0000000000000000000000000000000000100000000000000000000000000000 KBlkioIoQueuedRecursive = 0b0000000000000000000000000000000001000000000000000000000000000000 KBlkioIoServiceTimeRecursive = 0b0000000000000000000000000000000010000000000000000000000000000000 KBlkioIoWaitTimeRecursive = 0b0000000000000000000000000000000100000000000000000000000000000000 KBlkioIoMergedRecursive = 0b0000000000000000000000000000001000000000000000000000000000000000 KBlkioIoTimeRecursive = 0b0000000000000000000000000000010000000000000000000000000000000000 KBlkioSectorsRecursive = 0b0000000000000000000000000000100000000000000000000000000000000000 // KMacOsLogWithAllCores // // English: Mac OS Log KMacOsLogWithAllCores = KReadingTime | KCurrentNumberOfOidsInTheCGroup | KTotalCPUTimeConsumed | KTotalCPUTimeConsumedPerCore | KTimeSpentByTasksOfTheCGroupInKernelMode | KSystemUsage | KOnlineCPUs | KTotalPreCPUTimeConsumed | KTotalPreCPUTimeConsumedPerCore | KTimeSpentByPreCPUTasksOfTheCGroupInKernelMode | KPreCPUSystemUsage | KOnlinePreCPUs | KCurrentResCounterUsageForMemory | KMaximumUsageEverRecorded | KMemoryLimit | KBlkioIoServiceBytesRecursive | KBlkioIoServicedRecursive | KBlkioIoQueuedRecursive | KBlkioIoServiceTimeRecursive | KBlkioIoWaitTimeRecursive | KBlkioIoMergedRecursive | KBlkioIoTimeRecursive | KBlkioSectorsRecursive // KMacOsLog // // English: Mac OS Log KMacOsLog = KReadingTime | KCurrentNumberOfOidsInTheCGroup | KTotalCPUTimeConsumed | KTimeSpentByTasksOfTheCGroupInKernelMode | KSystemUsage | KOnlineCPUs | KTotalPreCPUTimeConsumed | KTimeSpentByPreCPUTasksOfTheCGroupInKernelMode | KPreCPUSystemUsage | KOnlinePreCPUs | KCurrentResCounterUsageForMemory | KMaximumUsageEverRecorded | KMemoryLimit | KBlkioIoServiceBytesRecursive | KBlkioIoServicedRecursive | KBlkioIoQueuedRecursive | KBlkioIoServiceTimeRecursive | KBlkioIoWaitTimeRecursive | KBlkioIoMergedRecursive | KBlkioIoTimeRecursive | KBlkioSectorsRecursive )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Configuration ¶
type Configuration struct { Docker *dockerBuild.ContainerBuilder LogPath string Log []LogFilter Fail []LogFilter End []LogFilter Chaos Chaos // contains filtered or unexported fields }
func NewTestContainerConfiguration ¶
func NewTestContainerConfiguration(docker *dockerBuild.ContainerBuilder) (configuration *Configuration)
NewTestContainerConfiguration
Português: Adiciona um objeto de configuração de container para ser usado no teatro de teste.
Entrada: docker: Ponteiro para o objeto dockerBuild.ContainerBuilder com a configuração do container a ser gerado. Saída: configuration: Objeto de configuração preenchido.
func (*Configuration) AddASceneOfChaosSettingFilterOnTheContainersStandardOutputToStartCaos ¶
func (e *Configuration) AddASceneOfChaosSettingFilterOnTheContainersStandardOutputToStartCaos(match, filter, search, replace string) (configuration *Configuration)
func (*Configuration) AddASceneOfChaosSettingPauseDuration ¶
func (e *Configuration) AddASceneOfChaosSettingPauseDuration(min, max time.Duration) (configuration *Configuration)
AddASceneOfChaosSettingPauseDuration
func (*Configuration) AddASceneOfChaosSettingRestartInterval ¶
func (e *Configuration) AddASceneOfChaosSettingRestartInterval(min, max time.Duration) (configuration *Configuration)
func (*Configuration) AddASceneOfChaosSettingRestartIntervalRestartController ¶
func (e *Configuration) AddASceneOfChaosSettingRestartIntervalRestartController(probability float64, limit int) (configuration *Configuration)
func (*Configuration) AddASceneOfChaosSettingStartDuration ¶
func (e *Configuration) AddASceneOfChaosSettingStartDuration(min, max time.Duration) (configuration *Configuration)
func (*Configuration) AddASceneOfChaosSettingStartDurationRestartFilterOnTheContainersStandardOutput ¶
func (e *Configuration) AddASceneOfChaosSettingStartDurationRestartFilterOnTheContainersStandardOutput(match, filter, search, replace string) (configuration *Configuration)
func (*Configuration) AddASceneOfChaosSettingUnpauseDuration ¶
func (e *Configuration) AddASceneOfChaosSettingUnpauseDuration(min, max time.Duration) (configuration *Configuration)
func (*Configuration) AddASceneSettingFilterOnTheContainersStandardOutputToEndEvent ¶
func (e *Configuration) AddASceneSettingFilterOnTheContainersStandardOutputToEndEvent(match, filter, search, replace string) (configuration *Configuration)
func (*Configuration) AddASceneSettingFilterOnTheContainersStandardOutputToFailEvent ¶
func (e *Configuration) AddASceneSettingFilterOnTheContainersStandardOutputToFailEvent(match, filter, search, replace string) (configuration *Configuration)
func (*Configuration) AddFilterToCaptureInformationOnTheContainersStandardOutputForStatsLog ¶
func (e *Configuration) AddFilterToCaptureInformationOnTheContainersStandardOutputForStatsLog(label, match, filter, search, replace string) (configuration *Configuration)
AddFilterToCaptureInformationOnTheContainersStandardOutputForStatsLog
Adiciona um filtro de busca na saída padrão do container e arquiva a informação no arquivo CSV com as medições de uso do container.
Entrada: label: Rótudo adicionado ao arquivo CSV. match: Texto simples procurado saída padrão a fim de indicar ocorência. filter: Expressão regular nomeada, com o termo `valueToGet`, usada para isolar o valor a ser escrito no arquivo CSV. search: Rexpressão regular usada para substituir valores no resultado de `filter` [opcional] replace: Elemento replace da expressão regular usada em `search` [opcional] Saída: configuration: Objeto de configuração preenchido.
Nota: - Esta configuração requer a configuração SetContainerStatsLogPath()
func (*Configuration) SetASceneLinearFlag ¶
func (e *Configuration) SetASceneLinearFlag() (configuration *Configuration)
SetASceneLinearFlag
Português: Transforma o senário de teste em um teste linear, preparando e subindo o container.
func (*Configuration) SetContainerStatsLogPath ¶
func (e *Configuration) SetContainerStatsLogPath(path string) (configuration *Configuration)
SetContainerStatsLogPath
Português: Salva um arquivo CSV com dados de métricas do container.
Entrada: path: Caminho de onde salvar o arquivo CSV Saída: configuration: Objeto de configuração preenchido.
type LogFilter ¶
type LogFilter struct { Label string // Texto contido na linha (tudo ou nada) Match string // expressão regular contendo o filtro para capturar o elemento // Ex.: ^(.*?)(?P<valueToGet>\\d+)(.*) Filter string // texto usado em replaceAll // Ex.: search: "." replace: "," para compatibilizar número com o excel Search string Replace string }
type Theater ¶
type Theater struct {
// contains filtered or unexported fields
}
func (*Theater) AddCacheConfig ¶
func (e *Theater) AddCacheConfig(container *Configuration) (err error)
func (*Theater) AddContainerConfiguration ¶
func (e *Theater) AddContainerConfiguration(container *Configuration) (err error)
func (*Theater) AddContainerConfigurationToPrologueScene ¶
func (e *Theater) AddContainerConfigurationToPrologueScene(container *Configuration) (err error)