Skip to content

Commit

Permalink
Add temporal options to Zipkin API
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel-Darbord committed Mar 25, 2024
1 parent 10a90f1 commit 0b8ebca
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions src/Famix-OpenTelemetry-Importer/OTelZipkinExtractor.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ Class {
#category : #'Famix-OpenTelemetry-Importer'
}

{ #category : #parameters }
OTelZipkinExtractor >> endTs: anInteger [
"Only return traces where all timestamp are at or before this time in epoch milliseconds."

self parameters at: 'endTs' put: anInteger
]

{ #category : #accessing }
OTelZipkinExtractor >> endpoint [

Expand All @@ -29,10 +36,7 @@ OTelZipkinExtractor >> extract [
"Ask Zipkin server for traces and parse result."

| url data |
url := String streamContents: [ :stream |
stream << endpoint << '/api/v2/traces?'.
self parameters associationsDo: [ :param |
stream << $& << param key << $= << param value asString ] ].
url := self request.
data := ZnClient new get: url.
self output: data.
^ (NeoJSONReader on: data readStream) parseList
Expand All @@ -44,12 +48,28 @@ OTelZipkinExtractor >> limit: anInteger [
self parameters at: 'limit' put: anInteger
]

{ #category : #parameters }
OTelZipkinExtractor >> lookback: anInteger [
"Only return traces where all timestamp are at or after `endTs - lookback`, in milliseconds."

self parameters at: 'lookback' put: anInteger
]

{ #category : #accessing }
OTelZipkinExtractor >> parameters [

^ parameters ifNil: [ parameters := Dictionary new ]
]

{ #category : #extraction }
OTelZipkinExtractor >> request [

^ String streamContents: [ :stream |
stream << endpoint << '/api/v2/traces?'.
self parameters associationsDo: [ :param |
stream << $& << param key << $= << param value asString ] ]
]

{ #category : #parameters }
OTelZipkinExtractor >> serviceName: aString [

Expand Down

0 comments on commit 0b8ebca

Please sign in to comment.