mirror of
https://github.com/grafana/grafana.git
synced 2025-02-13 00:55:47 -06:00
1a504ce673
* WIP: Search jaeger traces * Add more customizable query params * Fix failing test * Fix e2e test * Add tags input field * Minor changes * Fix tests * Add docs * Make sure linking is working * Add tests to datasource.ts * Apply suggestions from code review Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com> * Update Jaeger doc * UI updates * Address review comments * Add new screenshots to docs * Update placeholder text for tags Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
27 lines
536 B
TypeScript
27 lines
536 B
TypeScript
import logfmt from 'logfmt';
|
|
|
|
export function convertTagsLogfmt(tags: string | undefined) {
|
|
if (!tags) {
|
|
return '';
|
|
}
|
|
const data: any = logfmt.parse(tags);
|
|
Object.keys(data).forEach((key) => {
|
|
const value = data[key];
|
|
if (typeof value !== 'string') {
|
|
data[key] = String(value);
|
|
}
|
|
});
|
|
return JSON.stringify(data);
|
|
}
|
|
|
|
export function transformToLogfmt(tags: string | undefined) {
|
|
if (!tags) {
|
|
return '';
|
|
}
|
|
try {
|
|
return logfmt.stringify(JSON.parse(tags));
|
|
} catch {
|
|
return tags;
|
|
}
|
|
}
|