Skip to content

Commit 7a964c1

Browse files
authored
Opentelemetry instrumentation (#105)
1 parent 6015c89 commit 7a964c1

File tree

52 files changed

+589
-173
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+589
-173
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ARG USER_GID=$USER_UID
88
RUN if [ "$USER_GID" != "1000" ] || [ "$USER_UID" != "1000" ]; then groupmod --gid $USER_GID vscode && usermod --uid $USER_UID --gid $USER_GID vscode; fi
99

1010
# [Option] Install Node.js
11-
ARG INSTALL_NODE="true"
11+
ARG INSTALL_NODE="false"
1212
ARG NODE_VERSION="lts/*"
1313
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
1414

.github/workflows/ci_workflow_dispatch.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ jobs:
4747
with:
4848
python-version: 3.12
4949

50-
- name: Install stringcase and typer
51-
id: setup-stringcase
52-
run: pip install stringcase typer
50+
- name: Install casefy and typer
51+
id: setup-casefy
52+
run: pip install casefy typer
5353

5454
- name: Extract service name for ${{ matrix.service }}
5555
id: extract-service-name

.github/workflows/docker_on_release.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ jobs:
137137
with:
138138
python-version: 3.12
139139

140-
- name: Install stringcase and typer
141-
id: setup-stringcase
142-
run: pip install stringcase typer
140+
- name: Install casefy and typer
141+
id: setup-casefy
142+
run: pip install casefy typer
143143

144144
- name: Extract service name for ${{ matrix.service }}
145145
id: extract-service-name

.github/workflows/push_to_docker/action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ runs:
5454
- name: Prepare Dockerfile
5555
id: prepare-dockerfile
5656
shell: bash
57-
run: cp Dockerfile services/${{ inputs.service }}/ && sed -i "s/\(ENTRYPOINT \)\[\]/\1[\"${{ inputs.service }}\"]/" services/${{ inputs.service }}/Dockerfile
57+
run: cp Dockerfile services/${{ inputs.service }}/ && sed -i "s/\(ENTRYPOINT \)\[\]/\1[\"opentelemetry-instrument\", \"${{ inputs.service }}\"]/" services/${{ inputs.service }}/Dockerfile
5858

5959
- name: Set up QEMU
6060
uses: docker/setup-qemu-action@v3

.pyproject_generation/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
Copyright 2021 - 2023 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
2+
Copyright 2021 - 2025 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
33
for the German Human Genome-Phenome Archive (GHGA)
44
55
Licensed under the Apache License, Version 2.0 (the "License");

.pyproject_generation/pyproject_custom.toml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,23 @@ name = "fsb"
33
version = "1.0.0"
44
description = "File Services Backend - monorepo housing file services"
55
dependencies = [
6-
"typer >= 0.12",
7-
"ghga-service-commons[api, auth, crypt] >= 3.4",
6+
"typer >= 0.15",
7+
"ghga-service-commons[api, auth, crypt] >= 4.0",
88
"ghga-event-schemas >= 5.0",
9-
"hexkit[akafka, s3, mongodb] >= 4.2.0",
10-
"crypt4gh>=1.6",
11-
"hvac>=2",
12-
"httpx>=0.27",
9+
"hexkit[akafka, s3, mongodb] >= 4.3.0",
10+
"crypt4gh >= 1.7",
11+
"hvac >= 2",
12+
"httpx >= 0.28",
13+
"opentelemetry-api >= 1.31.1",
14+
"opentelemetry-sdk >= 1.31.1",
15+
"opentelemetry-exporter-otlp-proto-http >= 1.31.1",
16+
"opentelemetry-distro >= 0.52b1",
17+
"opentelemetry-instrumentation >= 0.52b1",
18+
"opentelemetry-instrumentation-aiokafka >= 0.52b1",
19+
"opentelemetry-instrumentation-botocore >= 0.52b1",
20+
"opentelemetry-instrumentation-fastapi >= 0.52b1",
21+
"opentelemetry-instrumentation-httpx >= 0.52b1",
22+
"opentelemetry-instrumentation-pymongo >= 0.52b1",
1323
]
1424

1525
[project.urls]

.pyproject_generation/pyproject_template.toml

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ exclude = [
2626
]
2727
line-length = 88
2828
src = [
29-
"services",
29+
"services/**/src",
30+
"services/**/tests_*",
3031
"examples",
3132
"scripts",
3233
]
@@ -40,8 +41,9 @@ fixable = [
4041
"RUF022", # sort items in __all__
4142
]
4243
ignore = [
43-
"E",
44-
"W",
44+
"E111", # indentation with invalid multiple (for formatter)
45+
"E114", # indentation with invalid multiple comment (for formatter)
46+
"E116", # over indentation (for formatter)
4547
"PLW", # pylint warnings
4648
"RUF001", # ambiguous unicode character strings
4749
"RUF010", # explicit conversion to string or repr: !s or !r
@@ -76,30 +78,11 @@ select = [
7678
max-complexity = 10
7779

7880
[tool.ruff.lint.per-file-ignores]
79-
"scripts/*" = [
80-
"PL",
81-
"S",
82-
"SIM",
83-
"D",
84-
]
85-
"services/*/tests_*" = [
86-
"S",
87-
"SIM",
88-
"PLR",
89-
"B011",
90-
]
91-
".devcontainer/*" = [
92-
"S",
93-
"SIM",
94-
"D",
95-
]
96-
"examples/*" = [
97-
"S",
98-
"D",
99-
]
100-
"__init__.py" = [
101-
"D",
102-
]
81+
"scripts/*" = ["PL", "S", "SIM", "D"]
82+
"services/**/tests_*" = ["S", "SIM", "PLR", "B011"]
83+
".devcontainer/*" = ["S", "SIM", "D"]
84+
"examples/*" = ["S","D"]
85+
"__init__.py" = ["D"]
10386

10487
[tool.ruff.lint.pydocstyle]
10588
convention = "pep257"
@@ -117,8 +100,9 @@ no_site_packages = false
117100
explicit_package_bases = true
118101

119102
[tool.pytest.ini_options]
120-
minversion = "8.0"
103+
minversion = "8.3"
121104
asyncio_mode = "strict"
105+
asyncio_default_fixture_loop_scope = "function"
122106

123107
[tool.coverage.paths]
124108
source = [

.readme_generation/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
Copyright 2021 - 2023 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
2+
Copyright 2021 - 2025 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
33
for the German Human Genome-Phenome Archive (GHGA)
44
55
Licensed under the Apache License, Version 2.0 (the "License");

.readme_generation/readme_template_service.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ $description
1010

1111
We recommend using the provided Docker container.
1212

13-
A pre-build version is available at [docker hub](https://hub.docker.com/repository/docker/ghga/$name):
13+
A pre-built version is available at [docker hub](https://hub.docker.com/repository/docker/ghga/$name):
1414
```bash
1515
docker pull ghga/$name:$version
1616
```
@@ -49,9 +49,9 @@ $config_description
4949

5050
A template YAML for configuring the service can be found at
5151
[`./example-config.yaml`](./example-config.yaml).
52-
Please adapt it, rename it to `.$shortname.yaml`, and place it into one of the following locations:
53-
- in the current working directory were you are execute the service (on unix: `./.$shortname.yaml`)
54-
- in your home directory (on unix: `~/.$shortname.yaml`)
52+
Please adapt it, rename it to `.$shortname.yaml`, and place it in one of the following locations:
53+
- in the current working directory where you execute the service (on Linux: `./.$shortname.yaml`)
54+
- in your home directory (on Linux: `~/.$shortname.yaml`)
5555

5656
The config yaml will be automatically parsed by the service.
5757

@@ -65,7 +65,7 @@ e.g. for the `host` set an environment variable named `${shortname}_host`
6565
(you may use both upper or lower cases, however, it is standard to define all env
6666
variables in upper cases).
6767

68-
To using file secrets please refer to the
68+
To use file secrets, please refer to the
6969
[corresponding section](https://pydantic-docs.helpmanual.io/usage/settings/#secret-support)
7070
of the pydantic documentation.
7171

@@ -92,8 +92,8 @@ This will give you a full-fledged, pre-configured development environment includ
9292
- a pre-configured debugger
9393
- automatic license-header insertion
9494

95-
Moreover, inside the devcontainer, a convenience commands `dev_install` is available.
96-
It installs the service with all development dependencies, installs pre-commit.
95+
Moreover, inside the devcontainer, a command `dev_install` is available for convenience.
96+
It installs the service with all development dependencies, and it installs pre-commit.
9797

9898
The installation is performed automatically when you build the devcontainer. However,
9999
if you update dependencies in the [`./pyproject.toml`](./pyproject.toml) or the

.template/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
Copyright 2021 - 2023 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
2+
Copyright 2021 - 2025 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
33
for the German Human Genome-Phenome Archive (GHGA)
44
55
Licensed under the Apache License, Version 2.0 (the "License");

0 commit comments

Comments
 (0)