123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332 |
- import {transformMetricsResponseToSeries} from 'sentry/utils/metrics/transformMetricsResponseToSeries';
- describe('transformMetricsResponseToSeries', function () {
- it('transforms metrics into series', () => {
- expect(
- transformMetricsResponseToSeries(
- TestStubs.MetricsSessionUserCountByStatusByRelease()
- )
- ).toEqual([
- {
- seriesName: 'sum(sentry.sessions.session)|session.status:crashed|release:1',
- data: [
- {name: '2022-01-15T00:00:00Z', value: 0},
- {name: '2022-01-16T00:00:00Z', value: 0},
- {name: '2022-01-17T00:00:00Z', value: 0},
- {name: '2022-01-18T00:00:00Z', value: 0},
- {name: '2022-01-19T00:00:00Z', value: 0},
- {name: '2022-01-20T00:00:00Z', value: 0},
- {name: '2022-01-21T00:00:00Z', value: 0},
- {name: '2022-01-22T00:00:00Z', value: 0},
- {name: '2022-01-23T00:00:00Z', value: 0},
- {name: '2022-01-24T00:00:00Z', value: 23},
- {name: '2022-01-25T00:00:00Z', value: 11},
- {name: '2022-01-26T00:00:00Z', value: 0},
- {name: '2022-01-27T00:00:00Z', value: 0},
- {name: '2022-01-28T00:00:00Z', value: 0},
- ],
- },
- {
- seriesName: 'count_unique(sentry.sessions.user)|session.status:crashed|release:1',
- data: [
- {name: '2022-01-15T00:00:00Z', value: 0},
- {name: '2022-01-16T00:00:00Z', value: 0},
- {name: '2022-01-17T00:00:00Z', value: 0},
- {name: '2022-01-18T00:00:00Z', value: 0},
- {name: '2022-01-19T00:00:00Z', value: 0},
- {name: '2022-01-20T00:00:00Z', value: 0},
- {name: '2022-01-21T00:00:00Z', value: 0},
- {name: '2022-01-22T00:00:00Z', value: 0},
- {name: '2022-01-23T00:00:00Z', value: 0},
- {name: '2022-01-24T00:00:00Z', value: 1},
- {name: '2022-01-25T00:00:00Z', value: 1},
- {name: '2022-01-26T00:00:00Z', value: 0},
- {name: '2022-01-27T00:00:00Z', value: 0},
- {name: '2022-01-28T00:00:00Z', value: 0},
- ],
- },
- {
- seriesName: 'sum(sentry.sessions.session)|session.status:abnormal|release:1',
- data: [
- {name: '2022-01-15T00:00:00Z', value: 1},
- {name: '2022-01-16T00:00:00Z', value: 0},
- {name: '2022-01-17T00:00:00Z', value: 0},
- {name: '2022-01-18T00:00:00Z', value: 0},
- {name: '2022-01-19T00:00:00Z', value: 0},
- {name: '2022-01-20T00:00:00Z', value: 0},
- {name: '2022-01-21T00:00:00Z', value: 0},
- {name: '2022-01-22T00:00:00Z', value: 0},
- {name: '2022-01-23T00:00:00Z', value: 0},
- {name: '2022-01-24T00:00:00Z', value: 0},
- {name: '2022-01-25T00:00:00Z', value: 0},
- {name: '2022-01-26T00:00:00Z', value: 0},
- {name: '2022-01-27T00:00:00Z', value: 0},
- {name: '2022-01-28T00:00:00Z', value: 0},
- ],
- },
- {
- seriesName:
- 'count_unique(sentry.sessions.user)|session.status:abnormal|release:1',
- data: [
- {name: '2022-01-15T00:00:00Z', value: 1},
- {name: '2022-01-16T00:00:00Z', value: 0},
- {name: '2022-01-17T00:00:00Z', value: 0},
- {name: '2022-01-18T00:00:00Z', value: 0},
- {name: '2022-01-19T00:00:00Z', value: 0},
- {name: '2022-01-20T00:00:00Z', value: 0},
- {name: '2022-01-21T00:00:00Z', value: 0},
- {name: '2022-01-22T00:00:00Z', value: 0},
- {name: '2022-01-23T00:00:00Z', value: 0},
- {name: '2022-01-24T00:00:00Z', value: 0},
- {name: '2022-01-25T00:00:00Z', value: 0},
- {name: '2022-01-26T00:00:00Z', value: 0},
- {name: '2022-01-27T00:00:00Z', value: 0},
- {name: '2022-01-28T00:00:00Z', value: 0},
- ],
- },
- {
- seriesName: 'sum(sentry.sessions.session)|session.status:errored|release:1',
- data: [
- {name: '2022-01-15T00:00:00Z', value: 0},
- {name: '2022-01-16T00:00:00Z', value: 0},
- {name: '2022-01-17T00:00:00Z', value: 0},
- {name: '2022-01-18T00:00:00Z', value: 0},
- {name: '2022-01-19T00:00:00Z', value: 0},
- {name: '2022-01-20T00:00:00Z', value: 37},
- {name: '2022-01-21T00:00:00Z', value: 0},
- {name: '2022-01-22T00:00:00Z', value: 0},
- {name: '2022-01-23T00:00:00Z', value: 0},
- {name: '2022-01-24T00:00:00Z', value: 335},
- {name: '2022-01-25T00:00:00Z', value: 79},
- {name: '2022-01-26T00:00:00Z', value: 0},
- {name: '2022-01-27T00:00:00Z', value: 0},
- {name: '2022-01-28T00:00:00Z', value: 0},
- ],
- },
- {
- seriesName: 'count_unique(sentry.sessions.user)|session.status:errored|release:1',
- data: [
- {name: '2022-01-15T00:00:00Z', value: 0},
- {name: '2022-01-16T00:00:00Z', value: 0},
- {name: '2022-01-17T00:00:00Z', value: 0},
- {name: '2022-01-18T00:00:00Z', value: 0},
- {name: '2022-01-19T00:00:00Z', value: 0},
- {name: '2022-01-20T00:00:00Z', value: 1},
- {name: '2022-01-21T00:00:00Z', value: 0},
- {name: '2022-01-22T00:00:00Z', value: 0},
- {name: '2022-01-23T00:00:00Z', value: 0},
- {name: '2022-01-24T00:00:00Z', value: 2},
- {name: '2022-01-25T00:00:00Z', value: 2},
- {name: '2022-01-26T00:00:00Z', value: 0},
- {name: '2022-01-27T00:00:00Z', value: 0},
- {name: '2022-01-28T00:00:00Z', value: 0},
- ],
- },
- {
- seriesName: 'sum(sentry.sessions.session)|session.status:healthy|release:1',
- data: [
- {name: '2022-01-15T00:00:00Z', value: 0},
- {name: '2022-01-16T00:00:00Z', value: 0},
- {name: '2022-01-17T00:00:00Z', value: 0},
- {name: '2022-01-18T00:00:00Z', value: 0},
- {name: '2022-01-19T00:00:00Z', value: 0},
- {name: '2022-01-20T00:00:00Z', value: 2503},
- {name: '2022-01-21T00:00:00Z', value: 661},
- {name: '2022-01-22T00:00:00Z', value: 0},
- {name: '2022-01-23T00:00:00Z', value: 0},
- {name: '2022-01-24T00:00:00Z', value: 1464},
- {name: '2022-01-25T00:00:00Z', value: 430},
- {name: '2022-01-26T00:00:00Z', value: 0},
- {name: '2022-01-27T00:00:00Z', value: 0},
- {name: '2022-01-28T00:00:00Z', value: 0},
- ],
- },
- {
- seriesName: 'count_unique(sentry.sessions.user)|session.status:healthy|release:1',
- data: [
- {name: '2022-01-15T00:00:00Z', value: 0},
- {name: '2022-01-16T00:00:00Z', value: 0},
- {name: '2022-01-17T00:00:00Z', value: 0},
- {name: '2022-01-18T00:00:00Z', value: 0},
- {name: '2022-01-19T00:00:00Z', value: 0},
- {name: '2022-01-20T00:00:00Z', value: 3},
- {name: '2022-01-21T00:00:00Z', value: 3},
- {name: '2022-01-22T00:00:00Z', value: 0},
- {name: '2022-01-23T00:00:00Z', value: 0},
- {name: '2022-01-24T00:00:00Z', value: 1},
- {name: '2022-01-25T00:00:00Z', value: 1},
- {name: '2022-01-26T00:00:00Z', value: 0},
- {name: '2022-01-27T00:00:00Z', value: 0},
- {name: '2022-01-28T00:00:00Z', value: 0},
- ],
- },
- {
- seriesName: 'sum(sentry.sessions.session)|session.status:crashed|release:2',
- data: [
- {name: '2022-01-15T00:00:00Z', value: 1},
- {name: '2022-01-16T00:00:00Z', value: 0},
- {name: '2022-01-17T00:00:00Z', value: 0},
- {name: '2022-01-18T00:00:00Z', value: 0},
- {name: '2022-01-19T00:00:00Z', value: 0},
- {name: '2022-01-20T00:00:00Z', value: 0},
- {name: '2022-01-21T00:00:00Z', value: 0},
- {name: '2022-01-22T00:00:00Z', value: 0},
- {name: '2022-01-23T00:00:00Z', value: 0},
- {name: '2022-01-24T00:00:00Z', value: 23},
- {name: '2022-01-25T00:00:00Z', value: 11},
- {name: '2022-01-26T00:00:00Z', value: 0},
- {name: '2022-01-27T00:00:00Z', value: 0},
- {name: '2022-01-28T00:00:00Z', value: 0},
- ],
- },
- {
- seriesName: 'count_unique(sentry.sessions.user)|session.status:crashed|release:2',
- data: [
- {name: '2022-01-15T00:00:00Z', value: 1},
- {name: '2022-01-16T00:00:00Z', value: 0},
- {name: '2022-01-17T00:00:00Z', value: 0},
- {name: '2022-01-18T00:00:00Z', value: 0},
- {name: '2022-01-19T00:00:00Z', value: 0},
- {name: '2022-01-20T00:00:00Z', value: 0},
- {name: '2022-01-21T00:00:00Z', value: 0},
- {name: '2022-01-22T00:00:00Z', value: 0},
- {name: '2022-01-23T00:00:00Z', value: 0},
- {name: '2022-01-24T00:00:00Z', value: 2},
- {name: '2022-01-25T00:00:00Z', value: 2},
- {name: '2022-01-26T00:00:00Z', value: 0},
- {name: '2022-01-27T00:00:00Z', value: 0},
- {name: '2022-01-28T00:00:00Z', value: 0},
- ],
- },
- {
- seriesName: 'sum(sentry.sessions.session)|session.status:abnormal|release:2',
- data: [
- {name: '2022-01-15T00:00:00Z', value: 1},
- {name: '2022-01-16T00:00:00Z', value: 0},
- {name: '2022-01-17T00:00:00Z', value: 0},
- {name: '2022-01-18T00:00:00Z', value: 0},
- {name: '2022-01-19T00:00:00Z', value: 0},
- {name: '2022-01-20T00:00:00Z', value: 0},
- {name: '2022-01-21T00:00:00Z', value: 0},
- {name: '2022-01-22T00:00:00Z', value: 0},
- {name: '2022-01-23T00:00:00Z', value: 0},
- {name: '2022-01-24T00:00:00Z', value: 0},
- {name: '2022-01-25T00:00:00Z', value: 0},
- {name: '2022-01-26T00:00:00Z', value: 0},
- {name: '2022-01-27T00:00:00Z', value: 0},
- {name: '2022-01-28T00:00:00Z', value: 0},
- ],
- },
- {
- seriesName:
- 'count_unique(sentry.sessions.user)|session.status:abnormal|release:2',
- data: [
- {name: '2022-01-15T00:00:00Z', value: 1},
- {name: '2022-01-16T00:00:00Z', value: 0},
- {name: '2022-01-17T00:00:00Z', value: 0},
- {name: '2022-01-18T00:00:00Z', value: 0},
- {name: '2022-01-19T00:00:00Z', value: 0},
- {name: '2022-01-20T00:00:00Z', value: 0},
- {name: '2022-01-21T00:00:00Z', value: 0},
- {name: '2022-01-22T00:00:00Z', value: 0},
- {name: '2022-01-23T00:00:00Z', value: 0},
- {name: '2022-01-24T00:00:00Z', value: 0},
- {name: '2022-01-25T00:00:00Z', value: 0},
- {name: '2022-01-26T00:00:00Z', value: 0},
- {name: '2022-01-27T00:00:00Z', value: 0},
- {name: '2022-01-28T00:00:00Z', value: 0},
- ],
- },
- {
- seriesName: 'sum(sentry.sessions.session)|session.status:errored|release:2',
- data: [
- {name: '2022-01-15T00:00:00Z', value: 1},
- {name: '2022-01-16T00:00:00Z', value: 0},
- {name: '2022-01-17T00:00:00Z', value: 0},
- {name: '2022-01-18T00:00:00Z', value: 0},
- {name: '2022-01-19T00:00:00Z', value: 0},
- {name: '2022-01-20T00:00:00Z', value: 37},
- {name: '2022-01-21T00:00:00Z', value: 0},
- {name: '2022-01-22T00:00:00Z', value: 0},
- {name: '2022-01-23T00:00:00Z', value: 0},
- {name: '2022-01-24T00:00:00Z', value: 335},
- {name: '2022-01-25T00:00:00Z', value: 79},
- {name: '2022-01-26T00:00:00Z', value: 0},
- {name: '2022-01-27T00:00:00Z', value: 0},
- {name: '2022-01-28T00:00:00Z', value: 0},
- ],
- },
- {
- seriesName: 'count_unique(sentry.sessions.user)|session.status:errored|release:2',
- data: [
- {name: '2022-01-15T00:00:00Z', value: 1},
- {name: '2022-01-16T00:00:00Z', value: 0},
- {name: '2022-01-17T00:00:00Z', value: 0},
- {name: '2022-01-18T00:00:00Z', value: 0},
- {name: '2022-01-19T00:00:00Z', value: 0},
- {name: '2022-01-20T00:00:00Z', value: 1},
- {name: '2022-01-21T00:00:00Z', value: 0},
- {name: '2022-01-22T00:00:00Z', value: 0},
- {name: '2022-01-23T00:00:00Z', value: 0},
- {name: '2022-01-24T00:00:00Z', value: 1},
- {name: '2022-01-25T00:00:00Z', value: 1},
- {name: '2022-01-26T00:00:00Z', value: 0},
- {name: '2022-01-27T00:00:00Z', value: 0},
- {name: '2022-01-28T00:00:00Z', value: 0},
- ],
- },
- {
- seriesName: 'sum(sentry.sessions.session)|session.status:healthy|release:2',
- data: [
- {name: '2022-01-15T00:00:00Z', value: 1},
- {name: '2022-01-16T00:00:00Z', value: 0},
- {name: '2022-01-17T00:00:00Z', value: 0},
- {name: '2022-01-18T00:00:00Z', value: 0},
- {name: '2022-01-19T00:00:00Z', value: 0},
- {name: '2022-01-20T00:00:00Z', value: 2503},
- {name: '2022-01-21T00:00:00Z', value: 661},
- {name: '2022-01-22T00:00:00Z', value: 0},
- {name: '2022-01-23T00:00:00Z', value: 0},
- {name: '2022-01-24T00:00:00Z', value: 1464},
- {name: '2022-01-25T00:00:00Z', value: 430},
- {name: '2022-01-26T00:00:00Z', value: 0},
- {name: '2022-01-27T00:00:00Z', value: 0},
- {name: '2022-01-28T00:00:00Z', value: 0},
- ],
- },
- {
- seriesName: 'count_unique(sentry.sessions.user)|session.status:healthy|release:2',
- data: [
- {name: '2022-01-15T00:00:00Z', value: 1},
- {name: '2022-01-16T00:00:00Z', value: 0},
- {name: '2022-01-17T00:00:00Z', value: 0},
- {name: '2022-01-18T00:00:00Z', value: 0},
- {name: '2022-01-19T00:00:00Z', value: 0},
- {name: '2022-01-20T00:00:00Z', value: 10},
- {name: '2022-01-21T00:00:00Z', value: 3},
- {name: '2022-01-22T00:00:00Z', value: 0},
- {name: '2022-01-23T00:00:00Z', value: 0},
- {name: '2022-01-24T00:00:00Z', value: 4},
- {name: '2022-01-25T00:00:00Z', value: 3},
- {name: '2022-01-26T00:00:00Z', value: 0},
- {name: '2022-01-27T00:00:00Z', value: 0},
- {name: '2022-01-28T00:00:00Z', value: 0},
- ],
- },
- ]);
- });
- it('supports legend aliases', () => {
- expect(
- transformMetricsResponseToSeries(
- TestStubs.MetricsSessionUserCountByStatusByRelease(),
- 'Lorem'
- )[0]
- ).toEqual(
- expect.objectContaining({
- seriesName:
- 'Lorem: sum(sentry.sessions.session)|session.status:crashed|release:1',
- })
- );
- });
- });
|