Commit graph

21 commits

Author SHA1 Message Date
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
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
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
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
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
33ca3b63d8
Unify jaeger enabling method for adservice. (#115) 2019-01-09 05:42:54 -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
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
Romain Vrignaud
52a9d346f6 Adservice: Add libc6-compat runtime dependency (#90)
Fixes #89
2018-10-29 09:57:43 -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
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
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
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
Ahmet Alp Balkan
360d983512
adservice: use grpc health checks (#29)
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2018-09-19 12:35:07 -07:00
rghetia
f35fdbcac3 Initial commit for Ads Service. (#21)
* Initial commit for Ads Service.

* update comments for AdsService and AdsServiceClient

* Refactor Ads to Ad
Move building AdService to Docker
Use default setting for Stackdriver Exporter.
Add license text.

* Revert the projectId

- also remove commented code from frontend/rpc.go

* Add adservie to skaffold.yaml

* Remove skaffold-adservice.yaml

* Replace personal projectId with demo projectId.

* Fix the crash in adservice when ran in locally.

* Ignore .skaffold*yaml file and .kubernetes-manifests-*/ dir for easy ProjectID switch.

* Fixed review comments.
1. Changed Ad redirect urls to products.
2. Removed leftovers from Dockerfile/kub*manifests*yaml
3. Added retry for StackDriver.
4. Added log for Ad request.
5. Added comment for gradle caching.
6. Added README.md to src/adservice.

* Added GRPC Health service to Ad Service
Also added
1. timeout to getAd RPC call in frontend.
2. Async thread for stackdriver init.
2018-08-22 17:02:46 -07:00