Update build.gradle to use plugin DSL instead of outdated buildscript
Update gradle wrapper to 6.3
Update jackson, opencensus, grpc & other dependencies to recent versions
Fix code warnings
Properly format source files using goJF task
Add default port to AdService
* 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-logging33a1e118e1/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"
* 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
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.
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.
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 fix #58, while keeping the image size roughly the same:
```
emailservice latest d1b818eabe05 6 seconds ago 286MB
loadgenerator latest 4d9b5acbfbbb 6 seconds ago 125MB
```
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.
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.