forked from jaegertracing/jaeger-ui
-
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.
Merge pull request #22 from digma-ai/fix/span-code-object-id
Add code object ids to the GET_SPANS message
- Loading branch information
Showing
3 changed files
with
40 additions
and
43 deletions.
There are no files selected for viewing
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,34 @@ | ||
import { Span } from '../types/trace'; | ||
|
||
interface IDigmaSpanData { | ||
id: string; | ||
name: string; | ||
instrumentationLibrary?: string; | ||
function?: string; | ||
namespace?: string; | ||
spanCodeObjectId?: string; | ||
methodCodeObjectId?: string; | ||
} | ||
|
||
const getSpanDataForDigma = (span: Span): IDigmaSpanData => { | ||
const tagsToGet: Omit<IDigmaSpanData, 'id' | 'name'> = { | ||
instrumentationLibrary: 'otel.library.name', | ||
function: 'code.function', | ||
namespace: 'code.namespace', | ||
spanCodeObjectId: 'digma.span.code.object.id', | ||
methodCodeObjectId: 'digma.method.code.object.id', | ||
}; | ||
|
||
const tagsValues = Object.entries(tagsToGet).reduce((acc, [key, value]) => { | ||
const tag = span.tags.find((x: any) => x.key === value); | ||
return tag ? { ...acc, [key]: tag.value } : acc; | ||
}, {}); | ||
|
||
return { | ||
...tagsValues, | ||
id: span.spanID, | ||
name: span.operationName, | ||
}; | ||
}; | ||
|
||
export default getSpanDataForDigma; |