Skip to content

Commit 2b95ab4

Browse files
resolve merge conflict
2 parents bbf1938 + 356e664 commit 2b95ab4

15 files changed

+186
-159
lines changed

package-lock.json

Lines changed: 84 additions & 83 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/AzureAppConfigurationImpl.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import {
3333
} from "./featureManagement/constants.js";
3434
import { AzureKeyVaultKeyValueAdapter } from "./keyvault/AzureKeyVaultKeyValueAdapter.js";
3535
import { RefreshTimer } from "./refresh/RefreshTimer.js";
36-
import { getConfigurationSettingWithTrace, listConfigurationSettingsWithTrace, requestTracingEnabled } from "./requestTracing/utils.js";
36+
import { RequestTracingOptions, getConfigurationSettingWithTrace, listConfigurationSettingsWithTrace, requestTracingEnabled } from "./requestTracing/utils.js";
3737
import { KeyFilter, LabelFilter, SettingSelector } from "./types.js";
3838
import { ConfigurationClientManager } from "./ConfigurationClientManager.js";
3939
import { ETAG_LOOKUP_HEADER } from "./EtagUrlPipelinePolicy.js";
@@ -110,7 +110,7 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
110110
this.#isCdnUsed = isCdnUsed;
111111
this.#clientManager = clientManager;
112112

113-
// Enable request tracing if not opt-out
113+
// enable request tracing if not opt-out
114114
this.#requestTracingEnabled = requestTracingEnabled();
115115

116116
if (options?.trimKeyPrefixes) {
@@ -144,6 +144,7 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
144144
this.#kvRefreshTimer = new RefreshTimer(this.#kvRefreshInterval);
145145
}
146146

147+
// if no selector is specified, always load key values using the default selector: key="*" and label="\0"
147148
this.#kvSelectorCollection.selectors = getValidKeyValueSelectors(options?.selectors);
148149

149150
// feature flag options
@@ -182,13 +183,14 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
182183
return this.#featureFlagEnabled && !!this.#options?.featureFlagOptions?.refresh?.enabled;
183184
}
184185

185-
get #requestTraceOptions() {
186+
get #requestTraceOptions(): RequestTracingOptions {
186187
return {
187-
requestTracingEnabled: this.#requestTracingEnabled,
188+
enabled: this.#requestTracingEnabled,
189+
appConfigOptions: this.#options,
188190
initialLoadCompleted: this.#isInitialLoadCompleted,
189-
isCdnUsed: this.#isCdnUsed,
191+
replicaCount: this.#clientManager.getReplicaCount(),
190192
isFailoverRequest: this.#isFailoverRequest,
191-
appConfigOptions: this.#options
193+
isCdnUsed: this.#isCdnUsed
192194
};
193195
}
194196

src/ConfigurationClientManager.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ export class ConfigurationClientManager {
3030
#clientOptions: AppConfigurationClientOptions | undefined;
3131
#appConfigOptions: AzureAppConfigurationOptions | undefined;
3232
#validDomain: string;
33-
#staticClients: ConfigurationClientWrapper[];
33+
#staticClients: ConfigurationClientWrapper[]; // there should always be only one static client
3434
#dynamicClients: ConfigurationClientWrapper[];
35+
#replicaCount: number = 0;
3536
#lastFallbackClientRefreshTime: number = 0;
3637
#lastFallbackClientRefreshAttempt: number = 0;
3738

@@ -96,7 +97,11 @@ export class ConfigurationClientManager {
9697
this.#isFailoverable = true;
9798
}
9899

99-
async getClients() : Promise<ConfigurationClientWrapper[]> {
100+
getReplicaCount(): number {
101+
return this.#replicaCount;
102+
}
103+
104+
async getClients(): Promise<ConfigurationClientWrapper[]> {
100105
if (!this.#isFailoverable) {
101106
return this.#staticClients;
102107
}
@@ -161,6 +166,7 @@ export class ConfigurationClientManager {
161166

162167
this.#dynamicClients = newDynamicClients;
163168
this.#lastFallbackClientRefreshTime = Date.now();
169+
this.#replicaCount = this.#dynamicClients.length;
164170
}
165171

166172
/**

src/requestTracing/constants.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,21 @@ export const CONTAINER_APP_ENV_VAR = "CONTAINER_APP_NAME";
3737
export const KUBERNETES_ENV_VAR = "KUBERNETES_PORT";
3838
export const SERVICE_FABRIC_ENV_VAR = "Fabric_NodeName"; // See: https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-environment-variables-reference
3939

40-
// Request Type
40+
// Request type
4141
export const REQUEST_TYPE_KEY = "RequestType";
4242
export enum RequestType {
4343
STARTUP = "Startup",
4444
WATCH = "Watch"
4545
}
4646

47-
export const FEATURES_KEY = "Features";
47+
// Replica count
48+
export const REPLICA_COUNT_KEY = "ReplicaCount";
4849

4950
// Tag names
50-
export const FAILOVER_REQUEST_TAG = "Failover";
5151
export const KEY_VAULT_CONFIGURED_TAG = "UsesKeyVault";
5252
export const CDN_USED_TAG = "CDN";
53+
export const FAILOVER_REQUEST_TAG = "Failover";
54+
55+
// Compact feature tags
56+
export const FEATURES_KEY = "Features";
5357
export const LOAD_BALANCE_CONFIGURED_TAG = "LB";

0 commit comments

Comments
 (0)