123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302 |
- import {
- generateReleaseWidgetFieldOptions,
- SESSIONS_FIELDS,
- } from 'sentry/views/dashboardsV2/widgetBuilder/releaseWidget/fields';
- describe('generateReleaseWidgetFieldOptions', function () {
- const fields = Object.values(SESSIONS_FIELDS);
- const tagKeys = ['release', 'environment'];
- it('generates correct field options', function () {
- expect(generateReleaseWidgetFieldOptions(fields, tagKeys)).toEqual({
- 'field:session': {
- label: 'session',
- value: {
- kind: 'metric',
- meta: {
- dataType: 'integer',
- name: 'session',
- },
- },
- },
- 'field:session.duration': {
- label: 'session.duration',
- value: {
- kind: 'metric',
- meta: {
- dataType: 'duration',
- name: 'session.duration',
- },
- },
- },
- 'field:user': {
- label: 'user',
- value: {
- kind: 'metric',
- meta: {
- dataType: 'string',
- name: 'user',
- },
- },
- },
- 'function:avg': {
- label: 'avg(…)',
- value: {
- kind: 'function',
- meta: {
- name: 'avg',
- parameters: [
- {
- columnTypes: ['duration'],
- defaultValue: 'session.duration',
- kind: 'column',
- required: true,
- },
- ],
- },
- },
- },
- 'function:count_abnormal': {
- label: 'count_abnormal(…)',
- value: {
- kind: 'function',
- meta: {
- name: 'count_abnormal',
- parameters: [
- {
- columnTypes: ['integer', 'string'],
- defaultValue: 'session',
- kind: 'column',
- required: true,
- },
- ],
- },
- },
- },
- 'function:count_crashed': {
- label: 'count_crashed(…)',
- value: {
- kind: 'function',
- meta: {
- name: 'count_crashed',
- parameters: [
- {
- columnTypes: ['integer', 'string'],
- defaultValue: 'session',
- kind: 'column',
- required: true,
- },
- ],
- },
- },
- },
- 'function:count_errored': {
- label: 'count_errored(…)',
- value: {
- kind: 'function',
- meta: {
- name: 'count_errored',
- parameters: [
- {
- columnTypes: ['integer', 'string'],
- defaultValue: 'session',
- kind: 'column',
- required: true,
- },
- ],
- },
- },
- },
- 'function:count_healthy': {
- label: 'count_healthy(…)',
- value: {
- kind: 'function',
- meta: {
- name: 'count_healthy',
- parameters: [
- {
- columnTypes: ['integer', 'string'],
- defaultValue: 'session',
- kind: 'column',
- required: true,
- },
- ],
- },
- },
- },
- 'function:count_unique': {
- label: 'count_unique(…)',
- value: {
- kind: 'function',
- meta: {
- name: 'count_unique',
- parameters: [
- {
- columnTypes: ['string'],
- defaultValue: 'user',
- kind: 'column',
- required: true,
- },
- ],
- },
- },
- },
- 'function:crash_free_rate': {
- label: 'crash_free_rate(…)',
- value: {
- kind: 'function',
- meta: {
- name: 'crash_free_rate',
- parameters: [
- {
- columnTypes: ['integer', 'string'],
- defaultValue: 'session',
- kind: 'column',
- required: true,
- },
- ],
- },
- },
- },
- 'function:crash_rate': {
- label: 'crash_rate(…)',
- value: {
- kind: 'function',
- meta: {
- name: 'crash_rate',
- parameters: [
- {
- columnTypes: ['integer', 'string'],
- defaultValue: 'session',
- kind: 'column',
- required: true,
- },
- ],
- },
- },
- },
- 'function:max': {
- label: 'max(…)',
- value: {
- kind: 'function',
- meta: {
- name: 'max',
- parameters: [
- {
- columnTypes: ['duration'],
- defaultValue: 'session.duration',
- kind: 'column',
- required: true,
- },
- ],
- },
- },
- },
- 'function:p50': {
- label: 'p50(…)',
- value: {
- kind: 'function',
- meta: {
- name: 'p50',
- parameters: [
- {
- columnTypes: ['duration'],
- defaultValue: 'session.duration',
- kind: 'column',
- required: true,
- },
- ],
- },
- },
- },
- 'function:p75': {
- label: 'p75(…)',
- value: {
- kind: 'function',
- meta: {
- name: 'p75',
- parameters: [
- {
- columnTypes: ['duration'],
- defaultValue: 'session.duration',
- kind: 'column',
- required: true,
- },
- ],
- },
- },
- },
- 'function:p95': {
- label: 'p95(…)',
- value: {
- kind: 'function',
- meta: {
- name: 'p95',
- parameters: [
- {
- columnTypes: ['duration'],
- defaultValue: 'session.duration',
- kind: 'column',
- required: true,
- },
- ],
- },
- },
- },
- 'function:p99': {
- label: 'p99(…)',
- value: {
- kind: 'function',
- meta: {
- name: 'p99',
- parameters: [
- {
- columnTypes: ['duration'],
- defaultValue: 'session.duration',
- kind: 'column',
- required: true,
- },
- ],
- },
- },
- },
- 'function:sum': {
- label: 'sum(…)',
- value: {
- kind: 'function',
- meta: {
- name: 'sum',
- parameters: [
- {
- columnTypes: ['integer'],
- defaultValue: 'session',
- kind: 'column',
- required: true,
- },
- ],
- },
- },
- },
- 'field:environment': {
- label: 'environment',
- value: {
- kind: 'field',
- meta: {
- dataType: 'string',
- name: 'environment',
- },
- },
- },
- 'field:release': {
- label: 'release',
- value: {
- kind: 'field',
- meta: {
- dataType: 'string',
- name: 'release',
- },
- },
- },
- });
- });
- });
|