mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
feat: remove feature flag for datadog json template (#5105)
## About the changes Removes the feature flag for the datadog json template
This commit is contained in:
parent
d013867f0f
commit
6fe4740e67
@ -2,7 +2,6 @@ import { ChangeEventHandler } from 'react';
|
||||
import { StyledAddonParameterContainer } from '../../IntegrationForm.styles';
|
||||
import type { AddonParameterSchema, AddonSchema } from 'openapi';
|
||||
import { IntegrationParameterTextField } from './IntegrationParameterTextField';
|
||||
import { useUiFlag } from 'hooks/useUiFlag';
|
||||
|
||||
export interface IIntegrationParameterProps {
|
||||
parametersErrors: Record<string, string>;
|
||||
@ -17,15 +16,6 @@ export const IntegrationParameter = ({
|
||||
parametersErrors,
|
||||
setParameterValue,
|
||||
}: IIntegrationParameterProps) => {
|
||||
const datadogJson = useUiFlag('datadogJsonTemplate');
|
||||
if (
|
||||
config.provider === 'datadog' &&
|
||||
definition.name === 'bodyTemplate' &&
|
||||
!datadogJson
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<StyledAddonParameterContainer>
|
||||
<IntegrationParameterTextField
|
||||
|
@ -66,7 +66,6 @@ export type UiFlags = {
|
||||
variantTypeNumber?: boolean;
|
||||
privateProjects?: boolean;
|
||||
accessOverview?: boolean;
|
||||
datadogJsonTemplate?: boolean;
|
||||
dependentFeatures?: boolean;
|
||||
banners?: boolean;
|
||||
disableEnvsOnRevive?: boolean;
|
||||
|
@ -76,7 +76,6 @@ exports[`should create default config 1`] = `
|
||||
"banners": false,
|
||||
"caseInsensitiveInOperators": false,
|
||||
"customRootRolesKillSwitch": false,
|
||||
"datadogJsonTemplate": false,
|
||||
"demo": false,
|
||||
"dependentFeatures": false,
|
||||
"disableBulkToggle": false,
|
||||
|
@ -39,11 +39,6 @@ test('Should call datadog webhook', async () => {
|
||||
const addon = new DatadogAddon({
|
||||
getLogger: noLogger,
|
||||
unleashUrl: 'http://some-url.com',
|
||||
flagResolver: {
|
||||
getAll: jest.fn().mockReturnValue([]),
|
||||
getVariant: jest.fn(),
|
||||
isEnabled: jest.fn().mockReturnValue(false),
|
||||
},
|
||||
});
|
||||
const event: IEvent = {
|
||||
id: 1,
|
||||
@ -73,11 +68,6 @@ test('Should call datadog webhook for archived toggle', async () => {
|
||||
const addon = new DatadogAddon({
|
||||
getLogger: noLogger,
|
||||
unleashUrl: 'http://some-url.com',
|
||||
flagResolver: {
|
||||
getAll: jest.fn().mockReturnValue([]),
|
||||
getVariant: jest.fn(),
|
||||
isEnabled: jest.fn().mockReturnValue(false),
|
||||
},
|
||||
});
|
||||
const event: IEvent = {
|
||||
id: 2,
|
||||
@ -105,11 +95,6 @@ test('Should call datadog webhook for archived toggle with project info', async
|
||||
const addon = new DatadogAddon({
|
||||
getLogger: noLogger,
|
||||
unleashUrl: 'http://some-url.com',
|
||||
flagResolver: {
|
||||
getAll: jest.fn().mockReturnValue([]),
|
||||
getVariant: jest.fn(),
|
||||
isEnabled: jest.fn().mockReturnValue(false),
|
||||
},
|
||||
});
|
||||
const event: IEvent = {
|
||||
id: 2,
|
||||
@ -138,11 +123,6 @@ test('Should call datadog webhook for toggled environment', async () => {
|
||||
const addon = new DatadogAddon({
|
||||
getLogger: noLogger,
|
||||
unleashUrl: 'http://some-url.com',
|
||||
flagResolver: {
|
||||
getAll: jest.fn().mockReturnValue([]),
|
||||
getVariant: jest.fn(),
|
||||
isEnabled: jest.fn().mockReturnValue(false),
|
||||
},
|
||||
});
|
||||
const event: IEvent = {
|
||||
id: 2,
|
||||
@ -173,11 +153,6 @@ test('Should include customHeaders in headers when calling service', async () =>
|
||||
const addon = new DatadogAddon({
|
||||
getLogger: noLogger,
|
||||
unleashUrl: 'http://some-url.com',
|
||||
flagResolver: {
|
||||
getAll: jest.fn().mockReturnValue([]),
|
||||
getVariant: jest.fn(),
|
||||
isEnabled: jest.fn().mockReturnValue(false),
|
||||
},
|
||||
});
|
||||
const event: IEvent = {
|
||||
id: 2,
|
||||
@ -209,11 +184,6 @@ test('Should not include source_type_name when included in the config', async ()
|
||||
const addon = new DatadogAddon({
|
||||
getLogger: noLogger,
|
||||
unleashUrl: 'http://some-url.com',
|
||||
flagResolver: {
|
||||
getAll: jest.fn().mockReturnValue([]),
|
||||
getVariant: jest.fn(),
|
||||
isEnabled: jest.fn().mockReturnValue(false),
|
||||
},
|
||||
});
|
||||
const event: IEvent = {
|
||||
id: 2,
|
||||
@ -248,11 +218,6 @@ test('Should call datadog webhook with JSON when template set', async () => {
|
||||
const addon = new DatadogAddon({
|
||||
getLogger: noLogger,
|
||||
unleashUrl: 'http://some-url.com',
|
||||
flagResolver: {
|
||||
getAll: jest.fn().mockReturnValue([]),
|
||||
getVariant: jest.fn(),
|
||||
isEnabled: jest.fn().mockReturnValue(true),
|
||||
},
|
||||
});
|
||||
const event: IEvent = {
|
||||
id: 1,
|
||||
|
@ -26,22 +26,15 @@ interface DDRequestBody {
|
||||
source_type_name?: string;
|
||||
}
|
||||
|
||||
export interface IDatadogAddonConfig extends IAddonConfig {
|
||||
flagResolver: IFlagResolver;
|
||||
}
|
||||
|
||||
export default class DatadogAddon extends Addon {
|
||||
private msgFormatter: FeatureEventFormatter;
|
||||
|
||||
private flagResolver: IFlagResolver;
|
||||
|
||||
constructor(config: IDatadogAddonConfig) {
|
||||
constructor(config: IAddonConfig) {
|
||||
super(definition, config);
|
||||
this.msgFormatter = new FeatureEventFormatterMd(
|
||||
config.unleashUrl,
|
||||
LinkStyle.MD,
|
||||
);
|
||||
this.flagResolver = config.flagResolver;
|
||||
}
|
||||
|
||||
async handleEvent(
|
||||
@ -61,11 +54,7 @@ export default class DatadogAddon extends Addon {
|
||||
};
|
||||
|
||||
let text;
|
||||
if (
|
||||
this.flagResolver.isEnabled('datadogJsonTemplate') &&
|
||||
typeof bodyTemplate === 'string' &&
|
||||
bodyTemplate.length > 1
|
||||
) {
|
||||
if (typeof bodyTemplate === 'string' && bodyTemplate.length > 1) {
|
||||
text = Mustache.render(bodyTemplate, context);
|
||||
} else {
|
||||
text = `%%% \n ${this.msgFormatter.format(event).text} \n %%% `;
|
||||
|
@ -21,7 +21,7 @@ export const getAddons: (args: {
|
||||
new SlackAddon({ getLogger, unleashUrl }),
|
||||
new SlackAppAddon({ getLogger, unleashUrl }),
|
||||
new TeamsAddon({ getLogger, unleashUrl }),
|
||||
new DatadogAddon({ getLogger, unleashUrl, flagResolver }),
|
||||
new DatadogAddon({ getLogger, unleashUrl }),
|
||||
];
|
||||
|
||||
return addons.reduce((map, addon) => {
|
||||
|
@ -29,7 +29,6 @@ export type IFlagKey =
|
||||
| 'accessOverview'
|
||||
| 'privateProjects'
|
||||
| 'dependentFeatures'
|
||||
| 'datadogJsonTemplate'
|
||||
| 'disableMetrics'
|
||||
| 'useLastSeenRefactor'
|
||||
| 'banners'
|
||||
@ -141,10 +140,6 @@ const flags: IFlags = {
|
||||
process.env.UNLEASH_EXPERIMENTAL_ACCESS_OVERVIEW,
|
||||
false,
|
||||
),
|
||||
datadogJsonTemplate: parseEnvVarBoolean(
|
||||
process.env.UNLEASH_EXPERIMENTAL_DATADOG_JSON_TEMPLATE,
|
||||
false,
|
||||
),
|
||||
disableMetrics: parseEnvVarBoolean(
|
||||
process.env.UNLEASH_EXPERIMENTAL_DISABLE_METRICS,
|
||||
false,
|
||||
|
@ -43,7 +43,6 @@ process.nextTick(async () => {
|
||||
variantTypeNumber: true,
|
||||
privateProjects: true,
|
||||
accessOverview: true,
|
||||
datadogJsonTemplate: true,
|
||||
dependentFeatures: true,
|
||||
useLastSeenRefactor: true,
|
||||
disableEnvsOnRevive: true,
|
||||
|
Loading…
Reference in New Issue
Block a user