how to display Events.Attributes in grafana plugin? #840
Unanswered
stchenlucas
asked this question in
Q&A
Replies: 2 comments
-
I'm facing the same issue. I think the expected output format is the following (source) export type TraceKeyValuePair<T = any> = {
key: string;
value: T;
type?: string;
};
/**
* Type representing a log in a span.
*/
export type TraceLog = {
// Millisecond epoch time
timestamp: number;
fields: TraceKeyValuePair[];
name?: string;
}; I managed to output an array with arrayMap(
i -> map(
'name', Events.Name[i],
'timestamp', toString(toUnixTimestamp64Milli(Events.Timestamp [i])),
),
arrayEnumerate(Events.Name)
) AS logs But I cannot figure out how to add the nested arrayMap(
i -> map(
'name', Events.Name[i],
'timestamp', toString(toUnixTimestamp64Milli(Events.Timestamp [i])),
'attributes', arrayMap(key -> map('key', key, 'value', Events.Attributes[i][key]), mapKeys(Events.Attributes[i]))
),
arrayEnumerate(Events.Name)
) AS logs And wrapping the entire |
Beta Was this translation helpful? Give feedback.
0 replies
-
The following works (thanks to @andreypopp for the solution) SELECT
arrayMap(
(name, timestamp, attributes) -> tuple(
name,
toString(toUnixTimestamp64Milli(timestamp)),
arrayMap(
key -> map('key', key, 'value', attributes[key]),
mapKeys(attributes)
)
)::Tuple(
name String,
timestamp String,
fields Array(Map(String, String))
),
Events.Name,
Events.Timestamp,
Events.Attributes
) AS logs |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
the sql example below shows how to display SpanAttributes and ResourceAttributes in grafana plugin, but how to display Events.Attributes ?
table definition
Beta Was this translation helpful? Give feedback.
All reactions