зеркало из https://github.com/Azure/Avere.git
fix log where it was ignored (#154)
This commit is contained in:
Родитель
c3799c24cc
Коммит
14f59a78e4
|
@ -22,7 +22,7 @@ x86/
|
|||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
#[Ll]og/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
|
|
|
@ -5,8 +5,8 @@ This EDA Simulator helps test filer performance. The simulator has 4 components
|
|||
1. **orchestrator** - the task the reads the job config files and writes workstart files, and submits work to workers for processing. This also receives completed jobs from workers, writes a job complete file, and submits a job for upload.
|
||||
1. **worker** - the task that takes a workitem, reads the start files, and writes the complete files and or error file depending on error probability.
|
||||
1. **uploader** - this task receives upload tasks for each completed job, and reads all job config files and job work files.
|
||||
|
||||
The job uses Azure Storage Queue for work management, and uses event hub for measuring file statistics. The goal of the EDA simulator is to test with various filers to understand the filer performance characteristics.
|
||||
|
||||
The job uses Azure Storage Queue for work management, and uses event hub for measuring file statistics. The goal of the EDA simulator is to test with various filers to understand the filer performance characteristics. There is a tool named `statscollector` that will collect and summarize the performance runs from event hub.
|
||||
|
||||
The four components above implement the following message sequence chart:
|
||||
|
||||
|
@ -29,7 +29,7 @@ source ~/.profile
|
|||
|
||||
2. setup edasim code
|
||||
```bash
|
||||
go get -v go get -v github.com/azure/avere/src/go/...
|
||||
go get -v github.com/azure/avere/src/go/...
|
||||
```
|
||||
|
||||
# Storage Preparation
|
||||
|
@ -46,6 +46,20 @@ export AZURE_STORAGE_ACCOUNT=YOUR_STORAGE_ACCOUNT
|
|||
export AZURE_STORAGE_ACCOUNT_KEY=YOUR_STORAGE_ACCOUNT_KEY
|
||||
```
|
||||
|
||||
# Event Hub Prepration
|
||||
|
||||
1. use the portal or cloud shell to create an "Event Hubs Namespace" Resource with Pricing Tier "Standard" resource in the same region as the vFXT. For this example, we created `edasimeventhub`
|
||||
1. once created, browse to the "Event Hubs Namespace" in the portal and click "+Event Hub" to add an event hub keeping the defaults of 2 partition counts and 1 day message retention. For this example, we created event hub `edasim`
|
||||
1. once created, browse to "Shared Access Policies", click on "RootManageSharedAccessKey" and copy the primary key
|
||||
1. next you will need to set your environment variables with everything you just created:
|
||||
|
||||
```bash
|
||||
export AZURE_EVENTHUB_SENDERKEYNAME="RootManageSharedAccessKey"
|
||||
export AZURE_EVENTHUB_SENDERKEY="PASTE_SENDER_KEY_HERE"
|
||||
export AZURE_EVENTHUB_NAMESPACENAME="edasimeventhub"
|
||||
export AZURE_EVENTHUB_HUBNAME="edasim"
|
||||
```
|
||||
|
||||
# To Run
|
||||
|
||||
Build all the binaries:
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
// Package log implements log related structures, methods, and functions
|
||||
package log
|
|
@ -0,0 +1,49 @@
|
|||
package log
|
||||
|
||||
import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
l "log"
|
||||
"os"
|
||||
)
|
||||
|
||||
// this package is inspired by article https://www.ardanlabs.com/blog/2013/11/using-log-package-in-go.html
|
||||
|
||||
var (
|
||||
// Debug is used for debug statements and useful for debugging
|
||||
Debug *l.Logger
|
||||
// Info is used for general statements and useful for information logs
|
||||
Info *l.Logger
|
||||
// Warning is used for warning statements and useful for warning logs
|
||||
Warning *l.Logger
|
||||
// Error is used for error statements and useful for error logs
|
||||
Error *l.Logger
|
||||
)
|
||||
|
||||
const (
|
||||
debugPrefix = "DEBUG: "
|
||||
infoPrefix = "INFO: "
|
||||
warningPrefix = "WARNING: "
|
||||
errorPrefix = "ERROR: "
|
||||
defaultFlags = l.Ldate | l.Ltime | l.Lmicroseconds | l.Llongfile | l.LUTC
|
||||
)
|
||||
|
||||
func init() {
|
||||
initloggers(ioutil.Discard, os.Stdout, os.Stdout, os.Stderr)
|
||||
}
|
||||
|
||||
func initloggers(
|
||||
traceHandle io.Writer,
|
||||
infoHandle io.Writer,
|
||||
warningHandle io.Writer,
|
||||
errorHandle io.Writer) {
|
||||
Debug = l.New(traceHandle, debugPrefix, defaultFlags)
|
||||
Info = l.New(infoHandle, infoPrefix, defaultFlags)
|
||||
Warning = l.New(warningHandle, warningPrefix, defaultFlags)
|
||||
Error = l.New(errorHandle, errorPrefix, defaultFlags)
|
||||
}
|
||||
|
||||
// EnableDebugging enables all debug logs to be written to stdout
|
||||
func EnableDebugging() {
|
||||
initloggers(os.Stdout, os.Stdout, os.Stdout, os.Stderr)
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package log
|
||||
|
||||
// Profiler implements profiling methods
|
||||
type Profiler interface {
|
||||
RecordTiming(bytes []byte)
|
||||
}
|
Загрузка…
Ссылка в новой задаче