Skip to content

Commit

Permalink
Merge pull request #2952 from atlanhq/fix-utm-tags
Browse files Browse the repository at this point in the history
fix: just tap the utm tags metrics coming from product for indexsearch metric
  • Loading branch information
sumandas0 authored Apr 25, 2024
2 parents 0e89204 + b7e3f15 commit ff7cdd5
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public class DiscoveryREST {

private static final String INDEXSEARCH_TAG_NAME = "indexsearch";
private static final Set<String> TRACKING_UTM_TAGS = new HashSet<>(Arrays.asList("ui_main_list", "ui_popup_searchbar"));
private static final String UTM_TAG_FROM_PRODUCT = "project_webapp";

@Inject
public DiscoveryREST(AtlasTypeRegistry typeRegistry, AtlasDiscoveryService discoveryService,
Expand Down Expand Up @@ -436,12 +437,16 @@ public AtlasSearchResult indexSearch(@Context HttpServletRequest servletRequest,
if(CollectionUtils.isNotEmpty(parameters.getUtmTags())) {
AtlasPerfMetrics.Metric indexsearchMetric = new AtlasPerfMetrics.Metric(INDEXSEARCH_TAG_NAME);
indexsearchMetric.addTag("utmTag", "other");
indexsearchMetric.addTag("source", "other");
for (String utmTag : parameters.getUtmTags()) {
if (TRACKING_UTM_TAGS.contains(utmTag)) {
indexsearchMetric.addTag("utmTag", utmTag);
break;
}
}
if (parameters.getUtmTags().contains(UTM_TAG_FROM_PRODUCT)) {
indexsearchMetric.addTag("source", UTM_TAG_FROM_PRODUCT);
}
indexsearchMetric.addTag("name", INDEXSEARCH_TAG_NAME);
indexsearchMetric.setTotalTimeMSecs(System.currentTimeMillis() - startTime);
RequestContext.get().addApplicationMetrics(indexsearchMetric);
Expand Down

0 comments on commit ff7cdd5

Please sign in to comment.