chore(project): rename from unsee to karma

Fixes prymitive/unsee#23
This commit is contained in:
Łukasz Mierzwa
2018-09-09 14:03:24 +01:00
parent 1505c6eb7f
commit 9c16ffa447
77 changed files with 303 additions and 299 deletions

View File

@@ -2,7 +2,7 @@
.coverage
.tests
bindata_assetfs.go
unsee
karma
ui/build
ui/coverage
ui/node_modules

2
.gitignore vendored
View File

@@ -3,7 +3,7 @@
.tests
bindata_assetfs.go
coverage.txt
unsee
karma
ui/build
ui/coverage
ui/node_modules

View File

@@ -103,9 +103,9 @@ jobs:
- tar -xf bakelite.tar.gz
# and now compile using bakelite for all target archs
- export SOURCE_DATE_EPOCH=$(git show -s --format=%ci ${TRAVIS_TAG:-${TRAVIS_COMMIT}}^{commit})
- ./bakelite-${BAKELITE_OS}-${BAKELITE_ARCH} -platforms="-plan9" -ldflags="-X main.version=\"$(make show-version)\"" github.com/prymitive/unsee
- for i in unsee-*; do tar --mtime="${SOURCE_DATE_EPOCH}" --owner=0 --group=0 --numeric-owner -c $i | gzip -n - > $i.tar.gz; done
- shasum -a 512 unsee-*.tar.gz | tee sha512sum.txt
- ./bakelite-${BAKELITE_OS}-${BAKELITE_ARCH} -platforms="-plan9" -ldflags="-X main.version=\"$(make show-version)\"" github.com/prymitive/karma
- for i in karma-*; do tar --mtime="${SOURCE_DATE_EPOCH}" --owner=0 --group=0 --numeric-owner -c $i | gzip -n - > $i.tar.gz; done
- shasum -a 512 karma-*.tar.gz | tee sha512sum.txt
deploy:
provider: releases
api_key:
@@ -113,8 +113,8 @@ jobs:
skip_cleanup: true
file_glob: true
file:
- unsee-*.tar.gz
- karma-*.tar.gz
- sha512sum.txt
on:
repo: prymitive/unsee
repo: prymitive/karma
tags: true

View File

@@ -1,4 +1,4 @@
# Contributing to unsee
# Contributing to karma
## Getting Started
@@ -53,7 +53,7 @@ generating production assets.
## Running
To build and start `unsee` from local branch see `Running` section of the
To build and start `karma` from local branch see `Running` section of the
[README](README.md) file.
When working with assets (templates, stylesheets and javascript files) `DEBUG`
@@ -70,7 +70,7 @@ the [gin web framework](https://github.com/gin-gonic/gin) which is used
internally, but enabling `DEBUG` via this make variable will also enable gin
debug mode.
When running docker image via `make run-docker` with `DEBUG` make variable set
to `true` volume mapping will be added (in read-only mode), so that unsee
to `true` volume mapping will be added (in read-only mode), so that karma
instance running inside the docker can read asset files from the sources
directory.
@@ -78,10 +78,10 @@ directory.
To support a new release that breaks API following changes needs to be done:
* Verify that `GetVersion()` function can still correctly read remote
- Verify that `GetVersion()` function can still correctly read remote
Alertmanager version via `/api/v1/status` endpoint, adapt it if needed.
* Create a new mapper package implementing unmarshaling of alerts and/or
- Create a new mapper package implementing unmarshaling of alerts and/or
silences (depending if both need a new code) under mapper/vXY (X major
Alertmanager version, Y minor version).
* Register new mapper in the `init()` function in the
- Register new mapper in the `init()` function in the
`internal/alertmanager/mapper.go` file.

View File

@@ -1,15 +1,15 @@
FROM node:8-alpine as nodejs-builder
RUN apk add --update make git
COPY . /unsee
RUN make -C /unsee ui
COPY . /karma
RUN make -C /karma ui
FROM golang:1.11.0-alpine as go-builder
COPY --from=nodejs-builder /unsee /go/src/github.com/prymitive/unsee
COPY --from=nodejs-builder /karma /go/src/github.com/prymitive/karma
ARG VERSION
RUN apk add --update make git
RUN CGO_ENABLED=0 make -C /go/src/github.com/prymitive/unsee VERSION="${VERSION:-dev}" unsee
RUN CGO_ENABLED=0 make -C /go/src/github.com/prymitive/karma VERSION="${VERSION:-dev}" karma
FROM gcr.io/distroless/base
COPY --from=go-builder /go/src/github.com/prymitive/unsee/unsee /unsee
COPY --from=go-builder /go/src/github.com/prymitive/karma/karma /karma
EXPOSE 8080
CMD ["/unsee"]
CMD ["/karma"]

View File

@@ -1,7 +1,7 @@
FROM alpine:latest
COPY --from=lmierzwa/unsee:latest /unsee /unsee
RUN adduser -D unsee
USER unsee
COPY --from=lmierzwa/karma:latest /karma /karma
RUN adduser -D karma
USER karma
ENV LOG_CONFIG=false
ENV ALERTMANAGER_INTERVAL=2400h
ENV ALERTMANAGER_URI=file:///mock
@@ -9,4 +9,4 @@ ENV LABELS_COLOR_UNIQUE="@receiver instance cluster"
ENV LABELS_COLOR_STATIC="job"
ENV FILTERS_DEFAULT="@receiver=by-cluster-service"
COPY internal/mock/0.15.2 /mock
CMD /unsee
CMD /karma

View File

@@ -1,4 +1,4 @@
NAME := unsee
NAME := karma
VERSION := $(shell git describe --tags --always --dirty='-dev')
# Alertmanager instance used when running locally, points to mock data
@@ -165,6 +165,6 @@ greenkeeper-lockfile:
.PHONY: heroku
heroku:
docker pull lmierzwa/unsee:latest
docker pull lmierzwa/karma:latest
heroku container:push web -R
heroku container:release web

View File

@@ -1,18 +1,18 @@
# unsee
# karma
[![Greenkeeper badge](https://badges.greenkeeper.io/prymitive/unsee.svg)](https://greenkeeper.io/)
[![Greenkeeper badge](https://badges.greenkeeper.io/prymitive/karma.svg)](https://greenkeeper.io/)
Alert dashboard for
[Prometheus Alertmanager](https://prometheus.io/docs/alerting/alertmanager/).
Alertmanager UI is useful for browsing alerts and managing silences, but it's
lacking as a dashboard tool - unsee aims to fill this gap.
lacking as a dashboard tool - karma aims to fill this gap.
Starting with `0.7.0` release it can also aggregate alerts from multiple
Alertmanager instances, running either in HA mode or separate. Duplicated alerts
are deduplicated so only unique alerts are displayed. Each alert is tagged with
names of all Alertmanager instances it was found at and can be filtered based
on those tags (`@alertmanager`). Note that `@alertmanager` tags will be visible
only if unsee is configured with multiple Alertmanager instances.
only if karma is configured with multiple Alertmanager instances.
![Screenshot](/screenshot.png)
@@ -31,43 +31,47 @@ Example:
Each group can be collapsed to only show the title bar using top right toggle
icon.
[Online demo](https://unsee-demo.herokuapp.com/)
[Online demo](https://karma-demo.herokuapp.com/)
To get notifications about new unsee releases you can subscribe to the RSS feed
that [GitHub provides](https://github.com/prymitive/unsee/releases.atom)
To get notifications about new karma releases you can subscribe to the RSS feed
that [GitHub provides](https://github.com/prymitive/karma/releases.atom)
To get email notifications please use one of the free services providing
_RSS to email_ notifications, like [Blogtrottr](https://blogtrottr.com/).
## History
I created unsee while working for [Cloudflare](https://cloudflare.com/).
After leaving the company I maintain a private fork, this version is
incompatible with the [original codebase](https://github.com/cloudflare/unsee)
since the UI was rewritten using [React](https://reactjs.org/).
I created karma while working for [Cloudflare](https://cloudflare.com/),
originally it was called [karma](https://github.com/cloudflare/karma).
This project is based on that code but the UI part was rewritten from scratch
using [React](https://reactjs.org/). New UI required changes to the backend so
the API is also incompatible.
Given that the React rewrite resulted in roughly 50% of new code and to avoid
confusion for user I've decided to rename it to karma, especially that the
original project wasn't being maintained anymore.
## Supported Alertmanager versions
Alertmanager's API isn't stable yet and can change between releases, see
`VERSIONS` in [internal/mock/Makefile](/internal/mock/Makefile) for list of all
Alertmanager releases that are tested and supported by unsee.
Alertmanager releases that are tested and supported by karma.
Due to API differences between those releases some features will work
differently or be missing, it's recommended to use the latest supported
Alertmanager version.
## Security
The unsee process doesn't send any API request to the Alertmanager that could
The karma process doesn't send any API request to the Alertmanager that could
modify alerts or silence state, but it does provide a web interface that allows
a user to send such requests directly to the Alertmanager API.
If you wish to deploy unsee as a read-only tool please ensure that:
If you wish to deploy karma as a read-only tool please ensure that:
- the unsee process is able to connect to the Alertmanager API
- read-only users are able to connect to the unsee web interface
- the karma process is able to connect to the Alertmanager API
- read-only users are able to connect to the karma web interface
- read-only users are NOT able to connect to the Alertmanager API
## Metrics
unsee process metrics are accessible under `/metrics` path by default.
karma process metrics are accessible under `/metrics` path by default.
If you set the `--listen.prefix` option a path relative to it will be
used.
@@ -77,10 +81,10 @@ used.
To clone git repo and build the binary yourself run:
git clone https://github.com/prymitive/unsee $GOPATH/src/github.com/prymitive/unsee
cd $GOPATH/src/github.com/prymitive/unsee
git clone https://github.com/prymitive/karma $GOPATH/src/github.com/prymitive/karma
cd $GOPATH/src/github.com/prymitive/karma
To finally compile `unsee` the binary run:
To finally compile `karma` the binary run:
make
@@ -90,17 +94,17 @@ container.
## Running
`unsee` can be configured using config file, command line flags or environment
`karma` can be configured using config file, command line flags or environment
variables. Config file is the recommended method, it's also the only way to
configure unsee to use multiple Alertmanager servers for collecting alerts.
To run unsee with a single Alertmanager server set `ALERTMANAGER_URI`
configure karma to use multiple Alertmanager servers for collecting alerts.
To run karma with a single Alertmanager server set `ALERTMANAGER_URI`
environment variable or pass `--alertmanger.uri` flag on the command line, with
Alertmanager URI as argument, example:
ALERTMANAGER_URI=https://alertmanager.example.com unsee
unsee --alertmanager.uri https://alertmanager.example.com
ALERTMANAGER_URI=https://alertmanager.example.com karma
karma --alertmanager.uri https://alertmanager.example.com
There is a make target which will compile and run unsee:
There is a make target which will compile and run karma:
make run
@@ -115,25 +119,25 @@ variables. Example:
### Running pre-build docker image
Official docker images are built and hosted on
[hub.docker.com](https://hub.docker.com/r/lmierzwa/unsee/).
[hub.docker.com](https://hub.docker.com/r/lmierzwa/karma/).
Images are built automatically for:
- release tags in git - `lmierzwa/unsee:vX.Y.Z`
- master branch commits - `lmierzwa/unsee:latest`
- release tags in git - `lmierzwa/karma:vX.Y.Z`
- master branch commits - `lmierzwa/karma:latest`
#### Examples
To start a release image run:
docker run -e ALERTMANAGER_URI=https://alertmanager.example.com prymitive/unsee:vX.Y.Z
docker run -e ALERTMANAGER_URI=https://alertmanager.example.com prymitive/karma:vX.Y.Z
Latest release details can be found on
[GitHub](https://github.com/prymitive/unsee/releases).
[GitHub](https://github.com/prymitive/karma/releases).
To start docker image build from lastet master branch run:
docker run -e ALERTMANAGER_URI=https://alertmanager.example.com prymitive/unsee:latest
docker run -e ALERTMANAGER_URI=https://alertmanager.example.com prymitive/karma:latest
Note that latest master branch might have bugs or breaking changes. Using
release images is strongly recommended for any production use.

View File

@@ -1,9 +1,9 @@
package main
import (
"github.com/prymitive/unsee/internal/alertmanager"
"github.com/prymitive/unsee/internal/filters"
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/karma/internal/alertmanager"
"github.com/prymitive/karma/internal/filters"
"github.com/prymitive/karma/internal/models"
)
func getFiltersFromQuery(filterStrings []string) ([]filters.FilterT, bool) {

View File

@@ -8,8 +8,8 @@ import (
"testing"
"github.com/blang/semver"
"github.com/prymitive/unsee/internal/mock"
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/karma/internal/mock"
"github.com/prymitive/karma/internal/models"
)
type groupTest struct {

View File

@@ -8,7 +8,7 @@ import (
"time"
"github.com/gin-gonic/gin"
"github.com/prymitive/unsee/internal/alertmanager"
"github.com/prymitive/karma/internal/alertmanager"
log "github.com/sirupsen/logrus"
)

View File

@@ -6,7 +6,7 @@ import (
"net/http/httptest"
"testing"
"github.com/prymitive/unsee/internal/mock"
"github.com/prymitive/karma/internal/mock"
)
type requestTest struct {

View File

@@ -2,28 +2,28 @@
## Config file
By default unsee will try to read configuration file named `unsee.yaml` from
By default karma will try to read configuration file named `karma.yaml` from
current directory. Configuration file uses [YAML](http://yaml.org/) format and
it needs to have `.yaml` extension.
Custom filename and directory can be passed via command line flags or
environment variables:
* `--config.file` flag or `CONFIG_FILE` env variable - name of the config file
- `--config.file` flag or `CONFIG_FILE` env variable - name of the config file
to load (without extension).
* `--config.dir` flag or `CONFIG_DIR` env variable - directory where config file
- `--config.dir` flag or `CONFIG_DIR` env variable - directory where config file
can be found.
Example with flags:
unsee --config.file example --config.dir ./docs/
karma --config.file example --config.dir ./docs/
Example with environment variables:
CONFIG_FILE="example" CONFIG_DIR="./docs/" unsee
CONFIG_FILE="example" CONFIG_DIR="./docs/" karma
Example using both:
CONFIG_FILE="example" unsee --config.dir ./docs/
CONFIG_FILE="example" karma --config.dir ./docs/
### Alertmanagers
@@ -31,7 +31,7 @@ Example using both:
queried for alerts.
You can configure one or more Alertmanager servers, alerts
with identical label set will be deduplicated and labeled with each Alertmanager
server they were observed at. This allows using unsee to collect alerts from a
server they were observed at. This allows using karma to collect alerts from a
pair of Alertmanager instances running in
[HA mode](https://prometheus.io/docs/alerting/alertmanager/#high-availability).
Syntax:
@@ -50,45 +50,45 @@ alertmanager:
key: string
```
* `interval` - how often alerts should be refreshed, a string in
- `interval` - how often alerts should be refreshed, a string in
[time.Duration](https://golang.org/pkg/time/#ParseDuration) format. If set to
`1m` unsee will query every Alertmanager server once a minute. This is global
`1m` karma will query every Alertmanager server once a minute. This is global
setting applied to every Alertmanager server. All instances will be queried
in parallel.
Note that the maximum value for this option is `15m`.
The UI has a watchdog that tracks the timestamp of the last pull. If the UI
does not receive updates for more than 15 minutes it will print an error and
reload the page.
* `name` - name of this Alertmanager server, will be used as a label added to
- `name` - name of this Alertmanager server, will be used as a label added to
every alert in the UI and for filtering alerts using `@alertmanager=NAME`
filter
* `uri` - base URI of this Alertmanager server. Supported URI schemes are
- `uri` - base URI of this Alertmanager server. Supported URI schemes are
`http://`, `https://` and `file://`. `file://` scheme is only useful for
testing with JSON files, see [mock](/internal/mock/) dir for examples, files
in this directory are used for running tests and when running demo instance
of unsee with `make run`.
of karma with `make run`.
If URI contains basic auth info
(`https://user:password@alertmanager.example.com`) and you don't want it to
be visible to users then ensure `proxy: true` is also set.
Without proxy mode full URI needs to be passed to unsee web UI code.
With proxy mode all requests will be routed via unsee HTTP server and since
unsee has full URI in the config it only needs Alertmanager name in that
Without proxy mode full URI needs to be passed to karma web UI code.
With proxy mode all requests will be routed via karma HTTP server and since
karma has full URI in the config it only needs Alertmanager name in that
request.
`proxy: true` in order to avoid leaking auth information to the browser.
* `timeout` - timeout for requests send to this Alertmanager server, a string in
- `timeout` - timeout for requests send to this Alertmanager server, a string in
[time.Duration](https://golang.org/pkg/time/#ParseDuration) format.
* `proxy` - if enabled requests from user browsers to this Alertmanager will be
proxied via unsee. This applies to requests made when managing silences via
unsee (creating or expiring silences).
* `tls:ca` - path to CA certificate used to establish TLS connection to this
- `proxy` - if enabled requests from user browsers to this Alertmanager will be
proxied via karma. This applies to requests made when managing silences via
karma (creating or expiring silences).
- `tls:ca` - path to CA certificate used to establish TLS connection to this
Alertmanager instance (for URIs using `https://` scheme). If unset or empty
string is set then Go will try to find system CA certificates using well known
paths.
* `tls:cert` - path to a TLS client certificate file to use when establishing
- `tls:cert` - path to a TLS client certificate file to use when establishing
TLS connections to this Alertmanager instance if it requires a TLS client
authentication.
Note that this option requires `tls:key` to be also set.
* `tls:key` - path to a TLS client key file to use when establishing
- `tls:key` - path to a TLS client key file to use when establishing
TLS connections to this Alertmanager instance if it requires a TLS client
authentication.
Note that this option requires `tls:cert` to be also set.
@@ -149,9 +149,9 @@ annotations:
visible: list of strings
```
* `default:hidden` - bool, true if all annotations should be hidden by default.
* `hidden` - list of annotations that should be hidden by default.
* `visible` - list of annotations that should be visible by default when
- `default:hidden` - bool, true if all annotations should be hidden by default.
- `hidden` - list of annotations that should be hidden by default.
- `visible` - list of annotations that should be visible by default when
`default:hidden` is set to `true`.
Example where all annotations except `summary` are hidden by default. If there
@@ -201,8 +201,8 @@ filters:
default: list of strings
```
* `default` - list of filters to use by default when user navigates to unsee
web UI. Visit `/help` page in unsee for details on available filters.
- `default` - list of filters to use by default when user navigates to karma
web UI. Visit `/help` page in karma for details on available filters.
Note that if a string starts with `@` YAML requires to wrap it in quotes.
Example:
@@ -243,15 +243,15 @@ labels:
strip: list of strings
```
* `color:static` - list of label names that will all have the same color applied
- `color:static` - list of label names that will all have the same color applied
(different than the default label color). This allows to quickly spot a
specific label that can have high range of values, but it's important when
reading the dashboard. For example coloring the instance label allows to
quickly learn which instance is affected by given alert.
* `color:unique` - list of label names that should have unique colors generated
- `color:unique` - list of label names that should have unique colors generated
in the UI.
* `keep` - list of allowed labels, if empty all labels are allowed.
* `strip` - list of ignored labels.
- `keep` - list of allowed labels, if empty all labels are allowed.
- `strip` - list of ignored labels.
Example with static color for the `job` label (every `job` label will have the
same color regardless of the value) and unique color for the `@receiver` label
@@ -266,7 +266,7 @@ colors:
- "@receiver"
```
Example where `task_id` label is ignored by unsee:
Example where `task_id` label is ignored by karma:
```yaml
labels:
@@ -298,7 +298,7 @@ labels:
### Listen
`listen` section allows configuring unsee web server behavior.
`listen` section allows configuring karma web server behavior.
Syntax:
```yaml
@@ -308,19 +308,19 @@ listen:
prefix: string
```
* `address` -
* `port` - HTTP port to listen on.
* `prefix` - URL root for unsee, you can use to if you wish to serve it from
location other than `/`. This option is mostly useful when using unsee behind
- `address` -
- `port` - HTTP port to listen on.
- `prefix` - URL root for karma, you can use to if you wish to serve it from
location other than `/`. This option is mostly useful when using karma behind
reverse proxy with other services on the same IP but different URL root.
Example where unsee would listen for HTTP requests on `http://1.2.3.4:80/unsee/`
Example where karma would listen for HTTP requests on `http://1.2.3.4:80/karma/`
```yaml
listen:
address: 1.2.3.4
port: 80
prefix: /unsee/
prefix: /karma/
```
Defaults:
@@ -343,8 +343,8 @@ log:
level: string
```
* `config` - if set to `true` unsee will log used configuration on startup
* `level` - log level to set for unsee, possible values are debug, info,
- `config` - if set to `true` karma will log used configuration on startup
- `level` - log level to set for karma, possible values are debug, info,
warning, error, fatal and panic.
Defaults:
@@ -368,8 +368,8 @@ jira:
- uri: string
```
* `regex` - regular expression for matching Jira issue ID.
* `uri` - base URL for Jira instance, `/browse/FOO-1` will be appended to it
- `regex` - regular expression for matching Jira issue ID.
- `uri` - base URL for Jira instance, `/browse/FOO-1` will be appended to it
(where `FOO-1` is example issue ID).
Example where a string `DEVOPS-123` inside a comment would be rendered as a link
@@ -390,7 +390,7 @@ jira: []
### Receivers
`receivers` section allows configuring how alerts from different receivers are
handled by unsee. If alerts are routed to multiple receivers they can be
handled by karma. If alerts are routed to multiple receivers they can be
duplicated in the UI, each instance will have different value for `@receiver`.
Syntax:
@@ -400,12 +400,12 @@ receivers:
strip: list of strings
```
* `keep` - list of receivers name that are allowed, if empty all receivers are
- `keep` - list of receivers name that are allowed, if empty all receivers are
allowed.
* `strip` - list of receiver names that will not be shown in the UI.
- `strip` - list of receiver names that will not be shown in the UI.
Example where alerts that are routed to the `alertmanage2es` receiver are
ignored by unsee.
ignored by karma.
```yaml
receivers:
@@ -433,9 +433,9 @@ sentry:
public: string
```
* `private` - Sentry DSN for Go exceptions, this value is only used by unsee
- `private` - Sentry DSN for Go exceptions, this value is only used by karma
binary and never exposed to the user.
* `public` - Sentry DSN for JavaScript exceptions, this value will be exposed
- `public` - Sentry DSN for JavaScript exceptions, this value will be exposed
to the user browser.
Example:
@@ -450,10 +450,10 @@ sentry:
Config file options are mapped to command line flags, so `alertmanager:interval`
config file key is accessible as `--alertmanager.interval` flag, run
`unsee --help` to see a full list.
`karma --help` to see a full list.
Exceptions for passing flags:
* `jira` - this option is a list of maps and it's only available when using
- `jira` - this option is a list of maps and it's only available when using
config file.
There's no support for configuring multiple Alertmanager servers using
@@ -466,11 +466,11 @@ Environment variables are mapped in a similar way as command line flags,
`alertmanager:interval` is accessible as `ALERTMANAGER_INTERVAL` env.
Exceptions for passing flags:
* `HOST` - used by gin webserver, same effect as setting `listen:address` config
- `HOST` - used by gin webserver, same effect as setting `listen:address` config
option
* `PORT` - used by gin webserver, same effect as setting `listen:port` config
- `PORT` - used by gin webserver, same effect as setting `listen:port` config
option
* `SENTRY_DSN` - is used by Sentry itself, same effect as passing value to
- `SENTRY_DSN` - is used by Sentry itself, same effect as passing value to
`sentry:private` config option.
There's no support for configuring multiple alertmanager servers using
@@ -480,7 +480,7 @@ section.
## Simplified Configuration
To configure multiple Alertmanager instances unsee requires a config file, but
To configure multiple Alertmanager instances karma requires a config file, but
for a single Alertmanager instance cases it's possible to configure all
Alertmanager server options that are set for `alertmanager.servers` config
section using only flags or environment variables.
@@ -491,8 +491,8 @@ To set the `uri` key from `alertmanager.servers` map `ALERTMANAGER_URI` env or
`--alertmanager.uri` flag can be used.
Examples:
ALERTMANAGER_URI=https://alertmanager.example.com unsee
unsee --alertmanager.uri https://alertmanager.example.com
ALERTMANAGER_URI=https://alertmanager.example.com karma
karma --alertmanager.uri https://alertmanager.example.com
### Alertmanager name
@@ -500,8 +500,8 @@ To set the `name` key from `alertmanager.servers` map `ALERTMANAGER_NAME` env or
`--alertmanager.name` flag can be used.
Examples:
ALERTMANAGER_NAME=single unsee
unsee --alertmanager.name single
ALERTMANAGER_NAME=single karma
karma --alertmanager.name single
### Alertmanager timeout
@@ -509,8 +509,8 @@ To set the `timeout` key from `alertmanager.servers` map `ALERTMANAGER_TIMEOUT`
env or `--alertmanager.timeout` flag can be used.
Examples:
ALERTMANAGER_TIMEOUT=10s unsee
unsee --alertmanager.timeout 10s
ALERTMANAGER_TIMEOUT=10s karma
karma --alertmanager.timeout 10s
### Alertmanager request proxy
@@ -518,5 +518,5 @@ To set the `proxy` key from `alertmanager.servers` map `ALERTMANAGER_PROXY`
env or `--alertmanager.proxy` flag can be used.
Examples:
ALERTMANAGER_PROXY=true unsee
unsee --alertmanager.proxy
ALERTMANAGER_PROXY=true karma
karma --alertmanager.proxy

View File

@@ -10,8 +10,8 @@ alertmanager:
timeout: 10s
tls:
ca: /etc/ssl/certs/ca-bundle.crt
cert: /etc/unsee/client.pem
key: /etc/unsee/client.key
cert: /etc/karma/client.pem
key: /etc/karma/client.key
annotations:
default:
hidden: false

View File

@@ -4,8 +4,8 @@ import (
"os"
"testing"
"github.com/prymitive/unsee/internal/alertmanager"
"github.com/prymitive/unsee/internal/config"
"github.com/prymitive/karma/internal/alertmanager"
"github.com/prymitive/karma/internal/config"
)
func BenchmarkDedupAlerts(b *testing.B) {

View File

@@ -3,10 +3,10 @@ package alertmanager
import (
"sort"
"github.com/prymitive/unsee/internal/config"
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/unsee/internal/slices"
"github.com/prymitive/unsee/internal/transform"
"github.com/prymitive/karma/internal/config"
"github.com/prymitive/karma/internal/models"
"github.com/prymitive/karma/internal/slices"
"github.com/prymitive/karma/internal/transform"
)
// DedupAlerts will collect alert groups from all defined Alertmanager

View File

@@ -6,9 +6,9 @@ import (
"testing"
"time"
"github.com/prymitive/unsee/internal/alertmanager"
"github.com/prymitive/unsee/internal/config"
"github.com/prymitive/unsee/internal/mock"
"github.com/prymitive/karma/internal/alertmanager"
"github.com/prymitive/karma/internal/config"
"github.com/prymitive/karma/internal/mock"
log "github.com/sirupsen/logrus"
)

View File

@@ -1,11 +1,11 @@
package alertmanager
import (
"github.com/prymitive/unsee/internal/mapper"
"github.com/prymitive/unsee/internal/mapper/v04"
"github.com/prymitive/unsee/internal/mapper/v05"
"github.com/prymitive/unsee/internal/mapper/v061"
"github.com/prymitive/unsee/internal/mapper/v062"
"github.com/prymitive/karma/internal/mapper"
"github.com/prymitive/karma/internal/mapper/v04"
"github.com/prymitive/karma/internal/mapper/v05"
"github.com/prymitive/karma/internal/mapper/v061"
"github.com/prymitive/karma/internal/mapper/v062"
)
// initialize all mappers

View File

@@ -2,35 +2,35 @@ package alertmanager
import "github.com/prometheus/client_golang/prometheus"
type unseeCollector struct {
type karmaCollector struct {
collectedAlerts *prometheus.Desc
collectedGroups *prometheus.Desc
cyclesTotal *prometheus.Desc
errorsTotal *prometheus.Desc
}
func newUnseeCollector() *unseeCollector {
return &unseeCollector{
func newkarmaCollector() *karmaCollector {
return &karmaCollector{
collectedAlerts: prometheus.NewDesc(
"unsee_collected_alerts_count",
"karma_collected_alerts_count",
"Total number of alerts collected from Alertmanager API",
[]string{"alertmanager", "state", "receiver"},
prometheus.Labels{},
),
collectedGroups: prometheus.NewDesc(
"unsee_collected_groups_count",
"karma_collected_groups_count",
"Total number of alert groups collected from Alertmanager API",
[]string{"alertmanager", "receiver"},
prometheus.Labels{},
),
cyclesTotal: prometheus.NewDesc(
"unsee_collect_cycles_total",
"karma_collect_cycles_total",
"Total number of alert collection cycles run",
[]string{"alertmanager"},
prometheus.Labels{},
),
errorsTotal: prometheus.NewDesc(
"unsee_alertmanager_errors_total",
"karma_alertmanager_errors_total",
"Total number of errors encounter when requesting data from Alertmanager API",
[]string{"alertmanager", "endpoint"},
prometheus.Labels{},
@@ -38,14 +38,14 @@ func newUnseeCollector() *unseeCollector {
}
}
func (c *unseeCollector) Describe(ch chan<- *prometheus.Desc) {
func (c *karmaCollector) Describe(ch chan<- *prometheus.Desc) {
ch <- c.collectedAlerts
ch <- c.collectedGroups
ch <- c.cyclesTotal
ch <- c.errorsTotal
}
func (c *unseeCollector) Collect(ch chan<- prometheus.Metric) {
func (c *karmaCollector) Collect(ch chan<- prometheus.Metric) {
upstreams := GetAlertmanagers()
for _, am := range upstreams {
@@ -117,5 +117,5 @@ func (c *unseeCollector) Collect(ch chan<- prometheus.Metric) {
}
func init() {
prometheus.MustRegister(newUnseeCollector())
prometheus.MustRegister(newkarmaCollector())
}

View File

@@ -10,11 +10,11 @@ import (
"sync"
"time"
"github.com/prymitive/unsee/internal/config"
"github.com/prymitive/unsee/internal/mapper"
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/unsee/internal/transform"
"github.com/prymitive/unsee/internal/uri"
"github.com/prymitive/karma/internal/config"
"github.com/prymitive/karma/internal/mapper"
"github.com/prymitive/karma/internal/models"
"github.com/prymitive/karma/internal/transform"
"github.com/prymitive/karma/internal/uri"
log "github.com/sirupsen/logrus"
)

View File

@@ -6,8 +6,8 @@ import (
"sync"
"time"
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/unsee/internal/uri"
"github.com/prymitive/karma/internal/models"
"github.com/prymitive/karma/internal/uri"
log "github.com/sirupsen/logrus"
)
@@ -92,7 +92,7 @@ func GetAlertmanagerByName(name string) *Alertmanager {
}
// WithProxy option can be passed to NewAlertmanager in order to enable request
// proxying for unsee clients
// proxying for karma clients
func WithProxy(proxied bool) Option {
return func(am *Alertmanager) error {
am.ProxyRequests = proxied

View File

@@ -8,7 +8,7 @@ import (
"strings"
"time"
"github.com/prymitive/unsee/internal/uri"
"github.com/prymitive/karma/internal/uri"
"github.com/spf13/pflag"
"github.com/spf13/viper"
@@ -31,7 +31,7 @@ func init() {
pflag.Duration("alertmanager.timeout", time.Second*40,
"Timeout for requests sent to the Alertmanager server (only used with simplified config)")
pflag.Bool("alertmanager.proxy", false,
"Proxy all client requests to Alertmanager via unsee (only used with simplified config)")
"Proxy all client requests to Alertmanager via karma (only used with simplified config)")
pflag.Bool(
"annotations.default.hidden", false,
@@ -43,7 +43,7 @@ func init() {
pflag.String("config.dir", ".",
"Directory with configuration file to read")
pflag.String("config.file", "unsee",
pflag.String("config.file", "karma",
"Name of the configuration file to read")
pflag.Bool("debug", false, "Enable debug mode")

View File

@@ -5,7 +5,7 @@ import (
"testing"
"time"
"github.com/prymitive/unsee/internal/uri"
"github.com/prymitive/karma/internal/uri"
"github.com/pmezard/go-difflib/difflib"
@@ -13,10 +13,10 @@ import (
yaml "gopkg.in/yaml.v2"
)
// unset all unsee supported env variables before tests so we start with no
// unset all karma supported env variables before tests so we start with no
// config from previous test run
func resetEnv() {
unseeEnvVariables := []string{
karmaEnvVariables := []string{
"ALERTMANAGER_INTERVAL",
"ALERTMANAGER_URI",
"ALERTMANAGER_NAME",
@@ -46,7 +46,7 @@ func resetEnv() {
"PORT",
"SENTRY_DSN",
}
for _, env := range unseeEnvVariables {
for _, env := range karmaEnvVariables {
os.Unsetenv(env)
}
}

View File

@@ -1,7 +1,7 @@
package filters
import (
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/karma/internal/models"
)
type autocompleteFactory func(name string, operators []string, alerts []models.Alert) []models.Autocomplete

View File

@@ -4,8 +4,8 @@ import (
"fmt"
"regexp"
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/unsee/internal/slices"
"github.com/prymitive/karma/internal/models"
"github.com/prymitive/karma/internal/slices"
)
// FilterT provides methods for interacting with alert filters

View File

@@ -5,7 +5,7 @@ import (
"strings"
"time"
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/karma/internal/models"
)
type ageFilter struct {

View File

@@ -4,7 +4,7 @@ import (
"fmt"
"strings"
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/karma/internal/models"
)
type alertmanagerInstanceFilter struct {

View File

@@ -4,7 +4,7 @@ import (
"fmt"
"regexp"
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/karma/internal/models"
)
type fuzzyFilter struct {

View File

@@ -5,7 +5,7 @@ import (
"strconv"
"strings"
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/karma/internal/models"
)
type labelFilter struct {

View File

@@ -5,7 +5,7 @@ import (
"strconv"
"strings"
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/karma/internal/models"
)
type limitFilter struct {

View File

@@ -4,7 +4,7 @@ import (
"fmt"
"strings"
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/karma/internal/models"
)
type receiverFilter struct {

View File

@@ -4,7 +4,7 @@ import (
"fmt"
"strings"
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/karma/internal/models"
)
type silenceAuthorFilter struct {

View File

@@ -4,7 +4,7 @@ import (
"fmt"
"strings"
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/karma/internal/models"
)
type silenceJiraFilter struct {

View File

@@ -4,8 +4,8 @@ import (
"fmt"
"strings"
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/unsee/internal/slices"
"github.com/prymitive/karma/internal/models"
"github.com/prymitive/karma/internal/slices"
)
type stateFilter struct {

View File

@@ -5,9 +5,9 @@ import (
"testing"
"time"
"github.com/prymitive/unsee/internal/alertmanager"
"github.com/prymitive/unsee/internal/filters"
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/karma/internal/alertmanager"
"github.com/prymitive/karma/internal/filters"
"github.com/prymitive/karma/internal/models"
log "github.com/sirupsen/logrus"
)

View File

@@ -4,7 +4,7 @@ import (
"fmt"
"io"
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/karma/internal/models"
)
var (
@@ -12,20 +12,20 @@ var (
silenceMappers = []SilenceMapper{}
)
// Mapper converts Alertmanager response body and maps to unsee data structures
// Mapper converts Alertmanager response body and maps to karma data structures
type Mapper interface {
IsSupported(version string) bool
AbsoluteURL(baseURI string) (string, error)
QueryArgs() string
}
// AlertMapper handles mapping of Alertmanager alert information to unsee AlertGroup models
// AlertMapper handles mapping of Alertmanager alert information to karma AlertGroup models
type AlertMapper interface {
Mapper
Decode(io.ReadCloser) ([]models.AlertGroup, error)
}
// SilenceMapper handles mapping of Alertmanager silence information to unsee Silence models
// SilenceMapper handles mapping of Alertmanager silence information to karma Silence models
type SilenceMapper interface {
Mapper
Decode(io.ReadCloser) ([]models.Silence, error)

View File

@@ -1,6 +1,6 @@
// Package v04 package implements support for interacting with Alertmanager 0.4
// Collected data will be mapped to unsee internal schema defined the
// unsee/models package
// Collected data will be mapped to karma internal schema defined the
// karma/models package
// This file defines Alertmanager alerts mapping
package v04
@@ -13,9 +13,9 @@ import (
"time"
"github.com/blang/semver"
"github.com/prymitive/unsee/internal/mapper"
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/unsee/internal/uri"
"github.com/prymitive/karma/internal/mapper"
"github.com/prymitive/karma/internal/models"
"github.com/prymitive/karma/internal/uri"
)
type alert struct {
@@ -70,7 +70,7 @@ func (m AlertMapper) IsSupported(version string) bool {
return versionRange(semver.MustParse(version))
}
// Decode Alertmanager API response body and return unsee model instances
// Decode Alertmanager API response body and return karma model instances
func (m AlertMapper) Decode(source io.ReadCloser) ([]models.AlertGroup, error) {
groups := []models.AlertGroup{}
receivers := map[string]alertsGroupReceiver{}

View File

@@ -1,6 +1,6 @@
// Package v04 package implements support for interacting with Alertmanager 0.4
// Collected data will be mapped to unsee internal schema defined the
// unsee/models package
// Collected data will be mapped to karma internal schema defined the
// karma/models package
// This file defines Alertmanager silences mapping
package v04
@@ -14,9 +14,9 @@ import (
"time"
"github.com/blang/semver"
"github.com/prymitive/unsee/internal/mapper"
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/unsee/internal/uri"
"github.com/prymitive/karma/internal/mapper"
"github.com/prymitive/karma/internal/models"
"github.com/prymitive/karma/internal/uri"
)
// Alertmanager 0.4 silence format
@@ -67,7 +67,7 @@ func (m SilenceMapper) IsSupported(version string) bool {
return versionRange(semver.MustParse(version))
}
// Decode Alertmanager API response body and return unsee model instances
// Decode Alertmanager API response body and return karma model instances
func (m SilenceMapper) Decode(source io.ReadCloser) ([]models.Silence, error) {
silences := []models.Silence{}
resp := silenceAPISchema{}

View File

@@ -1,6 +1,6 @@
// Package v05 package implements support for interacting with Alertmanager 0.5
// Collected data will be mapped to unsee internal schema defined the
// unsee/models package
// Collected data will be mapped to karma internal schema defined the
// karma/models package
// This file defines Alertmanager alerts mapping
package v05
@@ -12,9 +12,9 @@ import (
"time"
"github.com/blang/semver"
"github.com/prymitive/unsee/internal/mapper"
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/unsee/internal/uri"
"github.com/prymitive/karma/internal/mapper"
"github.com/prymitive/karma/internal/models"
"github.com/prymitive/karma/internal/uri"
)
type alert struct {
@@ -69,7 +69,7 @@ func (m AlertMapper) IsSupported(version string) bool {
return versionRange(semver.MustParse(version))
}
// Decode Alertmanager API response body and return unsee model instances
// Decode Alertmanager API response body and return karma model instances
func (m AlertMapper) Decode(source io.ReadCloser) ([]models.AlertGroup, error) {
groups := []models.AlertGroup{}
receivers := map[string]alertsGroupReceiver{}

View File

@@ -1,6 +1,6 @@
// Package v05 package implements support for interacting with Alertmanager 0.5
// Collected data will be mapped to unsee internal schema defined the
// unsee/models package
// Collected data will be mapped to karma internal schema defined the
// karma/models package
// This file defines Alertmanager alerts mapping
package v05
@@ -11,9 +11,9 @@ import (
"time"
"github.com/blang/semver"
"github.com/prymitive/unsee/internal/mapper"
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/unsee/internal/uri"
"github.com/prymitive/karma/internal/mapper"
"github.com/prymitive/karma/internal/models"
"github.com/prymitive/karma/internal/uri"
)
type silence struct {
@@ -57,7 +57,7 @@ func (m SilenceMapper) IsSupported(version string) bool {
return versionRange(semver.MustParse(version))
}
// Decode Alertmanager API response body and return unsee model instances
// Decode Alertmanager API response body and return karma model instances
func (m SilenceMapper) Decode(source io.ReadCloser) ([]models.Silence, error) {
silences := []models.Silence{}
resp := silenceAPISchema{}

View File

@@ -1,7 +1,7 @@
// Package v061 package implements support for interacting with
// Alertmanager 0.6.1
// Collected data will be mapped to unsee internal schema defined the
// unsee/models package
// Collected data will be mapped to karma internal schema defined the
// karma/models package
// This file defines Alertmanager alerts mapping
package v061
@@ -13,9 +13,9 @@ import (
"time"
"github.com/blang/semver"
"github.com/prymitive/unsee/internal/mapper"
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/unsee/internal/uri"
"github.com/prymitive/karma/internal/mapper"
"github.com/prymitive/karma/internal/models"
"github.com/prymitive/karma/internal/uri"
)
type alert struct {
@@ -71,7 +71,7 @@ func (m AlertMapper) IsSupported(version string) bool {
return versionRange(semver.MustParse(version))
}
// Decode Alertmanager API response body and return unsee model instances
// Decode Alertmanager API response body and return karma model instances
func (m AlertMapper) Decode(source io.ReadCloser) ([]models.AlertGroup, error) {
groups := []models.AlertGroup{}
receivers := map[string]alertsGroupReceiver{}

View File

@@ -1,7 +1,7 @@
// Package v062 package implements support for interacting with
// Alertmanager 0.6.2
// Collected data will be mapped to unsee internal schema defined the
// unsee/models package
// Collected data will be mapped to karma internal schema defined the
// karma/models package
// This file defines Alertmanager alerts mapping
package v062
@@ -13,9 +13,9 @@ import (
"time"
"github.com/blang/semver"
"github.com/prymitive/unsee/internal/mapper"
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/unsee/internal/uri"
"github.com/prymitive/karma/internal/mapper"
"github.com/prymitive/karma/internal/models"
"github.com/prymitive/karma/internal/uri"
)
type alertStatus struct {
@@ -75,7 +75,7 @@ func (m AlertMapper) IsSupported(version string) bool {
return versionRange(semver.MustParse(version))
}
// Decode Alertmanager API response body and return unsee model instances
// Decode Alertmanager API response body and return karma model instances
func (m AlertMapper) Decode(source io.ReadCloser) ([]models.AlertGroup, error) {
groups := []models.AlertGroup{}
receivers := map[string]alertsGroupReceiver{}

View File

@@ -1,4 +1,4 @@
DOCKER_NAME := alertmanager-unsee-mock
DOCKER_NAME := alertmanager-karma-mock
DOCKER_IMAGE := prom/alertmanager
DOCKER_ARGS := --name $(DOCKER_NAME) --rm -d -p 9093:9093 \
-v $(CURDIR)/alertmanager.yml:/etc/alertmanager/config.yml \

View File

@@ -25,10 +25,10 @@ var AlertStateList = []string{
}
// Alert is vanilla alert + some additional attributes
// unsee extends an alert object with:
// karma extends an alert object with:
// * Links map, it's generated from annotations if annotation value is an url
// it's pulled out of annotation map and returned under links field,
// unsee UI used this to show links differently than other annotations
// karma UI used this to show links differently than other annotations
type Alert struct {
Annotations Annotations `json:"annotations"`
Labels map[string]string `json:"labels"`
@@ -41,7 +41,7 @@ type Alert struct {
GeneratorURL string `json:"-" hash:"-"`
SilencedBy []string `json:"-" hash:"-"`
InhibitedBy []string `json:"-" hash:"-"`
// unsee fields
// karma fields
Alertmanager []AlertmanagerInstance `json:"alertmanager"`
Receiver string `json:"receiver"`
// fingerprints are precomputed for speed

View File

@@ -4,7 +4,7 @@ import (
"testing"
"time"
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/karma/internal/models"
)
type alertStateTest struct {

View File

@@ -10,7 +10,7 @@ import (
log "github.com/sirupsen/logrus"
)
// AlertList is flat list of UnseeAlert objects
// AlertList is flat list of karmaAlert objects
type AlertList []Alert
func (a AlertList) Len() int {

View File

@@ -5,7 +5,7 @@ import (
"testing"
"time"
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/karma/internal/models"
)
type alertListSortTest struct {
@@ -44,7 +44,7 @@ var alertListSortTests = []alertListSortTest{
},
}
func TestUnseeAlertListSort(t *testing.T) {
func TestAlertListSort(t *testing.T) {
al := models.AlertList{}
for _, testCase := range alertListSortTests {
testCase.alert.UpdateFingerprints()

View File

@@ -4,8 +4,8 @@ import (
"net/url"
"sort"
"github.com/prymitive/unsee/internal/config"
"github.com/prymitive/unsee/internal/slices"
"github.com/prymitive/karma/internal/config"
"github.com/prymitive/karma/internal/slices"
)
// Annotation extends Alertmanager scheme of key:value with additional data

View File

@@ -4,7 +4,7 @@ import (
"reflect"
"testing"
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/karma/internal/models"
)
type annotationMapsTestCase struct {

View File

@@ -3,7 +3,7 @@ package models
import (
"fmt"
"github.com/prymitive/unsee/internal/slices"
"github.com/prymitive/karma/internal/slices"
)
// Filter holds returned data on any filter passed by the user as part of the query
@@ -16,7 +16,7 @@ type Filter struct {
IsValid bool `json:"isValid"`
}
// Color is used by UnseeLabelColor to reprenset colors as RGBA
// Color is used by karmaLabelColor to reprenset colors as RGBA
type Color struct {
Red uint8 `json:"red"`
Green uint8 `json:"green"`
@@ -31,7 +31,7 @@ type LabelColors struct {
Background Color `json:"background"`
}
// LabelsColorMap is a map of "Label Key" -> "Label Value" -> UnseeLabelColors
// LabelsColorMap is a map of "Label Key" -> "Label Value" -> karmaLabelColors
type LabelsColorMap map[string]map[string]LabelColors
// LabelsCountMap is a map of "Label Key" -> "Label Value" -> number of occurence
@@ -158,7 +158,7 @@ func (ag *APIAlertGroup) DedupSharedMaps() {
}
}
// Settings is used to export unsee configuration that is used by UI
// Settings is used to export karma configuration that is used by UI
type Settings struct {
StaticColorLabels []string `json:"staticColorLabels"`
AnnotationsDefaultHidden bool `json:"annotationsDefaultHidden"`

View File

@@ -4,7 +4,7 @@ import (
"encoding/json"
"testing"
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/karma/internal/models"
)
func TestDedupSharedMaps(t *testing.T) {

View File

@@ -3,9 +3,9 @@ package models
import "time"
// Silence is vanilla silence + some additional attributes
// Unsee adds JIRA support, it can extract JIRA IDs from comments
// karma adds JIRA support, it can extract JIRA IDs from comments
// extracted ID is used to generate link to JIRA issue
// this means Unsee needs to store additional fields for each silence
// this means karma needs to store additional fields for each silence
type Silence struct {
ID string `json:"id"`
Matchers []struct {
@@ -18,7 +18,7 @@ type Silence struct {
CreatedAt time.Time `json:"createdAt"`
CreatedBy string `json:"createdBy"`
Comment string `json:"comment"`
// unsee fields
// karma fields
JiraID string `json:"jiraID"`
JiraURL string `json:"jiraURL"`
}

View File

@@ -3,7 +3,7 @@ package slices_test
import (
"testing"
"github.com/prymitive/unsee/internal/slices"
"github.com/prymitive/karma/internal/slices"
)
type stringSliceTest struct {

View File

@@ -1,8 +1,8 @@
package transform
import (
"github.com/prymitive/unsee/internal/filters"
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/karma/internal/filters"
"github.com/prymitive/karma/internal/models"
)
// BuildAutocomplete takes an alert object and generates list of autocomplete

View File

@@ -5,8 +5,8 @@ import (
"sort"
"testing"
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/unsee/internal/transform"
"github.com/prymitive/karma/internal/models"
"github.com/prymitive/karma/internal/transform"
"github.com/pmezard/go-difflib/difflib"
)

View File

@@ -3,9 +3,9 @@ package transform_test
import (
"testing"
"github.com/prymitive/unsee/internal/config"
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/unsee/internal/transform"
"github.com/prymitive/karma/internal/config"
"github.com/prymitive/karma/internal/models"
"github.com/prymitive/karma/internal/transform"
)
type colorTest struct {

View File

@@ -5,9 +5,9 @@ import (
"io"
"math/rand"
"github.com/prymitive/unsee/internal/config"
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/unsee/internal/slices"
"github.com/prymitive/karma/internal/config"
"github.com/prymitive/karma/internal/models"
"github.com/prymitive/karma/internal/slices"
"github.com/hansrodtang/randomcolor"
@@ -34,7 +34,7 @@ func labelToSeed(key string, val string) int64 {
return seed
}
// ColorLabel update UnseeColorMap object with a color object generated
// ColorLabel update karmaColorMap object with a color object generated
// from label key and value passed here
// It's used to generate unique colors for configured labels
func ColorLabel(colorStore models.LabelsColorMap, key string, val string) {

View File

@@ -5,7 +5,7 @@ import (
"log"
"regexp"
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/karma/internal/models"
)
type jiraDetectRule struct {

View File

@@ -3,8 +3,8 @@ package transform_test
import (
"testing"
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/unsee/internal/transform"
"github.com/prymitive/karma/internal/models"
"github.com/prymitive/karma/internal/transform"
)
type jiraTest struct {

View File

@@ -3,7 +3,7 @@ package transform
import (
"strings"
"github.com/prymitive/unsee/internal/slices"
"github.com/prymitive/karma/internal/slices"
)
// StripLables allows filtering out some labels from alerts

View File

@@ -4,7 +4,7 @@ import (
"reflect"
"testing"
"github.com/prymitive/unsee/internal/transform"
"github.com/prymitive/karma/internal/transform"
)
type stripLabelTest struct {

View File

@@ -11,8 +11,8 @@ import (
"testing"
"time"
"github.com/prymitive/unsee/internal/mock"
"github.com/prymitive/unsee/internal/uri"
"github.com/prymitive/karma/internal/mock"
"github.com/prymitive/karma/internal/uri"
log "github.com/sirupsen/logrus"
)

View File

@@ -3,7 +3,7 @@ package uri_test
import (
"testing"
"github.com/prymitive/unsee/internal/uri"
"github.com/prymitive/karma/internal/uri"
)
type joinURLTest struct {

View File

@@ -8,10 +8,10 @@ import (
"strings"
"time"
"github.com/prymitive/unsee/internal/alertmanager"
"github.com/prymitive/unsee/internal/config"
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/unsee/internal/transform"
"github.com/prymitive/karma/internal/alertmanager"
"github.com/prymitive/karma/internal/config"
"github.com/prymitive/karma/internal/models"
"github.com/prymitive/karma/internal/transform"
"github.com/DeanThompson/ginpprof"
"github.com/gin-contrib/cors"

View File

@@ -3,7 +3,7 @@ package main
import (
"testing"
"github.com/prymitive/unsee/internal/config"
"github.com/prymitive/karma/internal/config"
log "github.com/sirupsen/logrus"
)

View File

@@ -6,8 +6,8 @@ import (
"net/http/httputil"
"net/url"
"github.com/prymitive/unsee/internal/alertmanager"
"github.com/prymitive/unsee/internal/config"
"github.com/prymitive/karma/internal/alertmanager"
"github.com/prymitive/karma/internal/config"
"github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus"

View File

@@ -6,7 +6,7 @@ import (
"testing"
"time"
"github.com/prymitive/unsee/internal/alertmanager"
"github.com/prymitive/karma/internal/alertmanager"
httpmock "gopkg.in/jarcoal/httpmock.v1"
)

View File

@@ -4,7 +4,7 @@ import (
"runtime"
"sync"
"github.com/prymitive/unsee/internal/alertmanager"
"github.com/prymitive/karma/internal/alertmanager"
log "github.com/sirupsen/logrus"
)

View File

@@ -10,7 +10,7 @@
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<title>unsee</title>
<title>karma</title>
</head>
<body>
<noscript>

View File

@@ -1,5 +1,5 @@
{
"short_name": "unsee",
"short_name": "karma",
"name": "Alert dashboard for Prometheus Alertmanager",
"icons": [
{

View File

@@ -31,7 +31,7 @@ class App extends Component {
// parse and decode request query args
const p = DecodeLocationSearch(window.location.search);
// p.defaultsUsed means that unsee URI didn't have ?q=foo query args
// p.defaultsUsed means that karma URI didn't have ?q=foo query args
if (p.defaultsUsed) {
// no ?q=foo set, use defaults saved by the user or from backend config
if (this.settingsStore.savedFilters.config.present) {

View File

@@ -12,7 +12,7 @@ import Highlight from "react-highlighter";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faSearch } from "@fortawesome/free-solid-svg-icons/faSearch";
import { AlertStore, FormatUnseeBackendURI } from "Stores/AlertStore";
import { AlertStore, FormatBackendURI } from "Stores/AlertStore";
import { Settings } from "Stores/Settings";
import { FilterInputLabel } from "Components/Labels/FilterInputLabel";
import { AutosuggestTheme } from "./Constants";
@@ -72,7 +72,7 @@ const FilterInput = observer(
action(({ value }) => {
if (value !== "") {
this.inputStore.suggestionsFetch = fetch(
FormatUnseeBackendURI(`autocomplete.json?term=${value}`)
FormatBackendURI(`autocomplete.json?term=${value}`)
)
.then(
result => result.json(),

View File

@@ -6,7 +6,7 @@ import { observer } from "mobx-react";
import { MultiSelect } from "Components/MultiSelect";
import { ValidationError } from "Components/MultiSelect/ValidationError";
import { FormatUnseeBackendURI } from "Stores/AlertStore";
import { FormatBackendURI } from "Stores/AlertStore";
const LabelNameInput = observer(
class LabelNameInput extends MultiSelect {
@@ -19,7 +19,7 @@ const LabelNameInput = observer(
const { matcher } = this.props;
this.nameSuggestionsFetch = fetch(
FormatUnseeBackendURI(`labelNames.json`)
FormatBackendURI(`labelNames.json`)
)
.then(
result => result.json(),
@@ -43,7 +43,7 @@ const LabelNameInput = observer(
const { matcher } = this.props;
this.valueSuggestionsFetch = fetch(
FormatUnseeBackendURI(`labelValues.json?name=${matcher.name}`)
FormatBackendURI(`labelValues.json?name=${matcher.name}`)
)
.then(
result => result.json(),

View File

@@ -20,7 +20,7 @@ function FormatAPIFilterQuery(filters) {
}
// format URI for react UI -> Go backend requests
function FormatUnseeBackendURI(path) {
function FormatBackendURI(path) {
const uri = process.env.REACT_APP_BACKEND_URI || ".";
return `${uri}/${path}`;
}
@@ -196,7 +196,7 @@ class AlertStore {
this.status.setInProgress();
const alertsURI =
FormatUnseeBackendURI("alerts.json?") +
FormatBackendURI("alerts.json?") +
FormatAPIFilterQuery(this.filters.values.map(f => f.raw));
return fetch(alertsURI)
@@ -305,7 +305,7 @@ class AlertStore {
export {
AlertStore,
AlertStoreStatuses,
FormatUnseeBackendURI,
FormatBackendURI,
FormatAPIFilterQuery,
DecodeLocationSearch,
UpdateLocationSearch,

View File

@@ -3,7 +3,7 @@ import { EmptyAPIResponse } from "__mocks__/Fetch";
import {
AlertStore,
AlertStoreStatuses,
FormatUnseeBackendURI,
FormatBackendURI,
DecodeLocationSearch,
UpdateLocationSearch,
NewUnappliedFilter
@@ -125,15 +125,15 @@ describe("AlertStore.filters", () => {
});
});
describe("FormatUnseeBackendURI", () => {
it("FormatUnseeBackendURI without REACT_APP_BACKEND_URI env returns ./ prefixed URIs", () => {
const uri = FormatUnseeBackendURI("foo/bar");
describe("FormatBackendURI", () => {
it("FormatBackendURI without REACT_APP_BACKEND_URI env returns ./ prefixed URIs", () => {
const uri = FormatBackendURI("foo/bar");
expect(uri).toEqual("./foo/bar");
});
it("FormatUnseeBackendURI with REACT_APP_BACKEND_URI env returns env value prefixed URIs", () => {
it("FormatBackendURI with REACT_APP_BACKEND_URI env returns env value prefixed URIs", () => {
process.env.REACT_APP_BACKEND_URI = "http://localhost:1234";
const uri = FormatUnseeBackendURI("foo/bar");
const uri = FormatBackendURI("foo/bar");
expect(uri).toEqual("http://localhost:1234/foo/bar");
});
});

View File

@@ -8,12 +8,12 @@ import (
"strings"
"time"
"github.com/prymitive/unsee/internal/alertmanager"
"github.com/prymitive/unsee/internal/config"
"github.com/prymitive/unsee/internal/filters"
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/unsee/internal/slices"
"github.com/prymitive/unsee/internal/transform"
"github.com/prymitive/karma/internal/alertmanager"
"github.com/prymitive/karma/internal/config"
"github.com/prymitive/karma/internal/filters"
"github.com/prymitive/karma/internal/models"
"github.com/prymitive/karma/internal/slices"
"github.com/prymitive/karma/internal/transform"
"github.com/gin-gonic/gin"

View File

@@ -10,10 +10,10 @@ import (
"testing"
"time"
"github.com/prymitive/unsee/internal/config"
"github.com/prymitive/unsee/internal/mock"
"github.com/prymitive/unsee/internal/models"
"github.com/prymitive/unsee/internal/slices"
"github.com/prymitive/karma/internal/config"
"github.com/prymitive/karma/internal/mock"
"github.com/prymitive/karma/internal/models"
"github.com/prymitive/karma/internal/slices"
cache "github.com/patrickmn/go-cache"
log "github.com/sirupsen/logrus"