diff --git a/.ecr-repository-policy.json b/.ecr-repository-policy.json new file mode 100644 index 0000000000000..0c911601a6c02 --- /dev/null +++ b/.ecr-repository-policy.json @@ -0,0 +1,22 @@ +{ + "Version": "2012-10-17", + "Statement": [ + { + "Sid": "ECR Repository Policy", + "Effect": "Allow", + "Principal": { + "AWS": "*" + }, + "Action": [ + "ecr:BatchCheckLayerAvailability", + "ecr:BatchGetImage", + "ecr:GetDownloadUrlForLayer" + ], + "Condition": { + "StringEquals": { + "aws:PrincipalOrgID": "o-t9bcvmrskg" + } + } + } + ] + } diff --git a/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/analytics/resolver/GetHighlightsResolver.java b/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/analytics/resolver/GetHighlightsResolver.java index c631a13b0bcb6..18cd0d7b1672f 100644 --- a/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/analytics/resolver/GetHighlightsResolver.java +++ b/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/analytics/resolver/GetHighlightsResolver.java @@ -111,6 +111,7 @@ private List getHighlights() { getEntityMetadataStats("Pipelines", EntityType.DATA_FLOW).ifPresent(highlights::add); getEntityMetadataStats("Tasks", EntityType.DATA_JOB).ifPresent(highlights::add); getEntityMetadataStats("Domains", EntityType.DOMAIN).ifPresent(highlights::add); + getEntityMetadataStats("Data Products", EntityType.DATA_PRODUCT).ifPresent(highlights::add); return highlights; } diff --git a/datahub-web-react/src/app/analytics/analytics.ts b/datahub-web-react/src/app/analytics/analytics.ts index a66d76a09cf4d..2e2fc3c7cce8f 100644 --- a/datahub-web-react/src/app/analytics/analytics.ts +++ b/datahub-web-react/src/app/analytics/analytics.ts @@ -18,11 +18,12 @@ const { NODE_ENV } = process.env; export function getMergedTrackingOptions(options?: any) { const isThirdPartyLoggingEnabled = JSON.parse(localStorage.getItem(THIRD_PARTY_LOGGING_KEY) || 'false'); + return { ...options, plugins: { mixpanel: isThirdPartyLoggingEnabled, - amplitude: isThirdPartyLoggingEnabled, + amplitude: true, // Only want amplitude so hard-code true. We hard code the API keys too, so 🤷 googleAnalytics: isThirdPartyLoggingEnabled, }, }; diff --git a/datahub-web-react/src/app/analytics/plugin/amplitude.ts b/datahub-web-react/src/app/analytics/plugin/amplitude.ts index e6346a02e9acd..4cc004032dfe8 100644 --- a/datahub-web-react/src/app/analytics/plugin/amplitude.ts +++ b/datahub-web-react/src/app/analytics/plugin/amplitude.ts @@ -7,5 +7,13 @@ const apiKey = isEnabled ? amplitudeConfigs.apiKey : undefined; export default { isEnabled, - plugin: apiKey && amplitude({ apiKey, options: {} }), + plugin: + apiKey && + amplitude({ + apiKey, + options: { + apiEndpoint: 'api.eu.amplitude.com', + serverZone: 'EU', + }, + }), }; diff --git a/datahub-web-react/src/app/context/UserContextProvider.tsx b/datahub-web-react/src/app/context/UserContextProvider.tsx index 3bcff15cc2748..1353b195b0b47 100644 --- a/datahub-web-react/src/app/context/UserContextProvider.tsx +++ b/datahub-web-react/src/app/context/UserContextProvider.tsx @@ -3,6 +3,7 @@ import { useGetMeLazyQuery } from '../../graphql/me.generated'; import { useGetGlobalViewsSettingsLazyQuery } from '../../graphql/app.generated'; import { CorpUser, PlatformPrivileges } from '../../types.generated'; import { UserContext, LocalState, DEFAULT_STATE, State } from './userContext'; +import analytics from '../analytics'; // TODO: Migrate all usage of useAuthenticatedUser to using this provider. @@ -41,6 +42,21 @@ const UserContextProvider = ({ children }: { children: React.ReactNode }) => { const [getMe, { data: meData, refetch }] = useGetMeLazyQuery({ fetchPolicy: 'cache-first' }); useEffect(() => getMe(), [getMe]); + /** + * Identify the user in the analytics tool once on component mount. + * This lets Amplitude identify (and thus segment) the users on more attributes. + * There may be a more optimal place to put this call, but I'm not sure + */ + useEffect(() => { + if (meData?.me?.corpUser) { + const corpUser = meData.me.corpUser as CorpUser; + const info = corpUser.info ?? {}; + analytics.identify(corpUser.urn, { + ...info, + }); + } + }, [meData]); + /** * Retrieve the Global View settings once on component mount. */ diff --git a/datahub-web-react/src/conf/analytics.ts b/datahub-web-react/src/conf/analytics.ts index 2506ec408b5ba..975a56fac1cec 100644 --- a/datahub-web-react/src/conf/analytics.ts +++ b/datahub-web-react/src/conf/analytics.ts @@ -6,10 +6,10 @@ const config: any = { // mixpanel: { // token: 'fad1285da4e618b618973cacf6565e61', // }, - // amplitude: { - // apiKey: 'c5c212632315d19c752ab083bc7c92ff', - // }, - // logging: true, + amplitude: { + apiKey: '', + }, + logging: true, datahub: { enabled: true, }, diff --git a/metadata-service/configuration/src/main/java/com/linkedin/metadata/config/telemetry/TelemetryConfiguration.java b/metadata-service/configuration/src/main/java/com/linkedin/metadata/config/telemetry/TelemetryConfiguration.java index 3821cbbed83e8..fb807a2495361 100644 --- a/metadata-service/configuration/src/main/java/com/linkedin/metadata/config/telemetry/TelemetryConfiguration.java +++ b/metadata-service/configuration/src/main/java/com/linkedin/metadata/config/telemetry/TelemetryConfiguration.java @@ -23,4 +23,5 @@ public class TelemetryConfiguration { * Whether or not server telemetry should be enabled */ public boolean enabledServer; -} \ No newline at end of file + +} diff --git a/metadata-service/configuration/src/main/resources/application.yml b/metadata-service/configuration/src/main/resources/application.yml index dfc7218eb772d..69329eb7fe2f3 100644 --- a/metadata-service/configuration/src/main/resources/application.yml +++ b/metadata-service/configuration/src/main/resources/application.yml @@ -319,4 +319,4 @@ cache: search: lineage: ttlSeconds: ${CACHE_SEARCH_LINEAGE_TTL_SECONDS:86400} # 1 day - lightningThreshold: ${CACHE_SEARCH_LINEAGE_LIGHTNING_THRESHOLD:300} \ No newline at end of file + lightningThreshold: ${CACHE_SEARCH_LINEAGE_LIGHTNING_THRESHOLD:300}