Merge branch 'master' of github.com:hrasadi/microservices-demo
This commit is contained in:
commit
69f157dbac
19 changed files with 34 additions and 17 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -5,8 +5,7 @@ pkg/
|
|||
*.swp
|
||||
*~
|
||||
.vscode/
|
||||
.vs/slnx.sqlite
|
||||
.vs/microservices-demo/v15/.suo
|
||||
.vs/
|
||||
.idea
|
||||
.skaffold-*.yaml
|
||||
.kubernetes-manifests-*/
|
||||
|
|
|
@ -4,7 +4,7 @@ services:
|
|||
- docker
|
||||
|
||||
install:
|
||||
- curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/v0.16.0/skaffold-linux-amd64
|
||||
- curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/v0.18.0/skaffold-linux-amd64
|
||||
- chmod +x skaffold
|
||||
- sudo mv skaffold /usr/local/bin
|
||||
|
||||
|
|
|
@ -136,6 +136,12 @@ Find **Protocol Buffers Descriptions** at the [`./pb` directory](./pb).
|
|||
|
||||
kubectl get service frontend-external
|
||||
|
||||
**Troubleshooting:** A Kubernetes bug (will be fixed in 1.12) combined with
|
||||
a Skaffold [bug](https://github.com/GoogleContainerTools/skaffold/issues/887)
|
||||
causes load balancer to not to work even after getting an IP address. If you
|
||||
are seeing this, run `kubectl get service frontend-external -o=yaml | kubectl apply -f-`
|
||||
to trigger load balancer reconfiguration.
|
||||
|
||||
### (Optional) Deploying on a Istio-installed cluster
|
||||
|
||||
> **Note:** you followed GKE deployment steps above, run `skaffold delete` first
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
apiVersion: skaffold/v1alpha4
|
||||
apiVersion: skaffold/v1alpha5
|
||||
kind: Config
|
||||
build:
|
||||
artifacts:
|
||||
|
|
|
@ -25,7 +25,7 @@ repositories {
|
|||
group = "adservice"
|
||||
version = "0.1.0-SNAPSHOT" // CURRENT_OPENCENSUS_VERSION
|
||||
|
||||
def opencensusVersion = "0.16.1" // LATEST_OPENCENSUS_RELEASE_VERSION
|
||||
def opencensusVersion = "0.17.0" // LATEST_OPENCENSUS_RELEASE_VERSION
|
||||
def grpcVersion = "1.15.0" // CURRENT_GRPC_VERSION
|
||||
def jacksonVersion = "2.9.6"
|
||||
def prometheusVersion = "0.3.0"
|
||||
|
|
|
@ -207,16 +207,24 @@ public class AdService {
|
|||
// Registers logging trace exporter.
|
||||
LoggingTraceExporter.register();
|
||||
long sleepTime = 10; /* seconds */
|
||||
int maxAttempts = 3;
|
||||
int maxAttempts = 5;
|
||||
boolean statsExporterRegistered = false;
|
||||
boolean traceExporterRegistered = false;
|
||||
|
||||
for (int i=0; i<maxAttempts; i++) {
|
||||
try {
|
||||
StackdriverTraceExporter.createAndRegister(
|
||||
StackdriverTraceConfiguration.builder().build());
|
||||
StackdriverStatsExporter.createAndRegister(
|
||||
StackdriverStatsConfiguration.builder()
|
||||
.setExportInterval(Duration.create(15, 0))
|
||||
.build());
|
||||
if (!traceExporterRegistered) {
|
||||
StackdriverTraceExporter.createAndRegister(
|
||||
StackdriverTraceConfiguration.builder().build());
|
||||
traceExporterRegistered = true;
|
||||
}
|
||||
if (!statsExporterRegistered) {
|
||||
StackdriverStatsExporter.createAndRegister(
|
||||
StackdriverStatsConfiguration.builder()
|
||||
.setExportInterval(Duration.create(60, 0))
|
||||
.build());
|
||||
statsExporterRegistered = true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if (i==(maxAttempts-1)) {
|
||||
logger.log(Level.WARN, "Failed to register Stackdriver Exporter." +
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
<!-- This is a JSON format that can be read by the Stackdriver Logging agent. The trace and
|
||||
span IDs are interpreted by Stackdriver, and "traceSampled" is a custom field. -->
|
||||
<JsonLayout compact="true" eventEol="true">
|
||||
<KeyValuePair key="logging.googleapis.com/trace" value="$${ctx:opencensusTraceId}"/>
|
||||
<KeyValuePair key="logging.googleapis.com/spanId" value="$${ctx:opencensusSpanId}"/>
|
||||
<KeyValuePair key="traceSampled" value="$${ctx:opencensusTraceSampled}"/>
|
||||
<KeyValuePair key="logging.googleapis.com/trace" value="$${ctx:traceId}"/>
|
||||
<KeyValuePair key="logging.googleapis.com/spanId" value="$${ctx:spanId}"/>
|
||||
<KeyValuePair key="traceSampled" value="$${ctx:traceSampled}"/>
|
||||
</JsonLayout>
|
||||
|
||||
</Console>
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -99,6 +99,7 @@ func main() {
|
|||
}
|
||||
|
||||
func initStats(exporter *stackdriver.Exporter) {
|
||||
view.SetReportingPeriod(60 * time.Second)
|
||||
view.RegisterExporter(exporter)
|
||||
if err := view.Register(ocgrpc.DefaultServerViews...); err != nil {
|
||||
log.Warn("Error registering default server views")
|
||||
|
|
|
@ -35,7 +35,7 @@ PyGObject==3.30.1
|
|||
python-json-logger==0.1.9
|
||||
pytz==2018.5
|
||||
pyxdg==0.26
|
||||
requests==2.19.1
|
||||
requests==2.20.0
|
||||
rsa==4.0
|
||||
SecretStorage==3.1.0
|
||||
six==1.11.0
|
||||
|
|
|
@ -143,6 +143,7 @@ func main() {
|
|||
}
|
||||
|
||||
func initStats(log logrus.FieldLogger, exporter *stackdriver.Exporter) {
|
||||
view.SetReportingPeriod(60 * time.Second)
|
||||
view.RegisterExporter(exporter)
|
||||
if err := view.Register(ochttp.DefaultServerViews...); err != nil {
|
||||
log.Warn("Error registering http default server views")
|
||||
|
|
|
@ -90,6 +90,7 @@ func run(port int) string {
|
|||
}
|
||||
|
||||
func initStats(exporter *stackdriver.Exporter) {
|
||||
view.SetReportingPeriod(60 * time.Second)
|
||||
view.RegisterExporter(exporter)
|
||||
if err := view.Register(ocgrpc.DefaultServerViews...); err != nil {
|
||||
log.Info("Error registering default server views")
|
||||
|
|
|
@ -23,7 +23,7 @@ pyasn1-modules==0.2.2
|
|||
python-json-logger==0.1.9
|
||||
pytz==2018.5
|
||||
PyYAML==3.13
|
||||
requests==2.19.1
|
||||
requests==2.20.0
|
||||
rsa==3.4.2
|
||||
six==1.11.0
|
||||
uritemplate==3.0.0
|
||||
|
|
|
@ -129,6 +129,7 @@ func (s *server) ShipOrder(ctx context.Context, in *pb.ShipOrderRequest) (*pb.Sh
|
|||
}
|
||||
|
||||
func initStats(exporter *stackdriver.Exporter) {
|
||||
view.SetReportingPeriod(60 * time.Second)
|
||||
view.RegisterExporter(exporter)
|
||||
if err := view.Register(ocgrpc.DefaultServerViews...); err != nil {
|
||||
log.Warn("Error registering default server views")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue