|
|
|
|
@@ -61,7 +61,7 @@ describe('createSpanLinkFactory', () => {
|
|
|
|
|
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
|
|
|
|
expect(linkDef!.href).toBe(
|
|
|
|
|
`/explore?left=${encodeURIComponent(
|
|
|
|
|
'{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"},"datasource":"loki1_uid","queries":[{"expr":"{cluster=\\"cluster1\\", hostname=\\"hostname1\\", service_namespace=\\"namespace1\\"}","refId":""}]}'
|
|
|
|
|
'{"range":{"from":"1602637200000","to":"1602637201000"},"datasource":"loki1_uid","queries":[{"expr":"{cluster=\\"cluster1\\", hostname=\\"hostname1\\", service_namespace=\\"namespace1\\"}","refId":""}]}'
|
|
|
|
|
)}`
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
@@ -87,7 +87,7 @@ describe('createSpanLinkFactory', () => {
|
|
|
|
|
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
|
|
|
|
expect(linkDef!.href).toBe(
|
|
|
|
|
`/explore?left=${encodeURIComponent(
|
|
|
|
|
'{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"},"datasource":"loki1_uid","queries":[{"expr":"{ip=\\"192.168.0.1\\"}","refId":""}]}'
|
|
|
|
|
'{"range":{"from":"1602637200000","to":"1602637201000"},"datasource":"loki1_uid","queries":[{"expr":"{ip=\\"192.168.0.1\\"}","refId":""}]}'
|
|
|
|
|
)}`
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
@@ -113,34 +113,35 @@ describe('createSpanLinkFactory', () => {
|
|
|
|
|
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
|
|
|
|
expect(linkDef!.href).toBe(
|
|
|
|
|
`/explore?left=${encodeURIComponent(
|
|
|
|
|
'{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"},"datasource":"loki1_uid","queries":[{"expr":"{ip=\\"192.168.0.1\\", host=\\"host\\"}","refId":""}]}'
|
|
|
|
|
'{"range":{"from":"1602637200000","to":"1602637201000"},"datasource":"loki1_uid","queries":[{"expr":"{ip=\\"192.168.0.1\\", host=\\"host\\"}","refId":""}]}'
|
|
|
|
|
)}`
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('with adjusted start and end time', () => {
|
|
|
|
|
const createLink = setupSpanLinkFactory({
|
|
|
|
|
spanStartTimeShift: '1m',
|
|
|
|
|
spanStartTimeShift: '-1m',
|
|
|
|
|
spanEndTimeShift: '1m',
|
|
|
|
|
});
|
|
|
|
|
expect(createLink).toBeDefined();
|
|
|
|
|
const links = createLink!(
|
|
|
|
|
createTraceSpan({
|
|
|
|
|
process: {
|
|
|
|
|
serviceName: 'service',
|
|
|
|
|
tags: [
|
|
|
|
|
{ key: 'hostname', value: 'hostname1' },
|
|
|
|
|
{ key: 'ip', value: '192.168.0.1' },
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
const span = createTraceSpan({
|
|
|
|
|
process: {
|
|
|
|
|
serviceName: 'service',
|
|
|
|
|
tags: [
|
|
|
|
|
{ key: 'hostname', value: 'hostname1' },
|
|
|
|
|
{ key: 'ip', value: '192.168.0.1' },
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
const links = createLink!(span);
|
|
|
|
|
const linkDef = links?.[0];
|
|
|
|
|
expect(linkDef).toBeDefined();
|
|
|
|
|
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
|
|
|
|
expect(linkDef!.href).toBe(
|
|
|
|
|
`/explore?left=${encodeURIComponent(
|
|
|
|
|
'{"range":{"from":"2020-10-14T01:01:00.000Z","to":"2020-10-14T01:01:01.000Z"},"datasource":"loki1_uid","queries":[{"expr":"{hostname=\\"hostname1\\"}","refId":""}]}'
|
|
|
|
|
`{"range":{"from":"${span.startTime / 1000 - 60000}","to":"${
|
|
|
|
|
span.startTime / 1000 + span.duration / 1000 + 60000
|
|
|
|
|
}"},"datasource":"loki1_uid","queries":[{"expr":"{hostname=\\"hostname1\\"}","refId":""}]}`
|
|
|
|
|
)}`
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
@@ -159,7 +160,7 @@ describe('createSpanLinkFactory', () => {
|
|
|
|
|
expect(decodeURIComponent(linkDef!.href)).toBe(
|
|
|
|
|
'/explore?left=' +
|
|
|
|
|
JSON.stringify({
|
|
|
|
|
range: { from: '2020-10-14T01:00:00.000Z', to: '2020-10-14T01:00:01.000Z' },
|
|
|
|
|
range: { from: '1602637200000', to: '1602637201000' },
|
|
|
|
|
datasource: 'loki1_uid',
|
|
|
|
|
queries: [
|
|
|
|
|
{
|
|
|
|
|
@@ -221,7 +222,7 @@ describe('createSpanLinkFactory', () => {
|
|
|
|
|
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
|
|
|
|
expect(linkDef!.href).toBe(
|
|
|
|
|
`/explore?left=${encodeURIComponent(
|
|
|
|
|
'{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"},"datasource":"loki1_uid","queries":[{"expr":"{service=\\"serviceName\\", pod=\\"podName\\"}","refId":""}]}'
|
|
|
|
|
'{"range":{"from":"1602637200000","to":"1602637201000"},"datasource":"loki1_uid","queries":[{"expr":"{service=\\"serviceName\\", pod=\\"podName\\"}","refId":""}]}'
|
|
|
|
|
)}`
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
@@ -251,7 +252,7 @@ describe('createSpanLinkFactory', () => {
|
|
|
|
|
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
|
|
|
|
expect(linkDef!.href).toBe(
|
|
|
|
|
`/explore?left=${encodeURIComponent(
|
|
|
|
|
'{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"},"datasource":"loki1_uid","queries":[{"expr":"{service.name=\\"serviceName\\", pod=\\"podName\\"}","refId":""}]}'
|
|
|
|
|
'{"range":{"from":"1602637200000","to":"1602637201000"},"datasource":"loki1_uid","queries":[{"expr":"{service.name=\\"serviceName\\", pod=\\"podName\\"}","refId":""}]}'
|
|
|
|
|
)}`
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
@@ -326,10 +327,10 @@ describe('createSpanLinkFactory', () => {
|
|
|
|
|
expect(linkDef).toBeDefined();
|
|
|
|
|
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
|
|
|
|
expect(linkDef!.href).toContain(
|
|
|
|
|
`${encodeURIComponent('{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"}')}`
|
|
|
|
|
`${encodeURIComponent('{"range":{"from":"1602637200000","to":"1602637201000"}')}`
|
|
|
|
|
);
|
|
|
|
|
expect(linkDef!.href).not.toContain(
|
|
|
|
|
`${encodeURIComponent('{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:00.000Z"}')}`
|
|
|
|
|
`${encodeURIComponent('{"range":{"from":"1602637200000","to":"1602637200000"}')}`
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@@ -348,7 +349,7 @@ describe('createSpanLinkFactory', () => {
|
|
|
|
|
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
|
|
|
|
expect(linkDef!.href).toBe(
|
|
|
|
|
`/explore?left=${encodeURIComponent(
|
|
|
|
|
'{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"},"datasource":"splunkUID","queries":[{"query":"cluster=\\"cluster1\\" hostname=\\"hostname1\\" service_namespace=\\"namespace1\\" \\"7946b05c2e2e4e5a\\" \\"6605c7b08e715d6c\\"","refId":""}]}'
|
|
|
|
|
'{"range":{"from":"1602637200000","to":"1602637201000"},"datasource":"splunkUID","queries":[{"query":"cluster=\\"cluster1\\" hostname=\\"hostname1\\" service_namespace=\\"namespace1\\" \\"7946b05c2e2e4e5a\\" \\"6605c7b08e715d6c\\"","refId":""}]}'
|
|
|
|
|
)}`
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
@@ -372,7 +373,7 @@ describe('createSpanLinkFactory', () => {
|
|
|
|
|
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
|
|
|
|
expect(linkDef!.href).toBe(
|
|
|
|
|
`/explore?left=${encodeURIComponent(
|
|
|
|
|
'{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"},"datasource":"splunkUID","queries":[{"query":"ip=\\"192.168.0.1\\"","refId":""}]}'
|
|
|
|
|
'{"range":{"from":"1602637200000","to":"1602637201000"},"datasource":"splunkUID","queries":[{"query":"ip=\\"192.168.0.1\\"","refId":""}]}'
|
|
|
|
|
)}`
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
@@ -399,7 +400,7 @@ describe('createSpanLinkFactory', () => {
|
|
|
|
|
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
|
|
|
|
expect(linkDef!.href).toBe(
|
|
|
|
|
`/explore?left=${encodeURIComponent(
|
|
|
|
|
'{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"},"datasource":"splunkUID","queries":[{"query":"hostname=\\"hostname1\\" ip=\\"192.168.0.1\\"","refId":""}]}'
|
|
|
|
|
'{"range":{"from":"1602637200000","to":"1602637201000"},"datasource":"splunkUID","queries":[{"query":"hostname=\\"hostname1\\" ip=\\"192.168.0.1\\"","refId":""}]}'
|
|
|
|
|
)}`
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
@@ -429,7 +430,7 @@ describe('createSpanLinkFactory', () => {
|
|
|
|
|
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
|
|
|
|
expect(linkDef!.href).toBe(
|
|
|
|
|
`/explore?left=${encodeURIComponent(
|
|
|
|
|
'{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"},"datasource":"splunkUID","queries":[{"query":"service=\\"serviceName\\" pod=\\"podName\\"","refId":""}]}'
|
|
|
|
|
'{"range":{"from":"1602637200000","to":"1602637201000"},"datasource":"splunkUID","queries":[{"query":"service=\\"serviceName\\" pod=\\"podName\\"","refId":""}]}'
|
|
|
|
|
)}`
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
@@ -466,7 +467,7 @@ describe('createSpanLinkFactory', () => {
|
|
|
|
|
expect(linkDef?.type).toBe(SpanLinkType.Metrics);
|
|
|
|
|
expect(linkDef!.href).toBe(
|
|
|
|
|
`/explore?left=${encodeURIComponent(
|
|
|
|
|
'{"range":{"from":"2020-10-14T00:58:00.000Z","to":"2020-10-14T01:02:01.000Z"},"datasource":"prom1Uid","queries":[{"expr":"customQuery","refId":"A"}]}'
|
|
|
|
|
'{"range":{"from":"1602637080000","to":"1602637321000"},"datasource":"prom1Uid","queries":[{"expr":"customQuery","refId":"A"}]}'
|
|
|
|
|
)}`
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
@@ -515,7 +516,7 @@ describe('createSpanLinkFactory', () => {
|
|
|
|
|
expect(namedLink!.title).toBe('Named Query');
|
|
|
|
|
expect(namedLink!.href).toBe(
|
|
|
|
|
`/explore?left=${encodeURIComponent(
|
|
|
|
|
'{"range":{"from":"2020-10-14T00:58:00.000Z","to":"2020-10-14T01:02:01.000Z"},"datasource":"prom1Uid","queries":[{"expr":"customQuery","refId":"A"}]}'
|
|
|
|
|
'{"range":{"from":"1602637080000","to":"1602637321000"},"datasource":"prom1Uid","queries":[{"expr":"customQuery","refId":"A"}]}'
|
|
|
|
|
)}`
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
@@ -525,7 +526,7 @@ describe('createSpanLinkFactory', () => {
|
|
|
|
|
expect(defaultLink!.title).toBe('defaultQuery');
|
|
|
|
|
expect(defaultLink!.href).toBe(
|
|
|
|
|
`/explore?left=${encodeURIComponent(
|
|
|
|
|
'{"range":{"from":"2020-10-14T00:58:00.000Z","to":"2020-10-14T01:02:01.000Z"},"datasource":"prom1Uid","queries":[{"expr":"histogram_quantile(0.5, sum(rate(traces_spanmetrics_latency_bucket{service=\\"test service\\"}[5m])) by (le))","refId":"A"}]}'
|
|
|
|
|
'{"range":{"from":"1602637080000","to":"1602637321000"},"datasource":"prom1Uid","queries":[{"expr":"histogram_quantile(0.5, sum(rate(traces_spanmetrics_latency_bucket{service=\\"test service\\"}[5m])) by (le))","refId":"A"}]}'
|
|
|
|
|
)}`
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
@@ -535,7 +536,7 @@ describe('createSpanLinkFactory', () => {
|
|
|
|
|
expect(unnamedQuery!.title).toBeUndefined();
|
|
|
|
|
expect(unnamedQuery!.href).toBe(
|
|
|
|
|
`/explore?left=${encodeURIComponent(
|
|
|
|
|
'{"range":{"from":"2020-10-14T00:58:00.000Z","to":"2020-10-14T01:02:01.000Z"},"datasource":"prom1Uid","queries":[{"expr":"no_name_here","refId":"A"}]}'
|
|
|
|
|
'{"range":{"from":"1602637080000","to":"1602637321000"},"datasource":"prom1Uid","queries":[{"expr":"no_name_here","refId":"A"}]}'
|
|
|
|
|
)}`
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
@@ -561,7 +562,7 @@ describe('createSpanLinkFactory', () => {
|
|
|
|
|
expect(linkDef?.type).toBe(SpanLinkType.Metrics);
|
|
|
|
|
expect(linkDef!.href).toBe(
|
|
|
|
|
`/explore?left=${encodeURIComponent(
|
|
|
|
|
'{"range":{"from":"2020-10-14T00:00:00.000Z","to":"2020-10-14T02:00:01.000Z"},"datasource":"prom1Uid","queries":[{"expr":"customQuery","refId":"A"}]}'
|
|
|
|
|
'{"range":{"from":"1602633600000","to":"1602640801000"},"datasource":"prom1Uid","queries":[{"expr":"customQuery","refId":"A"}]}'
|
|
|
|
|
)}`
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
@@ -599,7 +600,7 @@ describe('createSpanLinkFactory', () => {
|
|
|
|
|
expect(links![0].type).toBe(SpanLinkType.Metrics);
|
|
|
|
|
expect(links![0].href).toBe(
|
|
|
|
|
`/explore?left=${encodeURIComponent(
|
|
|
|
|
'{"range":{"from":"2020-10-14T00:58:00.000Z","to":"2020-10-14T01:02:01.000Z"},"datasource":"prom1Uid","queries":[{"expr":"metric{job=\\"tns/app\\", pod=\\"sample-pod\\", job=\\"tns/app\\", pod=\\"sample-pod\\"}[5m]","refId":"A"}]}'
|
|
|
|
|
'{"range":{"from":"1602637080000","to":"1602637321000"},"datasource":"prom1Uid","queries":[{"expr":"metric{job=\\"tns/app\\", pod=\\"sample-pod\\", job=\\"tns/app\\", pod=\\"sample-pod\\"}[5m]","refId":"A"}]}'
|
|
|
|
|
)}`
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
@@ -703,10 +704,10 @@ describe('createSpanLinkFactory', () => {
|
|
|
|
|
expect(linkDef).toBeDefined();
|
|
|
|
|
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
|
|
|
|
expect(linkDef!.href).toContain(
|
|
|
|
|
`${encodeURIComponent('{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"}')}`
|
|
|
|
|
`${encodeURIComponent('{"range":{"from":"1602637200000","to":"1602637201000"}')}`
|
|
|
|
|
);
|
|
|
|
|
expect(linkDef!.href).not.toContain(
|
|
|
|
|
`${encodeURIComponent('{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:00.000Z"}')}`
|
|
|
|
|
`${encodeURIComponent('{"range":{"from":"1602637200000","to":"1602637200000"}')}`
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@@ -728,7 +729,7 @@ describe('createSpanLinkFactory', () => {
|
|
|
|
|
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
|
|
|
|
expect(linkDef!.href).toBe(
|
|
|
|
|
`/explore?left=${encodeURIComponent(
|
|
|
|
|
`{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"},"datasource":"${searchUID}","queries":[{"query":"\\"6605c7b08e715d6c\\" AND \\"7946b05c2e2e4e5a\\" AND cluster:\\"cluster1\\" AND hostname:\\"hostname1\\" AND service_namespace:\\"namespace1\\"","refId":"","metrics":[{"id":"1","type":"logs"}]}]}`
|
|
|
|
|
`{"range":{"from":"1602637200000","to":"1602637201000"},"datasource":"${searchUID}","queries":[{"query":"\\"6605c7b08e715d6c\\" AND \\"7946b05c2e2e4e5a\\" AND cluster:\\"cluster1\\" AND hostname:\\"hostname1\\" AND service_namespace:\\"namespace1\\"","refId":"","metrics":[{"id":"1","type":"logs"}]}]}`
|
|
|
|
|
)}`
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
@@ -756,7 +757,7 @@ describe('createSpanLinkFactory', () => {
|
|
|
|
|
expect(linkDef).toBeDefined();
|
|
|
|
|
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
|
|
|
|
expect(decodeURIComponent(linkDef!.href)).toBe(
|
|
|
|
|
`/explore?left={"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"},"datasource":"searchUID","queries":[{"query":"\\"7946b05c2e2e4e5a\\"","refId":"","metrics":[{"id":"1","type":"logs"}]}]}`
|
|
|
|
|
`/explore?left={"range":{"from":"1602637200000","to":"1602637201000"},"datasource":"searchUID","queries":[{"query":"\\"7946b05c2e2e4e5a\\"","refId":"","metrics":[{"id":"1","type":"logs"}]}]}`
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@@ -782,7 +783,7 @@ describe('createSpanLinkFactory', () => {
|
|
|
|
|
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
|
|
|
|
expect(linkDef!.href).toBe(
|
|
|
|
|
`/explore?left=${encodeURIComponent(
|
|
|
|
|
`{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"},"datasource":"${searchUID}","queries":[{"query":"ip:\\"192.168.0.1\\"","refId":"","metrics":[{"id":"1","type":"logs"}]}]}`
|
|
|
|
|
`{"range":{"from":"1602637200000","to":"1602637201000"},"datasource":"${searchUID}","queries":[{"query":"ip:\\"192.168.0.1\\"","refId":"","metrics":[{"id":"1","type":"logs"}]}]}`
|
|
|
|
|
)}`
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
@@ -812,7 +813,7 @@ describe('createSpanLinkFactory', () => {
|
|
|
|
|
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
|
|
|
|
expect(linkDef!.href).toBe(
|
|
|
|
|
`/explore?left=${encodeURIComponent(
|
|
|
|
|
`{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"},"datasource":"${searchUID}","queries":[{"query":"hostname:\\"hostname1\\" AND ip:\\"192.168.0.1\\"","refId":"","metrics":[{"id":"1","type":"logs"}]}]}`
|
|
|
|
|
`{"range":{"from":"1602637200000","to":"1602637201000"},"datasource":"${searchUID}","queries":[{"query":"hostname:\\"hostname1\\" AND ip:\\"192.168.0.1\\"","refId":"","metrics":[{"id":"1","type":"logs"}]}]}`
|
|
|
|
|
)}`
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
@@ -845,7 +846,7 @@ describe('createSpanLinkFactory', () => {
|
|
|
|
|
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
|
|
|
|
expect(linkDef!.href).toBe(
|
|
|
|
|
`/explore?left=${encodeURIComponent(
|
|
|
|
|
`{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"},"datasource":"${searchUID}","queries":[{"query":"service:\\"serviceName\\" AND pod:\\"podName\\"","refId":"","metrics":[{"id":"1","type":"logs"}]}]}`
|
|
|
|
|
`{"range":{"from":"1602637200000","to":"1602637201000"},"datasource":"${searchUID}","queries":[{"query":"service:\\"serviceName\\" AND pod:\\"podName\\"","refId":"","metrics":[{"id":"1","type":"logs"}]}]}`
|
|
|
|
|
)}`
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
@@ -893,10 +894,10 @@ describe('createSpanLinkFactory', () => {
|
|
|
|
|
expect(linkDef).toBeDefined();
|
|
|
|
|
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
|
|
|
|
expect(linkDef!.href).toContain(
|
|
|
|
|
`${encodeURIComponent('{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"}')}`
|
|
|
|
|
`${encodeURIComponent('{"range":{"from":"1602637200000","to":"1602637201000"}')}`
|
|
|
|
|
);
|
|
|
|
|
expect(linkDef!.href).not.toContain(
|
|
|
|
|
`${encodeURIComponent('{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:00.000Z"}')}`
|
|
|
|
|
`${encodeURIComponent('{"range":{"from":"1602637200000","to":"1602637200000"}')}`
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@@ -918,7 +919,7 @@ describe('createSpanLinkFactory', () => {
|
|
|
|
|
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
|
|
|
|
expect(linkDef!.href).toBe(
|
|
|
|
|
`/explore?left=${encodeURIComponent(
|
|
|
|
|
`{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"},"datasource":"${searchUID}","queries":[{"query":"\\"6605c7b08e715d6c\\" AND \\"7946b05c2e2e4e5a\\" AND cluster=\\"cluster1\\" AND hostname=\\"hostname1\\" AND service_namespace=\\"namespace1\\"","refId":""}]}`
|
|
|
|
|
`{"range":{"from":"1602637200000","to":"1602637201000"},"datasource":"${searchUID}","queries":[{"query":"\\"6605c7b08e715d6c\\" AND \\"7946b05c2e2e4e5a\\" AND cluster=\\"cluster1\\" AND hostname=\\"hostname1\\" AND service_namespace=\\"namespace1\\"","refId":""}]}`
|
|
|
|
|
)}`
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
@@ -946,7 +947,7 @@ describe('createSpanLinkFactory', () => {
|
|
|
|
|
expect(linkDef).toBeDefined();
|
|
|
|
|
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
|
|
|
|
expect(decodeURIComponent(linkDef!.href)).toBe(
|
|
|
|
|
`/explore?left={"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"},"datasource":"searchUID","queries":[{"query":"\\"7946b05c2e2e4e5a\\"","refId":""}]}`
|
|
|
|
|
`/explore?left={"range":{"from":"1602637200000","to":"1602637201000"},"datasource":"searchUID","queries":[{"query":"\\"7946b05c2e2e4e5a\\"","refId":""}]}`
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@@ -972,7 +973,7 @@ describe('createSpanLinkFactory', () => {
|
|
|
|
|
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
|
|
|
|
expect(linkDef!.href).toBe(
|
|
|
|
|
`/explore?left=${encodeURIComponent(
|
|
|
|
|
`{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"},"datasource":"${searchUID}","queries":[{"query":"ip=\\"192.168.0.1\\"","refId":""}]}`
|
|
|
|
|
`{"range":{"from":"1602637200000","to":"1602637201000"},"datasource":"${searchUID}","queries":[{"query":"ip=\\"192.168.0.1\\"","refId":""}]}`
|
|
|
|
|
)}`
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
@@ -1002,7 +1003,7 @@ describe('createSpanLinkFactory', () => {
|
|
|
|
|
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
|
|
|
|
expect(linkDef!.href).toBe(
|
|
|
|
|
`/explore?left=${encodeURIComponent(
|
|
|
|
|
`{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"},"datasource":"${searchUID}","queries":[{"query":"hostname=\\"hostname1\\" AND ip=\\"192.168.0.1\\"","refId":""}]}`
|
|
|
|
|
`{"range":{"from":"1602637200000","to":"1602637201000"},"datasource":"${searchUID}","queries":[{"query":"hostname=\\"hostname1\\" AND ip=\\"192.168.0.1\\"","refId":""}]}`
|
|
|
|
|
)}`
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
@@ -1035,7 +1036,7 @@ describe('createSpanLinkFactory', () => {
|
|
|
|
|
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
|
|
|
|
expect(linkDef!.href).toBe(
|
|
|
|
|
`/explore?left=${encodeURIComponent(
|
|
|
|
|
`{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"},"datasource":"${searchUID}","queries":[{"query":"service=\\"serviceName\\" AND pod=\\"podName\\"","refId":""}]}`
|
|
|
|
|
`{"range":{"from":"1602637200000","to":"1602637201000"},"datasource":"${searchUID}","queries":[{"query":"service=\\"serviceName\\" AND pod=\\"podName\\"","refId":""}]}`
|
|
|
|
|
)}`
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
@@ -1142,7 +1143,7 @@ describe('createSpanLinkFactory', () => {
|
|
|
|
|
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
|
|
|
|
expect(linkDef!.href).toBe(
|
|
|
|
|
`/explore?left=${encodeURIComponent(
|
|
|
|
|
'{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"},"datasource":"falconLogScaleUID","queries":[{"lsql":"cluster=\\"cluster1\\" OR hostname=\\"hostname1\\" OR service_namespace=\\"namespace1\\" or \\"7946b05c2e2e4e5a\\" or \\"6605c7b08e715d6c\\"","refId":""}]}'
|
|
|
|
|
'{"range":{"from":"1602637200000","to":"1602637201000"},"datasource":"falconLogScaleUID","queries":[{"lsql":"cluster=\\"cluster1\\" OR hostname=\\"hostname1\\" OR service_namespace=\\"namespace1\\" or \\"7946b05c2e2e4e5a\\" or \\"6605c7b08e715d6c\\"","refId":""}]}'
|
|
|
|
|
)}`
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
@@ -1166,7 +1167,7 @@ describe('createSpanLinkFactory', () => {
|
|
|
|
|
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
|
|
|
|
expect(linkDef!.href).toBe(
|
|
|
|
|
`/explore?left=${encodeURIComponent(
|
|
|
|
|
'{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"},"datasource":"falconLogScaleUID","queries":[{"lsql":"ip=\\"192.168.0.1\\"","refId":""}]}'
|
|
|
|
|
'{"range":{"from":"1602637200000","to":"1602637201000"},"datasource":"falconLogScaleUID","queries":[{"lsql":"ip=\\"192.168.0.1\\"","refId":""}]}'
|
|
|
|
|
)}`
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
@@ -1193,7 +1194,7 @@ describe('createSpanLinkFactory', () => {
|
|
|
|
|
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
|
|
|
|
expect(linkDef!.href).toBe(
|
|
|
|
|
`/explore?left=${encodeURIComponent(
|
|
|
|
|
'{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"},"datasource":"falconLogScaleUID","queries":[{"lsql":"hostname=\\"hostname1\\" OR ip=\\"192.168.0.1\\"","refId":""}]}'
|
|
|
|
|
'{"range":{"from":"1602637200000","to":"1602637201000"},"datasource":"falconLogScaleUID","queries":[{"lsql":"hostname=\\"hostname1\\" OR ip=\\"192.168.0.1\\"","refId":""}]}'
|
|
|
|
|
)}`
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
@@ -1223,7 +1224,7 @@ describe('createSpanLinkFactory', () => {
|
|
|
|
|
expect(linkDef?.type).toBe(SpanLinkType.Logs);
|
|
|
|
|
expect(linkDef!.href).toBe(
|
|
|
|
|
`/explore?left=${encodeURIComponent(
|
|
|
|
|
'{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"},"datasource":"falconLogScaleUID","queries":[{"lsql":"service=\\"serviceName\\" OR pod=\\"podName\\"","refId":""}]}'
|
|
|
|
|
'{"range":{"from":"1602637200000","to":"1602637201000"},"datasource":"falconLogScaleUID","queries":[{"lsql":"service=\\"serviceName\\" OR pod=\\"podName\\"","refId":""}]}'
|
|
|
|
|
)}`
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
@@ -1258,13 +1259,13 @@ describe('dataFrame links', () => {
|
|
|
|
|
expect(links![0].type).toBe(SpanLinkType.Unknown);
|
|
|
|
|
expect(links![1].href).toBe(
|
|
|
|
|
`/explore?left=${encodeURIComponent(
|
|
|
|
|
'{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"},"datasource":"loki1_uid","queries":[{"message":"SELECT * FROM superhero WHERE name=host"}]}'
|
|
|
|
|
'{"range":{"from":"1602637200000","to":"1602637201000"},"datasource":"loki1_uid","queries":[{"message":"SELECT * FROM superhero WHERE name=host"}]}'
|
|
|
|
|
)}`
|
|
|
|
|
);
|
|
|
|
|
expect(links![1].type).toBe(SpanLinkType.Unknown);
|
|
|
|
|
expect(links![2].href).toBe(
|
|
|
|
|
`/explore?left=${encodeURIComponent(
|
|
|
|
|
'{"range":{"from":"2020-10-14T01:00:00.000Z","to":"2020-10-14T01:00:01.000Z"},"datasource":"loki1_uid","queries":[{"expr":"go_memstats_heap_inuse_bytes{job=\'host\'}"}]}'
|
|
|
|
|
'{"range":{"from":"1602637200000","to":"1602637201000"},"datasource":"loki1_uid","queries":[{"expr":"go_memstats_heap_inuse_bytes{job=\'host\'}"}]}'
|
|
|
|
|
)}`
|
|
|
|
|
);
|
|
|
|
|
expect(links![2].type).toBe(SpanLinkType.Unknown);
|
|
|
|
|
|