Skip to content

Commit

Permalink
Merge pull request #90 from NipunaMadhushan/main
Browse files Browse the repository at this point in the history
Update observability configurations
  • Loading branch information
NipunaMadhushan authored Dec 14, 2023
2 parents 26406d8 + 1cc0245 commit b45b8a5
Show file tree
Hide file tree
Showing 29 changed files with 121 additions and 141 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/daily-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
schedule:
- cron: '0 */12 * * *'

env:
BALLERINA_VERSION: 2201.8.4 # Update this with the latest Ballerina version

jobs:
build:
if: github.repository_owner == 'ballerina-guides'
Expand All @@ -23,7 +26,7 @@ jobs:
- uses: ballerina-platform/setup-ballerina@v1
name: Install Ballerina
with:
version: 2201.2.3
version: ${{ env.BALLERINA_VERSION }}
- name: Pack gRPC Stub Module
working-directory: "client_stubs"
run: bal pack
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
branches-ignore:
- master

env:
BALLERINA_VERSION: 2201.8.4 # Update this with the latest Ballerina version

jobs:
build:
if: github.repository_owner == 'ballerina-guides'
Expand All @@ -25,7 +28,7 @@ jobs:
- uses: ballerina-platform/setup-ballerina@v1
name: Install Ballerina
with:
version: 2201.2.3
version: ${{ env.BALLERINA_VERSION }}
- name: Pack gRPC Stub Module
working-directory: "client_stubs"
run: bal pack
Expand Down
8 changes: 2 additions & 6 deletions adservice/docker/Config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,5 @@ tracingEnabled=true
tracingProvider="jaeger"

[ballerinax.jaeger]
agentHostname="jaeger"
agentPort=55680
samplerType="const"
samplerParam=1.0
reporterFlushInterval=2000
reporterBufferSize=1000
agentHostname="localhost"
agentPort=4317
8 changes: 2 additions & 6 deletions adservice/k8s/Config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,5 @@ tracingEnabled=true
tracingProvider="jaeger"

[ballerinax.jaeger]
agentHostname="jaeger"
agentPort=55680
samplerType="const"
samplerParam=1.0
reporterFlushInterval=2000
reporterBufferSize=1000
agentHostname="localhost"
agentPort=4317
10 changes: 3 additions & 7 deletions cartservice/docker/Config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
tracingEnabled=true
tracingProvider="jaeger"

[ballerinax.jaeger]
agentHostname="jaeger"
agentPort=55680
samplerType="const"
samplerParam=1.0
reporterFlushInterval=2000
reporterBufferSize=1000
[ballerinax.jaeger]
agentHostname="localhost"
agentPort=4317
8 changes: 2 additions & 6 deletions cartservice/k8s/Config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,5 @@ tracingEnabled=true
tracingProvider="jaeger"

[ballerinax.jaeger]
agentHostname="jaeger"
agentPort=55680
samplerType="const"
samplerParam=1.0
reporterFlushInterval=2000
reporterBufferSize=1000
agentHostname="localhost"
agentPort=4317
8 changes: 2 additions & 6 deletions checkoutservice/docker/Config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,5 @@ tracingEnabled=true
tracingProvider="jaeger"

[ballerinax.jaeger]
agentHostname="jaeger"
agentPort=55680
samplerType="const"
samplerParam=1.0
reporterFlushInterval=2000
reporterBufferSize=1000
agentHostname="localhost"
agentPort=4317
8 changes: 2 additions & 6 deletions checkoutservice/k8s/Config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,5 @@ tracingEnabled=true
tracingProvider="jaeger"

[ballerinax.jaeger]
agentHostname="jaeger"
agentPort=55680
samplerType="const"
samplerParam=1.0
reporterFlushInterval=2000
reporterBufferSize=1000
agentHostname="localhost"
agentPort=4317
14 changes: 14 additions & 0 deletions client_stubs/docker/Config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
catalogHost="catalog"
cartHost="cart"
currencyHost="currency"
shippingHost="shipping"
paymentHost="payment"
emailHost="email"

[ballerina.observe]
tracingEnabled=true
tracingProvider="jaeger"

[ballerinax.jaeger]
agentHostname="localhost"
agentPort=4317
20 changes: 20 additions & 0 deletions client_stubs/k8s/Config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
catalogHost="catalog-service"
cartHost="cart-service"
currencyHost="currency-service"
shippingHost="shipping-service"
paymentHost="payment-service"
emailHost="email-service"
cartTimeout=3.0
catalogTimeout=3.0
currencyTimeout=3.0
shippingTimeout=3.0
paymentTimeout=3.0
emailTimeout=3.0

[ballerina.observe]
tracingEnabled=true
tracingProvider="jaeger"

[ballerinax.jaeger]
agentHostname="localhost"
agentPort=4317
8 changes: 2 additions & 6 deletions currencyservice/docker/Config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,5 @@ tracingEnabled=true
tracingProvider="jaeger"

[ballerinax.jaeger]
agentHostname="jaeger"
agentPort=55680
samplerType="const"
samplerParam=1.0
reporterFlushInterval=2000
reporterBufferSize=1000
agentHostname="localhost"
agentPort=4317
8 changes: 2 additions & 6 deletions currencyservice/k8s/Config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,5 @@ tracingEnabled=true
tracingProvider="jaeger"

[ballerinax.jaeger]
agentHostname="jaeger"
agentPort=55680
samplerType="const"
samplerParam=1.0
reporterFlushInterval=2000
reporterBufferSize=1000
agentHostname="localhost"
agentPort=4317
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
ports:
- 16686:16686
- 13133:13133
- 55680:55680
- 4317:4317
ads:
image: wso2inc/ads-service:v0.1.0
volumes:
Expand Down
8 changes: 2 additions & 6 deletions emailservice/ObserveConfig.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,5 @@ tracingEnabled=true
tracingProvider="jaeger"

[ballerinax.jaeger]
agentHostname="jaeger"
agentPort=55680
samplerType="const"
samplerParam=1.0
reporterFlushInterval=2000
reporterBufferSize=1000
agentHostname="localhost"
agentPort=4317
14 changes: 14 additions & 0 deletions emailservice/docker/Config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
catalogHost="catalog"
cartHost="cart"
currencyHost="currency"
shippingHost="shipping"
paymentHost="payment"
emailHost="email"

[ballerina.observe]
tracingEnabled=true
tracingProvider="jaeger"

[ballerinax.jaeger]
agentHostname="localhost"
agentPort=4317
23 changes: 12 additions & 11 deletions emailservice/email_service.bal
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,16 @@ service "EmailService" on new grpc:Listener(9097) {
private final gmail:Client gmailClient;

function init() returns error? {
self.gmailClient = check new ({
auth: {
refreshUrl: gmail:REFRESH_URL,
refreshToken: gmailConfig.refreshToken,
clientId: gmailConfig.clientId,
clientSecret: gmailConfig.clientSecret
self.gmailClient = check new gmail:Client(
config = {
auth: {
refreshToken: gmailConfig.refreshToken,
clientId: gmailConfig.clientId,
clientSecret: gmailConfig.clientSecret
}
}
});
);

log:printInfo("Email service gRPC server started.");
}

Expand All @@ -62,12 +64,11 @@ service "EmailService" on new grpc:Listener(9097) {
log:printInfo(string `Received a request to send order confirmation email to ${request.email}.`);

gmail:MessageRequest messageRequest = {
recipient: request.email,
to: [request.email],
subject: "Your Confirmation Email",
messageBody: (check getConfirmationHtml(request.'order)).toString(),
contentType: gmail:TEXT_HTML
bodyInHtml: (check getConfirmationHtml(request.'order)).toString()
};
gmail:Message|error sendMessageResponse = self.gmailClient->sendMessage(messageRequest);
gmail:Message|error sendMessageResponse = check self.gmailClient->/users/[request.email]/messages/send.post(messageRequest);
if sendMessageResponse is error {
log:printError("An error occurred when sending the order confirmation email ", sendMessageResponse);
return sendMessageResponse;
Expand Down
8 changes: 2 additions & 6 deletions emailservice/k8s/Config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,5 @@ tracingEnabled=true
tracingProvider="jaeger"

[ballerinax.jaeger]
agentHostname="jaeger"
agentPort=55680
samplerType="const"
samplerParam=1.0
reporterFlushInterval=2000
reporterBufferSize=1000
agentHostname="localhost"
agentPort=4317
8 changes: 5 additions & 3 deletions frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ AuthInterceptor authInterceptor = new;
cors: {
allowOrigins: ["http://localhost:3000"],
allowCredentials: true
},
interceptors: [new AuthInterceptor()]
}
}
service / on new http:Listener (9098) {
service http:InterceptableService / on new http:Listener (9098) {
public function createInterceptors() returns AuthInterceptor {
return authInterceptor;
}
}
```

Expand Down
8 changes: 2 additions & 6 deletions frontend/docker/Config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,5 @@ tracingEnabled=true
tracingProvider="jaeger"

[ballerinax.jaeger]
agentHostname="jaeger"
agentPort=55680
samplerType="const"
samplerParam=1.0
reporterFlushInterval=2000
reporterBufferSize=1000
agentHostname="localhost"
agentPort=4317
8 changes: 2 additions & 6 deletions frontend/k8s/Config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,5 @@ tracingEnabled=true
tracingProvider="jaeger"

[ballerinax.jaeger]
agentHostname="jaeger"
agentPort=55680
samplerType="const"
samplerParam=1.0
reporterFlushInterval=2000
reporterBufferSize=1000
agentHostname="localhost"
agentPort=4317
9 changes: 6 additions & 3 deletions frontend/service.bal
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,13 @@ service class AuthInterceptor {
cors: {
allowOrigins: ["http://localhost:3000"],
allowCredentials: true
},
interceptors: [new AuthInterceptor()]
}
}
@display {
label: "Frontend",
id: "frontend"
}
service / on new http:Listener(9098) {
service http:InterceptableService / on new http:Listener(9098) {

function init() {
log:printInfo("Frontend server started.");
Expand Down Expand Up @@ -370,4 +369,8 @@ service / on new http:Listener(9098) {
return from stubs:CartItem {product_id} in cart.items
select product_id;
}

public function createInterceptors() returns AuthInterceptor {
return new AuthInterceptor();
}
}
8 changes: 2 additions & 6 deletions paymentservice/docker/Config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,5 @@ tracingEnabled=true
tracingProvider="jaeger"

[ballerinax.jaeger]
agentHostname="jaeger"
agentPort=55680
samplerType="const"
samplerParam=1.0
reporterFlushInterval=2000
reporterBufferSize=1000
agentHostname="localhost"
agentPort=4317
8 changes: 2 additions & 6 deletions paymentservice/k8s/Config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,5 @@ tracingEnabled=true
tracingProvider="jaeger"

[ballerinax.jaeger]
agentHostname="jaeger"
agentPort=55680
samplerType="const"
samplerParam=1.0
reporterFlushInterval=2000
reporterBufferSize=1000
agentHostname="localhost"
agentPort=4317
8 changes: 2 additions & 6 deletions productcatalogservice/docker/Config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,5 @@ tracingEnabled=true
tracingProvider="jaeger"

[ballerinax.jaeger]
agentHostname="jaeger"
agentPort=55680
samplerType="const"
samplerParam=1.0
reporterFlushInterval=2000
reporterBufferSize=1000
agentHostname="localhost"
agentPort=4317
8 changes: 2 additions & 6 deletions productcatalogservice/k8s/Config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,5 @@ tracingEnabled=true
tracingProvider="jaeger"

[ballerinax.jaeger]
agentHostname="jaeger"
agentPort=55680
samplerType="const"
samplerParam=1.0
reporterFlushInterval=2000
reporterBufferSize=1000
agentHostname="localhost"
agentPort=4317
8 changes: 2 additions & 6 deletions recommendationservice/docker/Config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,5 @@ tracingEnabled=true
tracingProvider="jaeger"

[ballerinax.jaeger]
agentHostname="jaeger"
agentPort=55680
samplerType="const"
samplerParam=1.0
reporterFlushInterval=2000
reporterBufferSize=1000
agentHostname="localhost"
agentPort=4317
8 changes: 2 additions & 6 deletions recommendationservice/k8s/Config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,5 @@ tracingEnabled=true
tracingProvider="jaeger"

[ballerinax.jaeger]
agentHostname="jaeger"
agentPort=55680
samplerType="const"
samplerParam=1.0
reporterFlushInterval=2000
reporterBufferSize=1000
agentHostname="localhost"
agentPort=4317
Loading

0 comments on commit b45b8a5

Please sign in to comment.