github.com/perses/shared/cue@v0.54.0-beta.8

common/migrate/mapping.cue raw

  1// Copyright The Perses Authors
  2// Licensed under the Apache License, Version 2.0 (the "License");
  3// you may not use this file except in compliance with the License.
  4// You may obtain a copy of the License at
  5//
  6// http://www.apache.org/licenses/LICENSE-2.0
  7//
  8// Unless required by applicable law or agreed to in writing, software
  9// distributed under the License is distributed on an "AS IS" BASIS,
 10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 11// See the License for the specific language governing permissions and
 12// limitations under the License.
 13
 14package migrate
 15
 16#mapping: {
 17	// mapping table for the unit attribute (key = grafana unit, value = perses equivalent)
 18	unit: {
 19		// time units
 20		ms:           "milliseconds"
 21		s:            "seconds"
 22		m:            "minutes"
 23		h:            "hours"
 24		d:            "days"
 25		dtdurations:  "seconds"
 26		dtdurationms: "milliseconds"
 27		dateTimeAsIso: "datetime-iso"
 28		// percent units
 29		percent:     "percent"
 30		percentunit: "percent-decimal"
 31		// decimal units
 32		none:  "decimal"
 33		short: "decimal"
 34		// TODO
 35		// bits units
 36		bits:    "bits"
 37		decbits: "decbits"
 38		// bytes units
 39		bytes:    "bytes"
 40		decbytes: "decbytes"
 41		// throughput units
 42		bps: "bits/sec"
 43		binbps: "decbits/sec"
 44		Bps: "bytes/sec"
 45		binBps: "decbytes/sec"
 46		cps: "counts/sec"
 47		mps: "messages/sec"
 48		recps: "records/sec"
 49		reqps: "requests/sec"
 50		rowsps: "rows/sec"
 51		rps: "reads/sec"
 52		ops: "ops/sec"
 53		pps: "packets/sec"
 54		wps: "writes/sec"
 55	}
 56	// mapping table for the calculation attribute (key = grafana unit, value = perses equivalent)
 57	calc: {
 58		// Values with a single potential mapping.
 59		first:        "first"
 60		firstNotNull: "first-number"
 61		lastNotNull:  "last-number"
 62		min:          "min"
 63		max:          "max"
 64
 65		// Both keys can be used for "Last" depending on the version of grafana
 66		// and how the calculation is being used (e.g. chart vs table legend
 67		// value).
 68		current: "last"
 69		last:    "last"
 70
 71		// Both keys can be used for "Mean" depending on the version of grafana
 72		// and how the calculation is being used (e.g. chart vs table legend
 73		// value).
 74		avg:  "mean"
 75		mean: "mean"
 76
 77		// Both keys can be used for "Mean" depending on the version of grafana
 78		// and how the calculation is being used (e.g. chart vs table legend
 79		// value).
 80		total: "sum"
 81		sum:   "sum"
 82	}
 83	color: {
 84		// mapping array for some color attributes (index = color name in Grafana, value = hexadecimal equivalent that Perses can deal with)
 85		"dark-red":        "#c4162a"
 86		"semi-dark-red":   "#e02f44"
 87		"red":             "#f2495c"
 88		"light-red":       "#ff7383"
 89		"super-light-red": "#ffa6b0"
 90
 91		"dark-orange":        "#fa6400"
 92		"semi-dark-orange":   "#ff780a"
 93		"orange":             "#ff9830"
 94		"light-orange":       "#ffb357"
 95		"super-light-orange": "#ffcb7d"
 96
 97		"dark-green":        "#37872d"
 98		"semi-dark-green":   "#56a64b"
 99		"green":             "#73bf69"
100		"light-green":       "#96d98d"
101		"super-light-green": "#c8f2c2"
102
103		"dark-blue":        "#1f60c4"
104		"semi-dark-blue":   "#3274d9"
105		"blue":             "#5794f2"
106		"light-blue":       "#8ab8ff"
107		"super-light-blue": "#c0d8ff"
108
109		"dark-purple":        "#8f3bb8"
110		"semi-dark-purple":   "#a352cc"
111		"purple":             "#b877d9"
112		"light-purple":       "#b877d9"
113		"super-light-purple": "#deb6f2"
114
115		"dark-yellow":        "#e0b400"
116		"semi-dark-yellow":   "#f2cc0c"
117		"yellow":             "#fade2a"
118		"light-yellow":       "#ffee52"
119		"super-light-yellow": "#fff899"
120
121		"transparent": "#00000000"
122	}
123}
124#defaultCalc: "last"