Skip to content

Commit 6fffe1b

Browse files
exclude ff & secret reference
1 parent 5225630 commit 6fffe1b

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

src/AzureAppConfigurationImpl.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {
2525
CLIENT_FILTERS_KEY_NAME
2626
} from "./featureManagement/constants.js";
2727
import { FM_PACKAGE_NAME, AI_MIME_PROFILE, AI_CHAT_COMPLETION_MIME_PROFILE } from "./requestTracing/constants.js";
28-
import { parseContentType, isJsonContentType } from "./common/contentType.js";
28+
import { parseContentType, isJsonContentType, isFeatureFlagContentType, isSecretReferenceContentType } from "./common/contentType.js";
2929
import { AzureKeyVaultKeyValueAdapter } from "./keyvault/AzureKeyVaultKeyValueAdapter.js";
3030
import { RefreshTimer } from "./refresh/RefreshTimer.js";
3131
import { RequestTracingOptions, getConfigurationSettingWithTrace, listConfigurationSettingsWithTrace, requestTracingEnabled } from "./requestTracing/utils.js";
@@ -659,8 +659,10 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
659659
#setAIConfigurationTracing(setting: ConfigurationSetting<string>): void {
660660
if (this.#requestTracingEnabled && this.#aiConfigurationTracing !== undefined) {
661661
const contentType = parseContentType(setting.contentType);
662-
// content type: application/json; profile="https://azconfig.io/mime-profiles/ai"
663-
if (isJsonContentType(contentType)) {
662+
// content type: "application/json; profile=\"https://azconfig.io/mime-profiles/ai\"""
663+
if (isJsonContentType(contentType) &&
664+
!isFeatureFlagContentType(contentType) &&
665+
!isSecretReferenceContentType(contentType)) {
664666
const profile = contentType?.parameters["profile"];
665667
if (profile === undefined) {
666668
return;

src/common/contentType.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT license.
33

4+
import { secretReferenceContentType, featureFlagContentType } from "@azure/app-configuration";
5+
46
export type ContentType = {
57
mediaType: string;
68
parameters: Record<string, string>;
@@ -42,3 +44,19 @@ export function isJsonContentType(contentType: ContentType | undefined): boolean
4244

4345
return typeParts[1].split("+").includes("json");
4446
}
47+
48+
export function isFeatureFlagContentType(contentType: ContentType | undefined): boolean {
49+
const mediaType = contentType?.mediaType;
50+
if (!mediaType) {
51+
return false;
52+
}
53+
return mediaType === featureFlagContentType;
54+
}
55+
56+
export function isSecretReferenceContentType(contentType: ContentType | undefined): boolean {
57+
const mediaType = contentType?.mediaType;
58+
if (!mediaType) {
59+
return false;
60+
}
61+
return mediaType === secretReferenceContentType;
62+
}

0 commit comments

Comments
 (0)