Commit graph

319 commits

Author SHA1 Message Date
Megan O'Keefe
156dfcec8a
[cartservice] Increases health check timeout (#240)
* Increases cartservice health check rpc timeout

* remove stopwatch from health check

* cleanup

* Cleanup
2019-08-19 14:28:03 -04:00
Evans Wang
13b73067c4 Typo in the months drop down (#237) 2019-07-16 14:00:33 -07:00
Megan O'Keefe
bb41c7fe02
Updates stackdriver agents for node.js services (#236) 2019-07-11 11:47:31 -04:00
Megan O'Keefe
754d22a08f
Updates go services to google-cloud-go 0.40.0 (#234)
* Updates go services to google cloud go 0.40.0

* Revert kubernetes manifests, remove custom images

* Remove binary file, replace nil error with unimplemented

* Shippingservice needed status import

* Remove shippingservice binary
2019-07-09 16:57:50 -04:00
iasinDev
f575b76f33 Fix https://github.com/GoogleCloudPlatform/microservices-demo/issues/222 (#224) 2019-07-01 14:49:31 -07:00
Yoshi Yamaguchi
1c057fcbd8 aligning function name and log message to the official product name (#229)
* log: change log format to JSON payload for better log in Stackdriver

change the log format in Go written service from text payload to
JSON payload using 3rd party logging library (logrus).

https://cloud.google.com/logging/docs/structured-logging
33a1e118e1/json_formatter.go (L40-L49)

Effected services are frontend, productcatalogservice, checkoutservice,
and shippinservice.

Also change target container registry and locust scenario for testing.

* revert kubernetes manifests to point to the original container registry URLs

* revert skaffold.yaml to point to the original registry

* loadgenerator: revert locust settings

* align all function names and messages to the official product name "Stackdriver"
2019-06-13 00:46:33 -07:00
Dinesh Nagar
ce03eb3c36 removed left-pad module (#218) 2019-05-22 10:16:09 +02:00
Abhilash Gnan
55f5061532 Use env in service manifests for PORT (#212)
* fix shipping service ports

* fix product catalog servicde ports

* fix paymentservice ports

* fix currenservice ports

* fix checkoutservice ports

* fix emailservice ports

* fix frontend app ports

* fix recommendationservice ports

* fix indentation in service yaml files
2019-05-08 19:39:14 -07:00
Kalyana Chadalavada
876d4f966f Add Stackdriver Profiler Java agent to adservice (#210)
* Add Stackdriver Profiler Java agent to adservice.

* Add Stackdriver Profiler Java agent to adservice.
2019-05-08 19:31:33 -07:00
Kalyana Chadalavada
86fb1662a3 Add Stackdriver Profiler Python agent (#176)
* Add Stackdriver Profiler Python agent to EmailService and
RecommendationService

* Update recommendation_server.py

* Moved Profiler init to a function

* Moved Profiler init to a function

* Delete key.json

* Delete key.json

* Delete key.json
2019-05-03 10:29:34 -07:00
Chris Proto
f276995585 Follow OWASP best practices on CC presentation on checkout form (#207)
* Follow OWASP best practices on CC presentation on checkout form

See OWASP recommendations here:
<https://www.owasp.org/index.php/Handling_E-Commerce_Payments#Displaying_portions_of_the_credit_card>

* Use `input type=password`
* Set `autocomplete="off"`

* Change credit_card_number input type back to "text"
2019-04-30 09:46:50 -07:00
Pradip Caulagi
57b316c045 Update docker images for go to 1.12 (#203) 2019-04-01 10:50:44 -07:00
Ace Nassri
f7580958cc Switch currencyservice to static JSON file (#173) 2019-03-06 16:42:08 -08:00
sebright
d08d419a94 adservice: use Stackdriver special field to set sampling decision in log entries (#168)
This commit sets the new sampling decision field that is recognized by the
Stackdriver Logging agent, "logging.googleapis.com/traceSampled".  The sampling
decision field was added in
https://github.com/GoogleCloudPlatform/fluent-plugin-google-cloud/pull/297, and
it won't be available until the new version of fluent-plugin-google-cloud is
used in GKE.
2019-02-28 22:34:57 -07:00
Ahmet Alp Balkan
458bf50b95
credit card expired (#167)
fixes #164

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2019-02-27 09:54:18 -07:00
Selçuk Usta
e99d0808bf Fixing ./gradlew: Permission denied problem on Dockerfile (#146) 2019-02-15 08:22:48 -08:00
rghetia
741c669c34 adservice: restore old grpc views until new grpc version is released. (#144) 2019-02-14 18:14:42 -08:00
Bogdan Drutu
31df60f050 Updates deps, OC instrumentation, formatting. (#131) 2019-01-30 13:35:03 -08:00
Ahmet Alp Balkan
02b2018b0e
recommendationservice: compile deps from requirements.in (#135)
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2019-01-30 00:24:07 -08:00
Megan O'Keefe
1d045de655 productcatalog: introduce configurable latency (#134) 2019-01-29 16:08:24 -08:00
rghetia
3812cf741d fix typo in Stackdriver init method name. (#130) 2019-01-22 10:37:03 -08:00
sebright
2ef073f600 adservice: Add "time" field to JSON log entries. (#129)
The Log4j JsonLayout puts the log entry timestamp in a field named "instant" by
default, but the Stackdriver Logging agent does not understand that field.  The
logging agent instead uses the time that it received the log entry, which is
less accurate and has only second-level precision.

This commit adds a key-value pair to the JsonLayout pattern that can be
understood by the logging agent.  It uses a "time" key as described in
https://cloud.google.com/logging/docs/agent/configuration#timestamp-processing
and formats the timestamp as described in the Protocol Buffer JSON mapping,
https://developers.google.com/protocol-buffers/docs/proto3#json.

Allowing the Stackdriver Logging agent to read the more accurate timestamps
inserted by Log4j is especially important in the adservice, because the logs are
correlated with traces, and it is important to see where each message was logged
on the timeline of the trace.
2019-01-22 09:56:50 -08:00
rghetia
54f0a8d058 add jaeger support for productcatalog and shipping. (#126) 2019-01-22 09:56:39 -08:00
Dustin Ingram
aaf2f8717d Simplify package management for python services (#120)
This PR does a few things:

1. **Removes unnecessary Python dependencies currently being installed for `emailservice`**

    There are quite a few packages being installed that aren't actual dependencies.

2. **Removes a number of related, also unnecessary system-level dependencies for `emailservice`**

    These were a result of the Python dependencies that are unnecessary.

3. **Pins all of the sub-dependencies for `loadgenerator`**

    This is good practice to ensure that things don't break one day in the future when a newer version of an unpinned sub-dependenency is released.

4. **Compile all Python dependencies from `requirements.in` files**

    This is mostly bookkeeping. It allows us to only specify the top-level dependencies we care about in the requirements.in files, which are then compiled to frozen dependencies in the requirements.txt files. This ensures that we only install the dependencies we need, and that we're not missing any unpinned sub-dependencies. It also makes it more clear where our sub-dependencies are coming from.

5. **Switch to -slim images from -alpine**

    Python's built distribution format (wheel) is incompatible with alpine-based images, causing dependencies like `grpcio` to be compiled from scratch, rather than from a pre-built wheel.

    This should improve or possibly fi​x #58, while keeping the image size roughly the same:

    ```
    emailservice          latest           d1b818eabe05        6 seconds ago       286MB
    loadgenerator         latest           4d9b5acbfbbb        6 seconds ago       125MB
    ```
2019-01-11 14:59:27 -08:00
rghetia
2b074f7ff3
Add jaeger export to checkoutservice. (#116)
* Add jaeger export to checkoutservice.

* fix review comments.
2019-01-10 10:25:07 -08:00
rghetia
33ca3b63d8
Unify jaeger enabling method for adservice. (#115) 2019-01-09 05:42:54 -08:00
rghetia
85c7131d43 Add jaeger support for frontend. (#113) 2019-01-08 11:08:20 -08:00
rghetia
d944092100 Add Jaeger support for Adservice. (#111)
This is the first service that exports to jaeger. Others to follow.
Requires jaeger to be instantiated using 

- helm install --name jaeger stable/jaeger-operator
- kubectl apply -f jaeger.yaml

=== jaeger.yaml Content ===
apiVersion: io.jaegertracing/v1alpha1
kind: Jaeger
metadata:
  name: jaeger

Above steps will be added to README in subsequent PR.
2019-01-03 12:56:06 -08:00
Théo Chamley
c91dca764f Toggle bug in ProductCatalogService for demos (#85)
Fixes #84.
2018-12-17 11:06:49 -08:00
Chris Kleinknecht
5272a4d821 Re-enable opencensus python (#103)
Enables tracing in the email and recommendation services, which was disabled in 316db88 because of a memory leak in the stackdriver exporter.

We fixed the leak in https://github.com/googleapis/google-cloud-python/pull/6856. The fix is included in the [0.1.10 release of opencensus-python](https://github.com/census-instrumentation/opencensus-python/releases/tag/v0.1.10).

With this diff, traces show up as expected in stackdriver while running the demo on GKE. Using an `opencensus-python` package version before `0.1.10` causes the email and recommendation services to leak memory until they OOM. Memory use is back to normal (i.e. roughly constant) using the new package version.
2018-12-11 16:15:51 -08:00
rghetia
d69f1a4f25 increase reporting interval. (#96)
also fixed a bug in SD export registration in Ads.
2018-11-14 11:49:17 -08:00
sebright
b221f61f4f adservice: upgrade opencensus-java to 0.17.0. (#93)
0.17.0 is the first stable version of opencensus-contrib-log-correlation-log4j2.
This commit also updates log4j2.xml to work with the new version.
2018-11-05 09:45:34 -08:00
davidstanke
9b055cabfb update requests package (#92) 2018-10-29 20:39:44 -07:00
Romain Vrignaud
52a9d346f6 Adservice: Add libc6-compat runtime dependency (#90)
Fixes #89
2018-10-29 09:57:43 -07:00
Colin Nelson
a79a443892 Ignore .vs (#86)
Fixes #83
2018-10-23 14:44:29 -07:00
Ahmet Alp Balkan
781b6df8a0
Update README.md 2018-10-22 10:03:38 -07:00
Ahmet Alp Balkan
3b6d3864a0
grpc: bump health-probe to v0.2.0 (#71)
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2018-10-09 15:54:55 -07:00
Colin Nelson
34227a64a6 currencyservice: Optimized Docker image with multi stage builds, and using alpine as a base image. (#70) 2018-10-09 10:43:06 -07:00
Colin Nelson
571285d9aa Optimized adservice Image Size (#67)
* adservice: Reduced docker image size to ~165MB
(down from ~886MB) by switching to alpine and
using multi stage builds

* adservice: Changed install of glibc in builder to not require untrusted packages

* adservice: Refactored Dockerfile to be a multi stage build. The 'build' step runs from openjdk:8-slim, but the final image is alpine based. We can get away from this since java runs in a vm & the architecture of the images doesn't change between biuld steps
2018-10-09 10:42:49 -07:00
Yoshi Yamaguchi
7f40378ecc log: change log format to JSON payload for better log in Stackdriver (#66)
change the log format in Python and Node.js services.

Effected services are currencyservice, emailservice, paymentservice,
and recommendationservice. Loadgenerator is left as is because of
the diffculty to change the log format and log target in locust.

ref. #47
2018-10-05 11:23:45 -07:00
Ahmet Alp Balkan
2771a03727
k8s: start using grpc health check for cartservice (#63) 2018-10-01 23:20:42 -07:00
sebright
848d4bbe90 adservice: enable structured logging and OpenCensus log correlation (#59)
This commit enables OpenCensus log correlation using
opencensus-contrib-log-correlation-log4j2
(https://github.com/census-instrumentation/opencensus-java/tree/master/contrib/log_correlation/log4j2).
The library inserts the trace ID, span ID, and sampling decision into every
Log4j log event.  This commit includes other changes to make the tracing data
available in the logs, in a format that can be interpreted by the Stackdriver
Logging agent:

- Convert all adservice log statements from java.util.logging to Log4j.

- Specify a JSON format for Log4j output.  This is related to issue #47.

- Add the trace ID, span ID, and sampling decision to the JSON format.  Trace
  ID and span ID use special keys that the Stackdriver Logging agent uses to
  populate the tracing data fields in the LogEntry uploaded to Stackdriver
  (https://cloud.google.com/logging/docs/agent/configuration#special_fields_in_structured_payloads).
  However, Stackdriver won't be able to link the traces and log entries until
  fluent-plugin-google-cloud can automatically format the trace ID with the
  format expected by Stackdriver
  (https://github.com/GoogleCloudPlatform/fluent-plugin-google-cloud/issues/239,
  https://github.com/GoogleCloudPlatform/fluent-plugin-google-cloud/pull/260).

This commit also upgrades OpenCensus to 0.16.1 in order to use
opencensus-contrib-log-correlation-log4j2.
2018-10-01 22:45:09 -07:00
sebright
dc7effd601 adservice: find relevant ads by category (#61)
The ad service now returns ads matching the categories of the product that is
currently displayed.  Changes in this commit:

- List all products' categories in products.json.

- Pass the current product's categories from the frontend to the ad service when
  looking up ads.

- Store a statically initialized multimap from product category to ad in the ad
  service.

- Return all ads matching the given categories when handling an ads request.
  The ad service continues to return random ads when no categories are given or
  no ads match the categories.
2018-10-01 22:44:56 -07:00
sebright
86c8c06cc1 pb: add "categories" field to Product (#60)
This field can be used as the context keys to look up relevant ads in the ad
service.

/cc @rghetia 

I also ran the genproto.sh scripts for the Java and Go services and included those changes in the second commit.  I encountered an issue when I ran genproto.sh for the recommendation service, and I'm still looking into it.
2018-10-01 21:33:25 -07:00
Ahmet Alp Balkan
be65dd1fcd
cartservice: fix health Check() method signature (#57)
- Use the method provided in HealthBase
- Use the same version of GrpcHealth as Grpc core.

Fixes #50.
2018-09-28 12:52:06 -07:00
sebright
c61a8aea4c adservice: upgrade grpc-java to 1.15.0 (#54)
Upgrading grpc-java fixed an error that I encountered when I tried modifying the adservice to write logs to Stackdriver with google-cloud-logging ("`com.google.cloud.logging.LoggingException: io.grpc.StatusRuntimeException: UNAUTHENTICATED: Credentials require channel with PRIVACY_AND_INTEGRITY security level. Observed security level: NONE`").
2018-09-26 19:33:52 -07:00
Colin Nelson
7ced638e2f paymentservice: Docker image size optimization (#53)
Reduced docker image size to ~153MB (was ~781MB). 
* Uses alpine linux and multi stage builds. 
* Changed `CMD` to `ENTRYPOINT`
2018-09-26 10:58:33 -07:00
Colin Nelson
1263da2172 Reduced loadgenerator's image size (#52)
Reduce loadgenerator's image size from ~972MB to ~117MB

* Changed loadgen.sh to execute with `/bin/sh` as opposed to `/bin/bash`
* Changed dockerfile to a multi stage build
* Changed base image to `python:3-alpine` as opposed to `python:3.6`
2018-09-26 09:18:23 -07:00
Colin Nelson
2924250449 emailservice Image Optimization (#51)
Reduce docker image for emailservice to ~240 MB (down from ~ 1.31 GB)

Main application (`email_server.py`) now runs as python 2.7. Before we had both Python 2.7 and Python 3 installed in the image.

Switched to using `python:2.7-alpine3.8` as the base image, and used multi-stage dockerfiles to keep dependencies minimal.

Fixes #49 

From my shell:
```
$ docker build -t emailservice:dev . && docker run -it emailservice:dev
Sending build context to Docker daemon  97.28kB
Step 1/17 : FROM python:2.7-alpine3.8 as base
 ---> b2bc7255b42c
Step 2/17 : FROM base as builder
 ---> b2bc7255b42c
Step 3/17 : RUN apk add --update --no-cache     gcc     linux-headers     make     musl-dev     python-dev     g++     cairo-dev     cairo     openssl-dev     gobject-introspection-dev
 ---> Using cache
 ---> 6daf3d9fe49a
Step 4/17 : ENV GRPC_PYTHON_VERSION 1.15.0
 ---> Using cache
 ---> 3e33d97d9580
Step 5/17 : RUN python -m pip install --upgrade pip
 ---> Using cache
 ---> e8fa3879c282
Step 6/17 : RUN pip install grpcio==${GRPC_PYTHON_VERSION} grpcio-tools==${GRPC_PYTHON_VERSION}
 ---> Using cache
 ---> c6fba7743eed
Step 7/17 : COPY requirements.txt .
 ---> Using cache
 ---> 1f6b0a444980
Step 8/17 : RUN pip install -r requirements.txt
 ---> Using cache
 ---> 8cc0a7af6aa8
Step 9/17 : FROM base as final
 ---> b2bc7255b42c
Step 10/17 : RUN GRPC_HEALTH_PROBE_VERSION=v0.1.0-alpha.1 &&     wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 &&     chmod +x /bin/grpc_health_probe
 ---> Using cache
 ---> e954a0384081
Step 11/17 : ENV PYTHONUNBUFFERED=0
 ---> Using cache
 ---> 64ece3d72a66
Step 12/17 : WORKDIR /email_server
 ---> Using cache
 ---> 27b34dc14492
Step 13/17 : COPY --from=builder /usr/local/lib/python2.7/ /usr/local/lib/python2.7/
 ---> Using cache
 ---> 60035ec8dfd4
Step 14/17 : RUN apk add --no-cache libstdc++
 ---> Using cache
 ---> 920be90c126e
Step 15/17 : COPY . .
 ---> Using cache
 ---> 9541bed2d7a0
Step 16/17 : EXPOSE 8080
 ---> Using cache
 ---> 48fbeaa852b9
Step 17/17 : ENTRYPOINT [ "python", "email_server.py" ]
 ---> Using cache
 ---> ff317770992d
Successfully built ff317770992d
Successfully tagged emailservice:dev
starting the email service in dummy mode.
listening on port: 8080
```
2018-09-25 16:43:39 -07:00
Yoshi Yamaguchi
6460427bee Change log format to JSON and log destination to stdout (#48)
* log: change log format to JSON payload for better log in Stackdriver

change the log format in Go written service from text payload to
JSON payload using 3rd party logging library (logrus).

https://cloud.google.com/logging/docs/structured-logging
33a1e118e1/json_formatter.go (L40-L49)

Effected services are frontend, productcatalogservice, checkoutservice,
and shippinservice.

Also change target container registry and locust scenario for testing.

* revert kubernetes manifests to point to the original container registry URLs

* revert skaffold.yaml to point to the original registry

* loadgenerator: revert locust settings
2018-09-25 16:43:17 -07:00