Skip to content

Commit 8792927

Browse files
feat: add hikari logs to otel (#1181)
* feat: add hikari logs to otel * fix: add env name annotations * fix: update core config and config mapper to load from env * chore: update build version and changelog * fix: config test * fix: config json from env * fix: changelog * fix: storage class loader --------- Co-authored-by: Sattvik Chakravarthy <sattvik@gmail.com>
1 parent 58956c3 commit 8792927

File tree

13 files changed

+496
-35
lines changed

13 files changed

+496
-35
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased]
99

10+
## [11.1.0]
11+
12+
- Adds hikari logs to opentelemetry
13+
- Fetches core and plugin config from env
14+
1015
## [11.0.5]
1116

1217
- Adds all logs to telemetry which were logged with `io/supertokens/output/Logging.java`

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ java {
2626
}
2727
}
2828

29-
version = "11.0.5"
29+
version = "11.1.0"
3030

3131
repositories {
3232
mavenCentral()

pluginInterfaceSupported.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"_comment": "contains a list of plugin interfaces branch names that this core supports",
33
"versions": [
4-
"8.0"
4+
"8.1"
55
]
66
}

src/main/java/io/supertokens/Main.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,24 +157,24 @@ private void init() throws IOException, StorageQueryException {
157157
// Handle kill signal gracefully
158158
handleKillSignalForWhenItHappens();
159159

160+
StorageLayer.loadStorageUCL(CLIOptions.get(this).getInstallationPath() + "plugin/");
161+
160162
// loading configs for core from config.yaml file.
161163
try {
162164
Config.loadBaseConfig(this);
165+
Logging.info(this, TenantIdentifier.BASE_TENANT, "Completed config.yaml loading.", true);
163166
} catch (InvalidConfigException e) {
164167
throw new QuitProgramException(e);
165168
}
166169

167170
// loading version file
168171
Version.loadVersion(this, CLIOptions.get(this).getInstallationPath() + "version.yaml");
169172

170-
Logging.info(this, TenantIdentifier.BASE_TENANT, "Completed config.yaml loading.", true);
171-
172173
TelemetryProvider.initialize(this);
173174

174175
// loading storage layer
175176
try {
176-
StorageLayer.initPrimary(this, CLIOptions.get(this).getInstallationPath() + "plugin/",
177-
Config.getBaseConfigAsJsonObject(this));
177+
StorageLayer.initPrimary(this, Config.getBaseConfigAsJsonObject(this));
178178
} catch (InvalidConfigException e) {
179179
throw new QuitProgramException(e);
180180
}

src/main/java/io/supertokens/config/Config.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ private Config(Main main, String configFilePath) throws InvalidConfigException,
5252
final ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
5353
Object configObj = mapper.readValue(new File(configFilePath), Object.class);
5454
JsonObject jsonConfig = new GsonBuilder().serializeNulls().create().toJsonTree(configObj).getAsJsonObject();
55+
CoreConfig.updateConfigJsonFromEnv(jsonConfig);
56+
StorageLayer.updateConfigJsonFromEnv(main, jsonConfig);
5557
CoreConfig config = ConfigMapper.mapConfig(jsonConfig, CoreConfig.class);
5658
config.normalizeAndValidate(main, true);
5759
this.core = config;
@@ -91,7 +93,10 @@ public static JsonObject getBaseConfigAsJsonObject(Main main) throws IOException
9193
// omit them from the output json.
9294
ObjectMapper yamlReader = new ObjectMapper(new YAMLFactory());
9395
Object obj = yamlReader.readValue(new File(getConfigFilePath(main)), Object.class);
94-
return new GsonBuilder().serializeNulls().create().toJsonTree(obj).getAsJsonObject();
96+
JsonObject configJson = new GsonBuilder().serializeNulls().create().toJsonTree(obj).getAsJsonObject();
97+
CoreConfig.updateConfigJsonFromEnv(configJson);
98+
StorageLayer.updateConfigJsonFromEnv(main, configJson);
99+
return configJson;
95100
}
96101

97102
private static String getConfigFilePath(Main main) {

0 commit comments

Comments
 (0)