From 9e1dede66c403bbc6b3a79b1ab60fae28587383a Mon Sep 17 00:00:00 2001 From: Christoph Zwerschke Date: Wed, 31 Jul 2024 17:38:01 +0000 Subject: [PATCH] Bump version --- .pyproject_generation/pyproject_custom.toml | 4 +- README.md | 45 ++++++++++---- config_schema.json | 65 ++++++++++++++++----- example_config.yaml | 3 + pyproject.toml | 4 +- 5 files changed, 93 insertions(+), 28 deletions(-) diff --git a/.pyproject_generation/pyproject_custom.toml b/.pyproject_generation/pyproject_custom.toml index 41baa30..47121cd 100644 --- a/.pyproject_generation/pyproject_custom.toml +++ b/.pyproject_generation/pyproject_custom.toml @@ -1,9 +1,9 @@ [project] name = "metldata" -version = "2.1.0" +version = "2.1.1" description = "metldata - A framework for handling metadata based on ETL, CQRS, and event sourcing." dependencies = [ - "hexkit[akafka,mongodb] ~= 3.5.0", + "hexkit[akafka,mongodb] >=3.5.0, <4", "ghga-service-commons[api,auth] >=3.1.1, <4", "ghga-event-schemas >=3.0.0, <4", "typer>=0.12", diff --git a/README.md b/README.md index 48095dc..664ae0e 100644 --- a/README.md +++ b/README.md @@ -58,13 +58,13 @@ We recommend using the provided Docker container. A pre-build version is available at [docker hub](https://hub.docker.com/repository/docker/ghga/metldata): ```bash -docker pull ghga/metldata:2.1.0 +docker pull ghga/metldata:2.1.1 ``` Or you can build the container yourself from the [`./Dockerfile`](./Dockerfile): ```bash # Execute in the repo's root dir: -docker build -t ghga/metldata:2.1.0 . +docker build -t ghga/metldata:2.1.1 . ``` For production-ready deployment, we recommend using Kubernetes, however, @@ -72,7 +72,7 @@ for simple use cases, you could execute the service using docker on a single server: ```bash # The entrypoint is preconfigured: -docker run -p 8080:8080 ghga/metldata:2.1.0 --help +docker run -p 8080:8080 ghga/metldata:2.1.1 --help ``` If you prefer not to use containers, you may install the service from source: @@ -89,35 +89,60 @@ metldata --help ### Parameters The service requires the following configuration parameters: -- **`db_connection_str`** *(string, format: password)*: MongoDB connection string. Might include credentials. For more information see: https://naiveskill.com/mongodb-connection-string/. +- **`log_level`** *(string)*: The minimum log level to capture. Must be one of: `["CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG", "TRACE"]`. Default: `"INFO"`. + +- **`service_name`** *(string)*: Default: `"metldata"`. + +- **`service_instance_id`** *(string)*: A string that uniquely identifies this instance across all instances of this service. A globally unique Kafka client ID will be created by concatenating the service_name and the service_instance_id. Examples: ```json - "mongodb://localhost:27017" + "germany-bw-instance-001" ``` -- **`db_name`** *(string)*: Name of the database located on the MongoDB server. +- **`log_format`**: If set, will replace JSON formatting with the specified string format. If not set, has no effect. In addition to the standard attributes, the following can also be specified: timestamp, service, instance, level, correlation_id, and details. Default: `null`. + + - **Any of** + + - *string* + + - *null* Examples: ```json - "my-database" + "%(timestamp)s - %(service)s - %(level)s - %(message)s" ``` -- **`service_name`** *(string)*: Default: `"metldata"`. + ```json + "%(asctime)s - Severity: %(levelno)s - %(msg)s" + ``` -- **`service_instance_id`** *(string)*: A string that uniquely identifies this instance across all instances of this service. A globally unique Kafka client ID will be created by concatenating the service_name and the service_instance_id. + +- **`log_traceback`** *(boolean)*: Whether to include exception tracebacks in log messages. Default: `true`. + +- **`db_connection_str`** *(string, format: password)*: MongoDB connection string. Might include credentials. For more information see: https://naiveskill.com/mongodb-connection-string/. Examples: ```json - "germany-bw-instance-001" + "mongodb://localhost:27017" + ``` + + +- **`db_name`** *(string)*: Name of the database located on the MongoDB server. + + + Examples: + + ```json + "my-database" ``` diff --git a/config_schema.json b/config_schema.json index e368c87..0a680cb 100644 --- a/config_schema.json +++ b/config_schema.json @@ -104,6 +104,56 @@ "additionalProperties": false, "description": "Modifies the original Settings class provided by the user", "properties": { + "log_level": { + "default": "INFO", + "description": "The minimum log level to capture.", + "enum": [ + "CRITICAL", + "ERROR", + "WARNING", + "INFO", + "DEBUG", + "TRACE" + ], + "title": "Log Level", + "type": "string" + }, + "service_name": { + "default": "metldata", + "title": "Service Name", + "type": "string" + }, + "service_instance_id": { + "description": "A string that uniquely identifies this instance across all instances of this service. A globally unique Kafka client ID will be created by concatenating the service_name and the service_instance_id.", + "examples": [ + "germany-bw-instance-001" + ], + "title": "Service Instance Id", + "type": "string" + }, + "log_format": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "If set, will replace JSON formatting with the specified string format. If not set, has no effect. In addition to the standard attributes, the following can also be specified: timestamp, service, instance, level, correlation_id, and details", + "examples": [ + "%(timestamp)s - %(service)s - %(level)s - %(message)s", + "%(asctime)s - Severity: %(levelno)s - %(msg)s" + ], + "title": "Log Format" + }, + "log_traceback": { + "default": true, + "description": "Whether to include exception tracebacks in log messages.", + "title": "Log Traceback", + "type": "boolean" + }, "db_connection_str": { "description": "MongoDB connection string. Might include credentials. For more information see: https://naiveskill.com/mongodb-connection-string/", "examples": [ @@ -122,19 +172,6 @@ "title": "Db Name", "type": "string" }, - "service_name": { - "default": "metldata", - "title": "Service Name", - "type": "string" - }, - "service_instance_id": { - "description": "A string that uniquely identifies this instance across all instances of this service. A globally unique Kafka client ID will be created by concatenating the service_name and the service_instance_id.", - "examples": [ - "germany-bw-instance-001" - ], - "title": "Service Instance Id", - "type": "string" - }, "kafka_servers": { "description": "A list of connection strings to connect to Kafka bootstrap servers.", "examples": [ @@ -410,9 +447,9 @@ } }, "required": [ + "service_instance_id", "db_connection_str", "db_name", - "service_instance_id", "kafka_servers", "primary_artifact_name", "primary_dataset_name", diff --git a/example_config.yaml b/example_config.yaml index d2629bf..f26f8c2 100644 --- a/example_config.yaml +++ b/example_config.yaml @@ -215,6 +215,9 @@ kafka_ssl_keyfile: '' kafka_ssl_password: '' loader_token_hashes: - 09e5724dab34b50fe2db5ebae7ac5eac4ef2904d105f8f2b3d5a4cb2c7f43da4 +log_format: null +log_level: INFO +log_traceback: true openapi_url: /openapi.json port: 8080 primary_artifact_name: embedded_public diff --git a/pyproject.toml b/pyproject.toml index 6f47180..020d70a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,10 +21,10 @@ classifiers = [ "Intended Audience :: Developers", ] name = "metldata" -version = "2.1.0" +version = "2.1.1" description = "metldata - A framework for handling metadata based on ETL, CQRS, and event sourcing." dependencies = [ - "hexkit[akafka,mongodb] ~= 3.5.0", + "hexkit[akafka,mongodb] >=3.5.0, <4", "ghga-service-commons[api,auth] >=3.1.1, <4", "ghga-event-schemas >=3.0.0, <4", "typer>=0.12",