Skip to content

Commit 08cb5de

Browse files
author
shopwareBot
committed
[create-pull-request] automated change
1 parent 83c0737 commit 08cb5de

File tree

3 files changed

+80
-0
lines changed

3 files changed

+80
-0
lines changed

SUMMARY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,8 @@
479479
* [Mocking repositories](resources/references/adr/2023-04-01-mocking-repositories.md)
480480
* [Disable css autoprefixer](resources/references/adr/2023-04-03-disable-css-autoprefixer.md)
481481
* [Jest test files should be javascript only](resources/references/adr/2023-04-14-jest-test-files-should-be-javascript-only.md)
482+
* [Switch to uuidv7](resources/references/adr/2023-05-22-switch-to-uuidv7.md)
483+
* [Exception log levels](resources/references/adr/2023-05-25-exception-log-levels.md)
482484
* [YYYY MM DD template](resources/references/adr/YYYY-MM-DD-template.md)
483485

484486
* [App Reference](resources/references/app-reference/README.md)
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
title: Switch to UUIDv7
3+
date: 2023-05-22
4+
area: core
5+
tags: [DAL]
6+
---
7+
8+
# Switch to UUIDv7
9+
10+
{% hint style="info" %}
11+
This document represents an architecture decision record (ADR) and has been mirrored from the ADR section in our Shopware 6 repository.
12+
You can find the original version [here](https://github.com/shopware/platform/blob/trunk/adr/2023-05-22-switch-to-uuidv7.md)
13+
{% endhint %}
14+
15+
## Context
16+
17+
Using UUIDs as primary keys eases the integration of several different datasources,
18+
but it also brings some performance issues.
19+
20+
Currently, we're using UUIDv4, which is a random UUID the completely random prefix means
21+
that the B-tree indexes of the database are not very efficient.
22+
23+
UUIDv7 time based prefix is less spread than that of UUIDv4, this helps the database to keep the index more compact.
24+
It allows the Index to allocate fewer new pages and to keep the index smaller.
25+
26+
## Decision
27+
28+
Considering there is little risk to using UUIDv7, as v4 and v7 share the same
29+
length and are indistinguishable for shopware, we can switch to v7 without any risk
30+
of breaking anything.
31+
32+
The effort is also very low as we only need to change the
33+
implementation of the `Uuid` class. As using UUIDv7 will improve the speed of
34+
bulk product inserts by about 8 %, we think the effort is worth the measurable and
35+
theoretical gain.
36+
37+
## Consequences
38+
39+
We will switch to UUIDv7 as default and add performance guides promoting v7.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
title: Exception Log Level configuration
3+
date: 2023-05-25
4+
area: core
5+
tags: [core, devops, observability]
6+
---
7+
8+
# Exception Log Level configuration
9+
10+
{% hint style="info" %}
11+
This document represents an architecture decision record (ADR) and has been mirrored from the ADR section in our Shopware 6 repository.
12+
You can find the original version [here](https://github.com/shopware/platform/blob/trunk/adr/2023-05-25-exception-log-levels.md)
13+
{% endhint %}
14+
15+
## Context
16+
By default every exception that is thrown in the PHP stack and not catched will be logged by the `symfony/monolog-bridge` on `error` level.
17+
But there are some cases where the exception is caused by clients accessing the API wrong (missing fields etc.) and throwing an `ShopwareHttpException` with a HTTP-Status-Code of 40x is our way of handling such situations and returning a correct HTTP-Status-Code to the client.
18+
So those cases are in fact no "errors" that need to be analyzed, but are expected given a malformed API request.
19+
Logging those cases as "errors" produces a lot of noice, which makes it harder to actually find errors in the logs.
20+
21+
For our cloud product we already used a configuration list that configures that some Exception classes should only be logged as notices.
22+
23+
## Decision
24+
25+
We add configuration to the platform that degrades the error level of specific exceptions to notices. This way external hosters can also profit from our classification.
26+
We use [symfony's `exceptions` configuration](https://symfony.com/doc/current/reference/configuration/framework.html#exceptions) for this.
27+
28+
This has the benefit that for specific projects this configuration could be adjusted, for example for cases where you also controll all clients that access the shop, you may want to log also every client error, just to help debugging the client.
29+
30+
Another solution could be to do the configuration of the log level directly in the exception class either by attributes or a separate method specifying the log level, but that would make overwriting it for a specific project harder, so we stick to the default symfony configuration.
31+
32+
## Consequences
33+
34+
We will add the `exceptions` configuration to the platform, that way the error logging in existing projects might change. But in general we assume that this change is for the better.
35+
36+
Additionally we will need to extend on the default symfony configuration as that is not compatible with our new [domain exceptions](./2022-02-24-domain-exceptions.md) as there are multiple exception cases in one file/class.
37+
Therefore we will add a similiar configuration option, that does not rely on the FQCN, but instead we will use the shopware specific `error code` from the shopware exception as that is unique to the exception case.
38+
39+
On a side note we should be able to get rid of most the cloud specific configuration for the exception logging mapping.

0 commit comments

Comments
 (0)