Skip to content

Commit 0c4b412

Browse files
author
github-actions
committed
Merge remote-tracking branch 'upstream/main'
2 parents cd540e7 + 39f5e47 commit 0c4b412

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ the release.
2020
([#1727](https://github.com/open-telemetry/opentelemetry-demo/pull/1727))
2121
* [chore] Fix binding for host's volume mount
2222
([#1728](https://github.com/open-telemetry/opentelemetry-demo/pull/1728))
23+
* [frontend] fix imageSlowLoad headers not applied
24+
to 1.8.0 together with other dependencies
25+
([#1733](https://github.com/open-telemetry/opentelemetry-demo/pull/1733))
2326

2427
## 1.11.1
2528

src/frontend/components/ProductCard/ProductCard.tsx

+12-5
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ interface IProps {
1212
product: Product;
1313
}
1414

15-
async function getImageWithHeaders(url: RequestInfo, headers: Record<string, string>) {
16-
const res = await fetch(url, { headers });
15+
async function getImageWithHeaders(requestInfo: Request) {
16+
const res = await fetch(requestInfo);
1717
return await res.blob();
1818
}
1919

@@ -33,9 +33,16 @@ const ProductCard = ({
3333
const [imageSrc, setImageSrc] = useState<string>('');
3434

3535
useEffect(() => {
36-
const requestInfo = new Request('/images/products/' + picture);
37-
const headers = { 'x-envoy-fault-delay-request': imageSlowLoad.toString(), 'Cache-Control': 'no-cache' };
38-
getImageWithHeaders(requestInfo, headers).then(blob => {
36+
const headers = new Headers();
37+
headers.append('x-envoy-fault-delay-request', imageSlowLoad.toString());
38+
headers.append('Cache-Control', 'no-cache')
39+
const requestInit = {
40+
method: "GET",
41+
headers: headers
42+
};
43+
const image_url ='/images/products/' + picture
44+
const requestInfo = new Request(image_url, requestInit);
45+
getImageWithHeaders(requestInfo).then(blob => {
3946
setImageSrc(URL.createObjectURL(blob));
4047
});
4148
}, [imageSlowLoad, picture]);

src/productcatalogservice/main.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ func main() {
128128
}
129129
log.Println("Shutdown meter provider")
130130
}()
131+
openfeature.AddHooks(otelhooks.NewTracesHook())
131132
err := openfeature.SetProvider(flagd.NewProvider())
132133
if err != nil {
133134
log.Fatal(err)
@@ -300,7 +301,7 @@ func (p *productCatalog) checkProductFailure(ctx context.Context, id string) boo
300301
if id != "OLJCESPC7Z" {
301302
return false
302303
}
303-
openfeature.AddHooks(otelhooks.NewTracesHook())
304+
304305
client := openfeature.NewClient("productCatalog")
305306
failureEnabled, _ := client.BooleanValue(
306307
ctx, "productCatalogFailure", false, openfeature.EvaluationContext{},

0 commit comments

Comments
 (0)