Skip to content

Commit

Permalink
Fix 12
Browse files Browse the repository at this point in the history
  • Loading branch information
plutov committed May 2, 2020
1 parent af06989 commit 2ebe331
Show file tree
Hide file tree
Showing 5,826 changed files with 2,045,175 additions and 207 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 2 additions & 0 deletions 12-go-kit-1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ There is a `kitgen` command line tool to generate a service from template which

### go-kit CLI

2020 Update: "github.com/kujtimiihoxha/kit" is not supported anymore.

There is a separate package to create a service from template:

```
Expand Down
13 changes: 6 additions & 7 deletions 12-go-kit-1/bugs/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
FROM golang
FROM golang:1.13

RUN mkdir -p /go/src/github.com/plutov/packagemain/12-go-kit-1
ENV GO111MODULE=on

ADD . /go/src/github.com/plutov/packagemain/12-go-kit-1
WORKDIR /go/src/github.com/plutov/packagemain/12-go-kit-1/bugs

RUN go get -t -v ./...
RUN go get github.com/canthefason/go-watcher
RUN go install github.com/canthefason/go-watcher/cmd/watcher
COPY . .

ENTRYPOINT watcher -run github.com/plutov/packagemain/12-go-kit-1/bugs/cmd -watch github.com/plutov/packagemain/12-go-kit-1/bugs
RUN CGO_ENABLED=0 GOOS=linux go build -mod vendor -o server ./cmd/main.go

CMD [ "./server" ]
31 changes: 7 additions & 24 deletions 12-go-kit-1/bugs/cmd/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@ package service
import (
"flag"
"fmt"
"net"
http1 "net/http"
"os"
"os/signal"
"syscall"

endpoint1 "github.com/go-kit/kit/endpoint"
log "github.com/go-kit/kit/log"
prometheus "github.com/go-kit/kit/metrics/prometheus"
lightsteptracergo "github.com/lightstep/lightstep-tracer-go"
group "github.com/oklog/oklog/pkg/group"
opentracinggo "github.com/opentracing/opentracing-go"
zipkingoopentracing "github.com/openzipkin/zipkin-go-opentracing"
endpoint "github.com/plutov/packagemain/12-go-kit-1/bugs/pkg/endpoint"
http "github.com/plutov/packagemain/12-go-kit-1/bugs/pkg/http"
service "github.com/plutov/packagemain/12-go-kit-1/bugs/pkg/service"
prometheus1 "github.com/prometheus/client_golang/prometheus"
promhttp "github.com/prometheus/client_golang/prometheus/promhttp"
"net"
http1 "net/http"
"os"
"os/signal"
appdash "sourcegraph.com/sourcegraph/appdash"
opentracing "sourcegraph.com/sourcegraph/appdash/opentracing"
"syscall"
)

var tracer opentracinggo.Tracer
Expand All @@ -37,7 +37,6 @@ var thriftAddr = fs.String("thrift-addr", ":8083", "Thrift listen address")
var thriftProtocol = fs.String("thrift-protocol", "binary", "binary, compact, json, simplejson")
var thriftBuffer = fs.Int("thrift-buffer", 0, "0 for unbuffered")
var thriftFramed = fs.Bool("thrift-framed", false, "true to enable framing")
var zipkinURL = fs.String("zipkin-url", "", "Enable Zipkin tracing via a collector URL e.g. http://localhost:9411/api/v1/spans")
var lightstepToken = fs.String("lightstep-token", "", "Enable LightStep tracing via a LightStep access token")
var appdashAddr = fs.String("appdash-addr", "", "Enable Appdash tracing via an Appdash server host:port")

Expand All @@ -49,23 +48,7 @@ func Run() {
logger = log.With(logger, "ts", log.DefaultTimestampUTC)
logger = log.With(logger, "caller", log.DefaultCaller)

// Determine which tracer to use. We'll pass the tracer to all the
// components that use it, as a dependency
if *zipkinURL != "" {
logger.Log("tracer", "Zipkin", "URL", *zipkinURL)
collector, err := zipkingoopentracing.NewHTTPCollector(*zipkinURL)
if err != nil {
logger.Log("err", err)
os.Exit(1)
}
defer collector.Close()
recorder := zipkingoopentracing.NewRecorder(collector, false, "localhost:80", "bugs")
tracer, err = zipkingoopentracing.NewTracer(recorder)
if err != nil {
logger.Log("err", err)
os.Exit(1)
}
} else if *lightstepToken != "" {
if *lightstepToken != "" {
logger.Log("tracer", "LightStep")
tracer = lightsteptracergo.NewTracer(lightsteptracergo.Options{AccessToken: *lightstepToken})
defer lightsteptracergo.FlushLightStepTracer(tracer)
Expand Down
12 changes: 12 additions & 0 deletions 12-go-kit-1/bugs/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module github.com/plutov/packagemain/12-go-kit-1/bugs

go 1.13

require (
github.com/go-kit/kit v0.10.0
github.com/lightstep/lightstep-tracer-go v0.20.0
github.com/oklog/oklog v0.3.2
github.com/opentracing/opentracing-go v1.1.0
github.com/prometheus/client_golang v1.6.0
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0
)
424 changes: 424 additions & 0 deletions 12-go-kit-1/bugs/go.sum

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions 12-go-kit-1/bugs/pkg/endpoint/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package endpoint

import (
"context"

endpoint "github.com/go-kit/kit/endpoint"
service "github.com/plutov/packagemain/12-go-kit-1/bugs/pkg/service"
)
Expand Down
3 changes: 2 additions & 1 deletion 12-go-kit-1/bugs/pkg/endpoint/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package endpoint
import (
"context"
"fmt"
"time"

endpoint "github.com/go-kit/kit/endpoint"
log "github.com/go-kit/kit/log"
metrics "github.com/go-kit/kit/metrics"
"time"
)

// InstrumentingMiddleware returns an endpoint middleware that records
Expand Down
3 changes: 2 additions & 1 deletion 12-go-kit-1/bugs/pkg/http/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import (
"context"
"encoding/json"
"errors"
"net/http"

http1 "github.com/go-kit/kit/transport/http"
endpoint "github.com/plutov/packagemain/12-go-kit-1/bugs/pkg/endpoint"
"net/http"
)

// makeCreateHandler creates the handler logic
Expand Down
3 changes: 2 additions & 1 deletion 12-go-kit-1/bugs/pkg/http/handler_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
package http

import (
http1 "net/http"

http "github.com/go-kit/kit/transport/http"
endpoint "github.com/plutov/packagemain/12-go-kit-1/bugs/pkg/endpoint"
http1 "net/http"
)

// NewHTTPHandler returns a handler that makes a set of endpoints available on
Expand Down
1 change: 1 addition & 0 deletions 12-go-kit-1/bugs/pkg/service/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package service

import (
"context"

log "github.com/go-kit/kit/log"
)

Expand Down
20 changes: 20 additions & 0 deletions 12-go-kit-1/bugs/vendor/github.com/StackExchange/wmi/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2ebe331

Please sign in to comment.