forked from cadence-workflow/cadence
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 685242e
Showing
20 changed files
with
325 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"phabricator.uri": "https://code.uberinternal.com/", | ||
"git.default-relative-commit": "origin/master" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"linters": { | ||
"golint": { | ||
"type": "golint", | ||
"include": "(\\.go$)", | ||
"exclude": [ | ||
"(^Godeps/)", | ||
"(^client/)", | ||
"(/thrift/)" | ||
] | ||
}, | ||
"gofmt": { | ||
"type": "gofmt", | ||
"include": "(\\.go$)", | ||
"exclude": [ | ||
"(^Godeps/)", | ||
"(^client/)", | ||
"(/thrift/)" | ||
] | ||
}, | ||
"govet": { | ||
"type": "govet", | ||
"include": "(\\.go$)", | ||
"exclude": [ | ||
"(^Godeps/)", | ||
"(^client/)", | ||
"(/thrift/)" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
*.out | ||
*.test | ||
*.xml | ||
*.swp | ||
.idea/ | ||
*.iml | ||
*.cov | ||
*.html | ||
.tmp/ | ||
.gen/ | ||
/vendor | ||
/minions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "go-build"] | ||
path = go-build | ||
url = [email protected]:go-build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Please keep this file for tracking and modeling purposes. | ||
sha: 0bae718f0d6dde06e4ed06b5fb474f2c5ef623ca | ||
time: 1477350246 | ||
variant: variant_golang |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
PROJECT_ROOT = code.uber.internal/devexp/minions | ||
|
||
# define the list of thrift files the service depends on | ||
# (if you have some) | ||
THRIFT_SRCS = idl/code.uber.internal/devexp/minions/minions.thrift | ||
|
||
# list all executables | ||
PROGS = minions | ||
|
||
minions: $(wildcard *.go) | ||
|
||
-include go-build/rules.mk | ||
|
||
go-build/rules.mk: | ||
git submodule update --init |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
## Documentation | ||
To learn how to document your project on [EngDocs](https://engdocs.uberinternal.com), see this [guide](https://engdocs.uberinternal.com/engdocs/index.html). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package main | ||
|
||
import ( | ||
"code.uber.internal/go-common.git/x/log" | ||
"code.uber.internal/go-common.git/x/metrics" | ||
"code.uber.internal/go-common.git/x/tchannel" | ||
|
||
jaeger "github.com/uber/jaeger-client-go/config" | ||
) | ||
|
||
type appConfig struct { | ||
Logging log.Configuration | ||
Metrics metrics.Configuration | ||
Jaeger jaeger.Configuration | ||
TChannel xtchannel.Configuration | ||
Sentry log.SentryConfiguration | ||
Verbose bool | ||
ServiceName string `yaml:"serviceName"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
serviceName: minions | ||
|
||
logging: | ||
level: info | ||
stdout: true | ||
|
||
jaeger: | ||
disabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add your development configuration here | ||
tchannel: | ||
# Use a fixed port during development. | ||
port: 9876 | ||
# Use the local Hyperbahn nodes during development. | ||
routers: ["127.0.0.1:21300", "127.0.0.1:21301"] | ||
|
||
jaeger: | ||
# This tells Jaeger to sample and capture every trace in the service. | ||
# This section should not be in the production configuration, | ||
# because it will degrade the application performance by reporting | ||
# multiple spans per each request, and spam Jaeger with lots of data. | ||
sampler: | ||
type: "const" | ||
param: 1 | ||
# The reporter settings ensure that each span is reported immediately | ||
# as soon as it is finished (without being buffered), and its trace ID | ||
# is written to the log. | ||
reporter: | ||
queueSize: 1 | ||
logSpans: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Add your production configuration here | ||
logging: | ||
stdout: true | ||
kafka: | ||
topic: minions | ||
|
||
metrics: | ||
m3: | ||
hostPort: 127.0.0.1:9052 | ||
service: minions | ||
|
||
sentry: | ||
dsn: http://fill:[email protected]/fillmein |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Add your test configuration here |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package: code.uber.internal/devexp/minions | ||
import: | ||
- package: code.uber.internal/go-common.git | ||
version: master | ||
subpackages: | ||
- x/config | ||
- x/log | ||
- x/metrics | ||
- x/tchannel | ||
- package: github.com/uber/tchannel-go | ||
subpackages: | ||
- thrift | ||
testImport: | ||
- package: github.com/stretchr/testify | ||
subpackages: | ||
- assert |
Submodule go-build
added at
181764
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
namespace java com.uber.devexp.minions | ||
|
||
service MyService { | ||
string hello() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package main | ||
|
||
import ( | ||
gen "code.uber.internal/devexp/minions/.gen/go/minions" | ||
"code.uber.internal/go-common.git/x/config" | ||
"code.uber.internal/go-common.git/x/jaeger" | ||
"code.uber.internal/go-common.git/x/log" | ||
"github.com/uber/tchannel-go" | ||
"github.com/uber/tchannel-go/thrift" | ||
) | ||
|
||
func main() { | ||
var cfg appConfig | ||
if err := config.Load(&cfg); err != nil { | ||
log.Fatalf("Error initializing configuration: %s", err) | ||
} | ||
log.Configure(&cfg.Logging, cfg.Verbose) | ||
log.ConfigureSentry(&cfg.Sentry) | ||
|
||
metrics, err := cfg.Metrics.New() | ||
if err != nil { | ||
log.Fatalf("Could not connect to metrics: %v", err) | ||
} | ||
metrics.Counter("boot").Inc(1) | ||
|
||
closer, err := xjaeger.InitGlobalTracer(cfg.Jaeger, cfg.ServiceName, metrics) | ||
if err != nil { | ||
log.Fatalf("Jaeger.InitGlobalTracer failed: %v", err) | ||
} | ||
defer closer.Close() | ||
|
||
if _, err := cfg.TChannel.New(cfg.ServiceName, metrics, registerHandlers); err != nil { | ||
log.Fatalf("TChannel.New failed: %v", err) | ||
} | ||
|
||
// If the server needs to listen on HTTP port, use dynamic port: | ||
// port, _ := config.GetDynamicHTTPPort(cfg.Port) | ||
|
||
// Block forever. | ||
select {} | ||
} | ||
|
||
func registerHandlers(ch *tchannel.Channel, server *thrift.Server) { | ||
server.Register(gen.NewTChanMyServiceServer(myHandler{})) | ||
} | ||
|
||
type myHandler struct{} | ||
|
||
func (myHandler) Hello(ctx thrift.Context) (string, error) { | ||
return "Hello World!", nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package main | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestHello(t *testing.T) { | ||
handler := myHandler{} | ||
_, err := handler.Hello(nil) | ||
assert.NoError(t, err, "Handler failed") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
service_name: minions | ||
network_protocol: tchannel | ||
service_type: go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
COUNT ME IN, BRO |