-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
134 additions
and
43 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
src/Famix-OpenTelemetry-Importer-Value/FamixStMethod.extension.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
src/Famix-OpenTelemetry-Importer-Value/FamixTWithParameters.extension.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
Package { #name : #'Famix-OpenTelemetry-Importer-Value' } | ||
Package { #name : 'Famix-OpenTelemetry-Importer-Value' } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
" | ||
I group spans with my `selector` block, sort them with my `comparator` (or do not sort if not provided), and keep only the top `count`. | ||
" | ||
Class { | ||
#name : 'OTelTopNQuery', | ||
#superclass : 'OTelQuery', | ||
#instVars : [ | ||
'comparator', | ||
'count' | ||
], | ||
#category : 'Famix-OpenTelemetry-Importer', | ||
#package : 'Famix-OpenTelemetry-Importer' | ||
} | ||
|
||
{ #category : 'accessing' } | ||
OTelTopNQuery >> comparator [ | ||
"If not specified, do not sort" | ||
|
||
^ comparator | ||
] | ||
|
||
{ #category : 'accessing' } | ||
OTelTopNQuery >> comparator: aTwoArgsBlock [ | ||
|
||
comparator := aTwoArgsBlock | ||
] | ||
|
||
{ #category : 'transforming' } | ||
OTelTopNQuery >> count [ | ||
|
||
^ count ifNil: [ count := 1 ] | ||
] | ||
|
||
{ #category : 'transforming' } | ||
OTelTopNQuery >> count: anInteger [ | ||
|
||
count := anInteger max: 1 | ||
] | ||
|
||
{ #category : 'transforming' } | ||
OTelTopNQuery >> value: model [ | ||
"Only keep the top n of each group in the model." | ||
|
||
(model allSpans groupedBy: self selector) do: [ :spans | | ||
| sortedSpans | | ||
sortedSpans := self comparator | ||
ifNil: [ spans ] | ||
ifNotNil: [ :comp | spans sorted: comp ]. | ||
self count + 1 to: spans size do: [ :i | | ||
self removeSpan: (sortedSpans at: i) ] ]. | ||
^ model | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters