Skip to content

Commit

Permalink
Merge pull request #249 from Helene/search_lookup
Browse files Browse the repository at this point in the history
Improve performance of OpenTSDB api search/loookup endpoint
  • Loading branch information
Helene authored Dec 5, 2024
2 parents 52ab44b + c14c3a6 commit 72a61bd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 2 additions & 4 deletions source/opentsdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,10 +373,8 @@ def parse_result_tags(self, identifiersMap):
if identifiersMap:
for identifiers in identifiersMap:
d = defaultdict(dict)
for key in identifiers.keys():
d['tags'][key] = identifiers[key]
if d not in self.results:
self.results.append(d)
d['tags'] = identifiers
self.results.append(d)


class SingleTimeSeriesResponse(object):
Expand Down
7 changes: 5 additions & 2 deletions source/queryHandler/Topo.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,11 @@ def getAllFilterMapsForSensor(self, searchSensor):
based on metadata topology returned from zimon "topo".
'''
filtersMaps = []
if searchSensor in set(self.allFiltersMaps.keys()):
filtersMaps.extend(self.allFiltersMaps[searchSensor])
if searchSensor in set(self.sensorsSpec.keys()):
for entryName in self.__compTree.keys():
values = self.__compTree[entryName]['filtersMap'].get(searchSensor, [])
if len(values) > 0:
filtersMaps.extend(values)
return filtersMaps

def getAllFilterMapsForMetric(self, searchMetric):
Expand Down

0 comments on commit 72a61bd

Please sign in to comment.