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)) diff --git a/src/loadgenerator/locustfile.py b/src/loadgenerator/locustfile.py index 688ffe90a9..1574ed3b04 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_request", "true") + context.attach(ctx) self.index()