mirror of
https://github.com/FerretDB/documentdb.git
synced 2026-11-07 11:32:47 -05:00
### Does this PR have any customer impact? No ### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc) DevOps ### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes) No ### Are you introducing any new config? If yes, do you have tests with and without them being set? No ### ChangeLog (Refer [Template](../oss/CHANGELOG.md)) ### Description Add Version Logging in the backend metrics collection. This makes it so we're not reliant on the gateway to log version information to metrics. ---- #### AI description (iteration 1) #### PR Classification This pull request introduces a new feature to log backend version metrics. #### PR Summary The changes add functionality to periodically log version information from various components, ensuring updated logging when version changes or timer intervals trigger a new record. - `pgmongo/src/infrastructure/mdsd_logger.c`: Added new functions (`append_version_metric_data` and `LogVersionMetricData`) to construct and send version metrics, and integrated these into the main logging workflow. - `pgmongo/src/pgmongo_extension_version.c`: Introduced `PgmongoGetExtendedVersionString` and updated the version-returning function to use this extended string. - `oss/pg_documentdb/src/utils/version_utils.c`: Added `GetCurrentShortVersionStringForLogging` to format a concise version string for backend logging. - `pgmongo/src/metadata/oid_cache.c`: Added the `CitusVersionFunctionOid` function and updated the OidCache structure to support version logging. - Header updates in `oss/pg_documentdb/include/utils/version_utils_private.h` and `pgmongo/include/metadata/oid_cache.h` to declare the new version utility and Oid functions. <!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot --> Signed-off-by: Shuai Tian <shuaitian@microsoft.com>
41 lines
1.0 KiB
C
41 lines
1.0 KiB
C
/*-------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
*
|
|
* include/utils/version_utils.h
|
|
*
|
|
* Utilities that Provide extension functions to handle version upgrade
|
|
* scenarios.
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
#include <postgres.h>
|
|
#include "utils/version_utils.h"
|
|
|
|
#ifndef VERSION_UTILS_PRIVATE_H
|
|
#define VERSION_UTILS_PRIVATE_H
|
|
|
|
/*
|
|
* The current Extensions' version.
|
|
* Note Extension versions are of the form
|
|
* <Major>.<Minor>-<Patch>
|
|
*/
|
|
typedef struct ExtensionVersion
|
|
{
|
|
/* The major version of the extension */
|
|
int Major;
|
|
|
|
/* The minor version of the extension */
|
|
int Minor;
|
|
|
|
/* The patch version of the extension */
|
|
int Patch;
|
|
} ExtensionVersion;
|
|
|
|
const char * GetCurrentVersionForLogging(void);
|
|
const char * GetCurrentShortVersionStringForLogging(void);
|
|
|
|
bool IsExtensionVersionAtleast(ExtensionVersion extVersion, MajorVersion major, int minor,
|
|
int
|
|
patch);
|
|
#endif
|