From b8a8f8e593ce1376116d39092402d17ee4f8d2e7 Mon Sep 17 00:00:00 2001 From: Pierre Tessier Date: Mon, 22 Aug 2022 20:16:51 -0400 Subject: [PATCH 1/3] add baggage --- src/loadgenerator/locustfile.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/loadgenerator/locustfile.py b/src/loadgenerator/locustfile.py index 688ffe90a9..3e2bac2d0e 100644 --- a/src/loadgenerator/locustfile.py +++ b/src/loadgenerator/locustfile.py @@ -18,7 +18,7 @@ import uuid from locust import HttpUser, task, between -from opentelemetry import trace +from opentelemetry import context, baggage, trace from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import (BatchSpanProcessor) from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter @@ -211,18 +211,18 @@ def index(self): @task(10) def browse_product(self): - self.client.get("/product/" + random.choice(products)) + self.client.get("/api/products/" + random.choice(products)) @task(3) def view_cart(self): - self.client.get("/cart") + self.client.get("/api/cart") @task(2) def add_to_cart(self, user=""): if user == "": user = str(uuid.uuid1()) product = random.choice(products) - self.client.get("/product/" + product) + self.client.get("/api/products/" + product) cart_item = { "item": { "productId": product, @@ -252,4 +252,6 @@ def checkout_multi(self): self.client.post("/api/checkout", json=checkout_person) def on_start(self): + ctx = baggage.set_baggage("synthetic", "true") + context.attach(ctx) self.index() From 3727c6feaafadc4b9e9d642d74f089f418b8e6be Mon Sep 17 00:00:00 2001 From: Pierre Tessier Date: Mon, 22 Aug 2022 20:18:06 -0400 Subject: [PATCH 2/3] add baggage --- src/loadgenerator/locustfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/loadgenerator/locustfile.py b/src/loadgenerator/locustfile.py index 3e2bac2d0e..1574ed3b04 100644 --- a/src/loadgenerator/locustfile.py +++ b/src/loadgenerator/locustfile.py @@ -252,6 +252,6 @@ def checkout_multi(self): self.client.post("/api/checkout", json=checkout_person) def on_start(self): - ctx = baggage.set_baggage("synthetic", "true") + ctx = baggage.set_baggage("synthetic_request", "true") context.attach(ctx) self.index() From f5bb4ce457bdd86d0e2712a731a3684e3cc58a05 Mon Sep 17 00:00:00 2001 From: Pierre Tessier Date: Mon, 22 Aug 2022 20:20:46 -0400 Subject: [PATCH 3/3] add load generator baggage --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf33dddcd6..83d7fac7b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -83,3 +83,5 @@ significant modifications will be credited to OpenTelemetry Authors. ([#317](https://github.com/open-telemetry/opentelemetry-demo/pull/317)) * Updated Product Catalog to Match Astronomy Webstore ([#285](https://github.com/open-telemetry/opentelemetry-demo/pull/285)) +* Add `synthetic_request=true` baggage to load generator requests +([#331](https://github.com/open-telemetry/opentelemetry-demo/pull/331))