Skip to content

Commit

Permalink
fix for Instana (observ-vol-mgt#82)
Browse files Browse the repository at this point in the history
* fix for Instana

* fixing lint errors
  • Loading branch information
eranra authored Jun 16, 2024
1 parent 43d6276 commit ec72a2b
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 7 deletions.
4 changes: 2 additions & 2 deletions controller/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ run_dev: install_requirements ## Execute the pipeline synchronously on syntheti
python main.py -c config.yaml

.PHONY: run_dev_map_reduce
run_dev_map_reduce: install_requirements ## Execute the pipeline synchronously on synthetic data
python main.py -c ../contrib/map_reduce_examples/by_name.yaml
run_dev_map_reduce: install_requirements ## Execute the pipeline using map reduce (scalability)
python main.py -c contrib/examples/config_files/map_reduce_examples/by_name.yaml


##@ CI
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
pipeline:
- name: ingest_file
- name: feature_extraction_tsfel
follows: [ingest_file]
- name: generate_insights
follows: [feature_extraction_tsfel]
- name: config_generator_otel
follows: [feature_extraction_tsfel, generate_insights]
parameters:
- name: ingest_file
type: ingest
subtype: file
input_data: []
output_data: [signals]
config:
filter_metadata: ""
ingest_name_template: "$plugin|$__name__(job,$label,$instance,snapshot)"
file_name: ../contrib/fetch-offline-data/instana/demo-eu/instana_metrics_1000_metrics.promql.json
- name: feature_extraction_tsfel
type: map_reduce
input_data: [signals]
output_data: [extracted_signals]
config:
map_function:
name: map1
type: map
subtype: by_name
config:
name_pattern: "(^[^|]+)|.+"
compute_function:
name: extract_in_parallel
type: extract
subtype: tsfel
reduce_function:
name: reduce1
type: reduce
subtype: simple
- name: generate_insights
type: insights
subtype:
input_data: [extracted_signals]
output_data: [signals_to_keep, signals_to_reduce, text_insights]
- name: config_generator_otel
type: config_generator
subtype: otel
input_data: [extracted_signals, signals_to_keep, signals_to_reduce]
output_data: [r_value]
config:
directory: /tmp
File renamed without changes.
12 changes: 7 additions & 5 deletions controller/map_reduce/by_name_clustering.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@
def _map(config, signals):
clustered_signals = []
clustered_signals_dict = {}
name_pattern = config["name_pattern"] \
if config and 'name_pattern' in config else None
name_pattern = config.name_pattern

if name_pattern is None:
if name_pattern == "" or name_pattern is None:
return [signals]

for signal in signals:
Expand All @@ -33,5 +32,8 @@ def _map(config, signals):
clustered_signals_dict[match.group()].append(signal)

clustered_signals = list(clustered_signals_dict.values())
new_signals = Signals(signals.metadata, clustered_signals)
return new_signals
clustered_signals_list = []
for clustered_signals_group in clustered_signals:
clustered_signals_list.append(Signals(signals.metadata, clustered_signals_group))

return clustered_signals_list

0 comments on commit ec72a2b

Please sign in to comment.