Skip to content

Commit

Permalink
Merge branch 'master' into fix/metadata-io/use-proper-algorithm-to-ge…
Browse files Browse the repository at this point in the history
…t-lineage
  • Loading branch information
lix-mms authored Oct 30, 2023
2 parents ce1ece3 + f5c8192 commit 503291f
Show file tree
Hide file tree
Showing 72 changed files with 3,844 additions and 1,739 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/airflow-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
branches:
- "**"
paths:
- ".github/**"
- ".github/workflows/airflow-plugin.yml"
- "metadata-ingestion-modules/airflow-plugin/**"
- "metadata-ingestion/**"
- "metadata-models/**"
Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/check-datahub-jars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@ on:
push:
branches:
- master
paths-ignore:
- "docker/**"
- "docs/**"
- "**.md"
paths:
- "metadata-integration"
pull_request:
branches:
- "**"
paths-ignore:
- "docker/**"
- "docs/**"
- "**.md"
paths:
- "metadata-integration"
release:
types: [published]

Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/docker-unified.yml
Original file line number Diff line number Diff line change
Expand Up @@ -851,8 +851,14 @@ jobs:
if: failure()
run: |
docker ps -a
docker logs datahub-gms >& gms-${{ matrix.test_strategy }}.log
docker logs datahub-actions >& actions-${{ matrix.test_strategy }}.log
docker logs datahub-gms >& gms-${{ matrix.test_strategy }}.log || true
docker logs datahub-actions >& actions-${{ matrix.test_strategy }}.log || true
docker logs datahub-mae-consumer >& mae-${{ matrix.test_strategy }}.log || true
docker logs datahub-mce-consumer >& mce-${{ matrix.test_strategy }}.log || true
docker logs broker >& broker-${{ matrix.test_strategy }}.log || true
docker logs mysql >& mysql-${{ matrix.test_strategy }}.log || true
docker logs elasticsearch >& elasticsearch-${{ matrix.test_strategy }}.log || true
docker logs datahub-frontend-react >& frontend-${{ matrix.test_strategy }}.log || true
- name: Upload logs
uses: actions/upload-artifact@v3
if: failure()
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@ on:
pull_request:
branches:
- "**"
paths:
- "metadata-ingestion/**"
- "metadata-models/**"
- "docs-website/**"
push:
branches:
- master
paths:
- "metadata-ingestion/**"
- "metadata-models/**"
- "docs-website/**"
# release:
# types: [published, edited]

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/metadata-ingestion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
branches:
- "**"
paths:
- ".github/**"
- ".github/workflows/metadata-ingestion.yml"
- "metadata-ingestion/**"
- "metadata-models/**"
release:
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/metadata-model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ on:
push:
branches:
- master
paths-ignore:
- "docs/**"
- "**.md"
paths:
- "metadata-models/**"
release:
types: [published]

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ buildscript {
plugins {
id 'com.gorylenko.gradle-git-properties' version '2.4.0-rc2'
id 'com.github.johnrengelman.shadow' version '6.1.0'
id 'com.palantir.docker' version '0.35.0'
id 'com.palantir.docker' version '0.35.0' apply false
// https://blog.ltgt.net/javax-jakarta-mess-and-gradle-solution/
// TODO id "org.gradlex.java-ecosystem-capabilities" version "1.0"
}
Expand Down
10 changes: 7 additions & 3 deletions datahub-frontend/app/client/KafkaTrackingProducer.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package client;

import com.linkedin.metadata.config.kafka.ProducerConfiguration;
import com.typesafe.config.Config;
import config.ConfigurationProvider;
import org.apache.kafka.clients.CommonClientConfigs;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.ProducerConfig;
Expand Down Expand Up @@ -35,12 +37,12 @@ public class KafkaTrackingProducer {
private final KafkaProducer<String, String> _producer;

@Inject
public KafkaTrackingProducer(@Nonnull Config config, ApplicationLifecycle lifecycle) {
public KafkaTrackingProducer(@Nonnull Config config, ApplicationLifecycle lifecycle, final ConfigurationProvider configurationProvider) {
_isEnabled = !config.hasPath("analytics.enabled") || config.getBoolean("analytics.enabled");

if (_isEnabled) {
_logger.debug("Analytics tracking is enabled");
_producer = createKafkaProducer(config);
_producer = createKafkaProducer(config, configurationProvider.getKafka().getProducer());

lifecycle.addStopHook(
() -> {
Expand All @@ -62,13 +64,15 @@ public void send(ProducerRecord<String, String> record) {
_producer.send(record);
}

private static KafkaProducer createKafkaProducer(Config config) {
private static KafkaProducer createKafkaProducer(Config config, ProducerConfiguration producerConfiguration) {
final Properties props = new Properties();
props.put(ProducerConfig.CLIENT_ID_CONFIG, "datahub-frontend");
props.put(ProducerConfig.DELIVERY_TIMEOUT_MS_CONFIG, config.getString("analytics.kafka.delivery.timeout.ms"));
props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, config.getString("analytics.kafka.bootstrap.server"));
props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringSerializer"); // Actor urn.
props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringSerializer"); // JSON object.
props.put(ProducerConfig.MAX_REQUEST_SIZE_CONFIG, producerConfiguration.getMaxRequestSize());
props.put(ProducerConfig.COMPRESSION_TYPE_CONFIG, producerConfiguration.getCompressionType());

final String securityProtocolConfig = "analytics.kafka.security.protocol";
if (config.hasPath(securityProtocolConfig)
Expand Down
6 changes: 5 additions & 1 deletion datahub-frontend/app/config/ConfigurationProvider.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package config;

import com.linkedin.metadata.config.cache.CacheConfiguration;
import com.linkedin.metadata.config.kafka.KafkaConfiguration;
import com.linkedin.metadata.spring.YamlPropertySourceFactory;
import lombok.Data;

Expand All @@ -11,14 +12,17 @@

/**
* Minimal sharing between metadata-service and frontend
* Initially for use of client caching configuration.
* Does not use the factories module to avoid transitive dependencies.
*/
@EnableConfigurationProperties
@PropertySource(value = "application.yml", factory = YamlPropertySourceFactory.class)
@ConfigurationProperties
@Data
public class ConfigurationProvider {
/**
* Kafka related configs.
*/
private KafkaConfiguration kafka;

/**
* Configuration for caching
Expand Down
1 change: 1 addition & 0 deletions datahub-web-react/src/app/home/HomePageHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ export const HomePageHeader = () => {
viewsEnabled={viewsEnabled}
combineSiblings
showQuickFilters
showViewAllResults
/>
{searchResultsToShow && searchResultsToShow.length > 0 && (
<SuggestionsContainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export const NameSourceStep = ({ state, updateState, prev, submit }: StepProps)
<Input
data-testid="cli-version-input"
className="cli-version-input"
placeholder="(e.g. 0.10.5)"
placeholder="(e.g. 0.12.0)"
value={state.config?.version || ''}
onChange={(event) => setVersion(event.target.value)}
/>
Expand Down
6 changes: 4 additions & 2 deletions datahub-web-react/src/app/search/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ interface Props {
setIsSearchBarFocused?: (isSearchBarFocused: boolean) => void;
onFocus?: () => void;
onBlur?: () => void;
showViewAllResults?: boolean;
}

const defaultProps = {
Expand Down Expand Up @@ -146,6 +147,7 @@ export const SearchBar = ({
setIsSearchBarFocused,
onFocus,
onBlur,
showViewAllResults = false,
}: Props) => {
const history = useHistory();
const [searchQuery, setSearchQuery] = useState<string | undefined>(initialQuery);
Expand Down Expand Up @@ -203,7 +205,7 @@ export const SearchBar = ({
const { quickFilters, selectedQuickFilter, setSelectedQuickFilter } = useQuickFiltersContext();

const autoCompleteQueryOptions = useMemo(() => {
if (effectiveQuery === '') return [];
if (effectiveQuery === '' || !showViewAllResults) return [];

return [
{
Expand All @@ -212,7 +214,7 @@ export const SearchBar = ({
type: EXACT_AUTOCOMPLETE_OPTION_TYPE,
},
];
}, [effectiveQuery]);
}, [effectiveQuery, showViewAllResults]);

const autoCompleteEntityOptions = useMemo(() => {
return suggestions.map((suggestion: AutoCompleteResultForEntity) => {
Expand Down
1 change: 1 addition & 0 deletions datahub-web-react/src/app/search/SearchHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export const SearchHeader = ({
combineSiblings
fixAutoComplete
showQuickFilters
showViewAllResults
/>
</LogoSearchContainer>
<NavGroup>
Expand Down
12 changes: 3 additions & 9 deletions datahub-web-react/src/app/search/useGetSearchQueryInputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useLocation, useParams } from 'react-router';
import { useMemo } from 'react';
import { FacetFilterInput, EntityType } from '../../types.generated';
import { useEntityRegistry } from '../useEntityRegistry';
import { ENTITY_FILTER_NAME, FILTER_DELIMITER, UnionType } from './utils/constants';
import { ENTITY_FILTER_NAME, UnionType } from './utils/constants';
import { useUserContext } from '../context/useUserContext';
import useFilters from './utils/useFilters';
import { generateOrFilters } from './utils/generateOrFilters';
Expand All @@ -27,12 +27,6 @@ export default function useGetSearchQueryInputs(excludedFilterFields?: Array<str
const sortInput = useSortInput();

const filters: Array<FacetFilterInput> = useFilters(params);
const nonNestedFilters = filters.filter(
(f) => !f.field.includes(FILTER_DELIMITER) && !excludedFilterFields?.includes(f.field),
);
const nestedFilters = filters.filter(
(f) => f.field.includes(FILTER_DELIMITER) && !excludedFilterFields?.includes(f.field),
);
const entityFilters: Array<EntityType> = useMemo(
() =>
filters
Expand All @@ -43,8 +37,8 @@ export default function useGetSearchQueryInputs(excludedFilterFields?: Array<str
);

const orFilters = useMemo(
() => generateOrFilters(unionType, nonNestedFilters, nestedFilters),
[nonNestedFilters, nestedFilters, unionType],
() => generateOrFilters(unionType, filters, excludedFilterFields),
[filters, excludedFilterFields, unionType],
);

return { entityFilters, query, unionType, filters, orFilters, viewUrn, page, activeType, sortInput };
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
DOMAINS_FILTER_NAME,
ENTITY_SUB_TYPE_FILTER_NAME,
ENTITY_TYPE_FILTER_NAME,
ENTITY_FILTER_NAME,
TAGS_FILTER_NAME,
UnionType,
} from '../constants';
Expand All @@ -10,7 +10,7 @@ import { generateOrFilters } from '../generateOrFilters';
describe('generateOrFilters', () => {
it('should generate orFilters with UnionType.AND', () => {
const filters = [
{ field: ENTITY_TYPE_FILTER_NAME, values: ['DATASET', 'CONTAINER'] },
{ field: ENTITY_FILTER_NAME, values: ['DATASET', 'CONTAINER'] },
{ field: TAGS_FILTER_NAME, values: ['urn:li:tag:tag1'] },
];
const orFilters = generateOrFilters(UnionType.AND, filters);
Expand All @@ -24,7 +24,7 @@ describe('generateOrFilters', () => {

it('should generate orFilters with UnionType.OR', () => {
const filters = [
{ field: ENTITY_TYPE_FILTER_NAME, values: ['DATASET', 'CONTAINER'] },
{ field: ENTITY_FILTER_NAME, values: ['DATASET', 'CONTAINER'] },
{ field: TAGS_FILTER_NAME, values: ['urn:li:tag:tag1'] },
];
const orFilters = generateOrFilters(UnionType.OR, filters);
Expand All @@ -43,17 +43,23 @@ describe('generateOrFilters', () => {
const filters = [
{ field: TAGS_FILTER_NAME, values: ['urn:li:tag:tag1'] },
{ field: DOMAINS_FILTER_NAME, values: ['urn:li:domains:domain1'] },
{ field: ENTITY_SUB_TYPE_FILTER_NAME, values: ['CONTAINER', 'DATASET␞table'] },
];
const nestedFilters = [{ field: ENTITY_SUB_TYPE_FILTER_NAME, values: ['CONTAINER', 'DATASET␞table'] }];
const orFilters = generateOrFilters(UnionType.AND, filters, nestedFilters);
// const nestedFilters = [{ field: ENTITY_SUB_TYPE_FILTER_NAME, values: ['CONTAINER', 'DATASET␞table'] }];
const orFilters = generateOrFilters(UnionType.AND, filters);

expect(orFilters).toMatchObject([
{
and: [...filters, { field: '_entityType', values: ['CONTAINER'] }],
and: [
{ field: TAGS_FILTER_NAME, values: ['urn:li:tag:tag1'] },
{ field: DOMAINS_FILTER_NAME, values: ['urn:li:domains:domain1'] },
{ field: '_entityType', values: ['CONTAINER'] },
],
},
{
and: [
...filters,
{ field: TAGS_FILTER_NAME, values: ['urn:li:tag:tag1'] },
{ field: DOMAINS_FILTER_NAME, values: ['urn:li:domains:domain1'] },
{ field: '_entityType', values: ['DATASET'] },
{ field: 'typeNames', values: ['table'] },
],
Expand All @@ -65,9 +71,9 @@ describe('generateOrFilters', () => {
const filters = [
{ field: TAGS_FILTER_NAME, values: ['urn:li:tag:tag1'] },
{ field: DOMAINS_FILTER_NAME, values: ['urn:li:domains:domain1'] },
{ field: ENTITY_SUB_TYPE_FILTER_NAME, values: ['CONTAINER', 'DATASET␞table'] },
];
const nestedFilters = [{ field: ENTITY_SUB_TYPE_FILTER_NAME, values: ['CONTAINER', 'DATASET␞table'] }];
const orFilters = generateOrFilters(UnionType.OR, filters, nestedFilters);
const orFilters = generateOrFilters(UnionType.OR, filters);

expect(orFilters).toMatchObject([
{
Expand All @@ -87,4 +93,18 @@ describe('generateOrFilters', () => {
},
]);
});

it('should generate orFilters and exclude filters with a provided exclude field', () => {
const filters = [
{ field: ENTITY_FILTER_NAME, values: ['DATASET', 'CONTAINER'] },
{ field: TAGS_FILTER_NAME, values: ['urn:li:tag:tag1'] },
];
const orFilters = generateOrFilters(UnionType.AND, filters, [ENTITY_FILTER_NAME]);

expect(orFilters).toMatchObject([
{
and: [{ field: TAGS_FILTER_NAME, values: ['urn:li:tag:tag1'] }],
},
]);
});
});
16 changes: 11 additions & 5 deletions datahub-web-react/src/app/search/utils/generateOrFilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,34 @@ function generateInputWithNestedFilters(filters: FacetFilterInput[], nestedFilte
export function generateOrFilters(
unionType: UnionType,
filters: FacetFilterInput[],
nestedFilters: FacetFilterInput[] = [],
excludedFilterFields: string[] = [],
): AndFilterInput[] {
if ((filters?.length || 0) === 0 && nestedFilters.length === 0) {
if ((filters?.length || 0) === 0) {
return [];
}
const nonNestedFilters = filters.filter(
(f) => !f.field.includes(FILTER_DELIMITER) && !excludedFilterFields?.includes(f.field),
);
const nestedFilters = filters.filter(
(f) => f.field.includes(FILTER_DELIMITER) && !excludedFilterFields?.includes(f.field),
);

if (unionType === UnionType.OR) {
const orFiltersWithNestedFilters = generateInputWithNestedFilters([], nestedFilters);
const orFilters = filters.map((filter) => ({
const orFilters = nonNestedFilters.map((filter) => ({
and: [filter],
}));
return [...orFilters, ...orFiltersWithNestedFilters];
}
const andFiltersWithNestedFilters = generateInputWithNestedFilters(filters, nestedFilters);
const andFiltersWithNestedFilters = generateInputWithNestedFilters(nonNestedFilters, nestedFilters);

if (andFiltersWithNestedFilters.length) {
return andFiltersWithNestedFilters;
}

return [
{
and: filters,
and: nonNestedFilters,
},
];
}
4 changes: 3 additions & 1 deletion docker/broker/env/docker.env
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://broker:29092,PLAINTEXT_HOST://localhost:9
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS=0
KAFKA_HEAP_OPTS=-Xms256m -Xmx256m
KAFKA_CONFLUENT_SUPPORT_METRICS_ENABLE=false
KAFKA_CONFLUENT_SUPPORT_METRICS_ENABLE=false
KAFKA_MESSAGE_MAX_BYTES=5242880
KAFKA_MAX_MESSAGE_BYTES=5242880
Loading

0 comments on commit 503291f

Please sign in to comment.