Skip to content

Commit

Permalink
add STONFileExtractor and Loader
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiovandewaeter committed Apr 29, 2024
1 parent 0b8ebca commit 26816a0
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/Famix-OpenTelemetry-Importer/OTelSTONFileExtractor.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Class {
#name : #OTelSTONFileExtractor,
#superclass : #OTelAbstractExtractor,
#instVars : [
'filename'
],
#category : #'Famix-OpenTelemetry-Importer'
}

{ #category : #extraction }
OTelSTONFileExtractor >> extract [

^ (STONReader on: filename asFileReference readStream) next
]

{ #category : #accessing }
OTelSTONFileExtractor >> filename [

^ filename
]

{ #category : #accessing }
OTelSTONFileExtractor >> filename: anObject [

filename := anObject
]
25 changes: 25 additions & 0 deletions src/Famix-OpenTelemetry-Importer/OTelSTONFileLoader.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Class {
#name : #OTelSTONFileLoader,
#superclass : #OTelAbstractLoader,
#category : #'Famix-OpenTelemetry-Importer'
}

{ #category : #loading }
OTelSTONFileLoader >> load: rawTraces [

rawTraces do: [ :rawSpan |
| span |
span := self loadSpan: rawSpan ].
^ self model
]

{ #category : #'private - loading' }
OTelSTONFileLoader >> loadSpan: anOTSpan [

^ self model newSpan
id: anOTSpan spanId;
name: anOTSpan name;
tags: anOTSpan attributes;
timestamp: anOTSpan startTime;
duration: anOTSpan endTime - anOTSpan startTime
]

0 comments on commit 26816a0

Please sign in to comment.