Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wilsonwu/adservice
a compmenet of opentelemetry-demo
https://github.com/wilsonwu/adservice
Last synced: 23 days ago
JSON representation
a compmenet of opentelemetry-demo
- Host: GitHub
- URL: https://github.com/wilsonwu/adservice
- Owner: wilsonwu
- License: apache-2.0
- Created: 2022-10-20T07:30:53.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-08T13:41:04.000Z (almost 2 years ago)
- Last Synced: 2024-04-24T10:58:34.562Z (7 months ago)
- Language: Java
- Size: 592 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NOTE: The overall helm chart
https://github.com/openinsight-proj/openinsight-helm-charts
# adservice-springcloud
This repo re-implements opentelemetry-demo-webstore's adservice with nacos registry and sentinel.
## integrate list
- [x] nacos
- [x] sentinel## curl
```shell
grpcurl -plaintext -d '{"context_keys": ["binoculars","telescopes"]}' localhost:8080 hipstershop.AdService/GetAds
```## metrics
adservice-springcloud will emit two metrics:
| Name | Description | Unit | Type |
| -------------------------------------- | ------------------------ | ---- | --------- |
| adservice_grpc_call_total | record grpc call totals | N/A | Counter |
| adservice_grpc_duration_seconds_bucket | record grpc call latency | ms | histogram |## mock latency
the `hipstershop.AdService/GetAds` API will do a matrix calculation internally, you can use `-Dspring.matrixRow=200`
to specific the matrix size## mock error
the `hipstershop.AdService/GetAds` API will return error randomly(50%), you can use `-Dspring.randomError=false`
to disable this feature.## Integrate to Nacos and Sentinel
* Please notes the bootstrap.yml file:
```
adservice/src/main/resources/bootstrap.yml
```* Make sure your Dockerfile has: `JAVA_OPTS` env:
```
$JAVA_OPTS -jar /bin/xxx.jar
```* Update the `-D` parms as you want, example like below:
```
# Export Sentinel Prometheus metrics
-javaagent:./jmx_prometheus_javaagent-0.17.0.jar=12345:./prometheus-jmx-config.yaml \
# Enable Nacos integration
-Dspring.cloud.nacos.discovery.enabled=true \
# Nacos configuration server address
-Dspring.cloud.nacos.config.server-addr=nacos-test.skoala-test:8848 \
# Nacos service name
-Dspring.application.name=adservice-springcloud \
# Nacos registry server address
-Dspring.cloud.nacos.discovery.server-addr=nacos-test.skoala-test:8848 \
# For DCE 5.0 need below Kubernetes metadata
-Dspring.cloud.nacos.discovery.metadata.k8s_cluster_id=xxx \
-Dspring.cloud.nacos.discovery.metadata.k8s_cluster_name=xxx \
-Dspring.cloud.nacos.discovery.metadata.k8s_namespace_name=xxx \
-Dspring.cloud.nacos.discovery.metadata.k8s_workload_type=deployment \
-Dspring.cloud.nacos.discovery.metadata.k8s_workload_name=adservice-springcloud \
-Dspring.cloud.nacos.discovery.metadata.k8s_service_name=adservice-springcloud \
-Dspring.cloud.nacos.discovery.metadata.k8s_pod_name=${HOSTNAME} \
# Enable Sentinel integration
-Dspring.cloud.sentinel.enabled=true \
# Sentinel dashboard address
-Dspring.cloud.sentinel.transport.dashboard=nacos-test-sentinel.skoala-test:8080
```