diff --git a/.dockerignore b/.dockerignore index 24e3fc1c6..79f96a3c2 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,7 +2,7 @@ .coverage .tests bindata_assetfs.go -unsee +karma ui/build ui/coverage ui/node_modules diff --git a/.gitignore b/.gitignore index aed6cef3a..7e12ba673 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,7 @@ .tests bindata_assetfs.go coverage.txt -unsee +karma ui/build ui/coverage ui/node_modules diff --git a/.travis.yml b/.travis.yml index 7cf380622..a22d8e2a2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4fca9ccff..71d969162 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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. diff --git a/Dockerfile b/Dockerfile index ac0a32317..8dad9fd9a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] diff --git a/Dockerfile.web b/Dockerfile.web index 5f1357a8c..302d0a5cf 100644 --- a/Dockerfile.web +++ b/Dockerfile.web @@ -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 diff --git a/Makefile b/Makefile index 7925d47ab..380ab6a84 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/README.md b/README.md index 0fbeb87b0..98d27e88f 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,18 @@ -# unsee +# karma -[](https://greenkeeper.io/) +[](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.  @@ -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. diff --git a/alerts.go b/alerts.go index 565d4e980..ac60c68cb 100644 --- a/alerts.go +++ b/alerts.go @@ -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) { diff --git a/api_test.go b/api_test.go index 6d1ce0e8c..3b883c19d 100644 --- a/api_test.go +++ b/api_test.go @@ -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 { diff --git a/autocomplete.go b/autocomplete.go index 84d53356c..b3244eab3 100644 --- a/autocomplete.go +++ b/autocomplete.go @@ -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" ) diff --git a/autocomplete_test.go b/autocomplete_test.go index 237fcab82..5a72723a0 100644 --- a/autocomplete_test.go +++ b/autocomplete_test.go @@ -6,7 +6,7 @@ import ( "net/http/httptest" "testing" - "github.com/prymitive/unsee/internal/mock" + "github.com/prymitive/karma/internal/mock" ) type requestTest struct { diff --git a/docs/CONFIGURATION.md b/docs/CONFIGURATION.md index b48ff3ab0..426d4eaf0 100644 --- a/docs/CONFIGURATION.md +++ b/docs/CONFIGURATION.md @@ -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 diff --git a/docs/example.yaml b/docs/example.yaml index 230fa9891..08c1eba1d 100644 --- a/docs/example.yaml +++ b/docs/example.yaml @@ -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 diff --git a/internal/alertmanager/benchmark_test.go b/internal/alertmanager/benchmark_test.go index 2c3a32b20..9b9567cd4 100644 --- a/internal/alertmanager/benchmark_test.go +++ b/internal/alertmanager/benchmark_test.go @@ -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) { diff --git a/internal/alertmanager/dedup.go b/internal/alertmanager/dedup.go index e13692566..280fa1e76 100644 --- a/internal/alertmanager/dedup.go +++ b/internal/alertmanager/dedup.go @@ -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 diff --git a/internal/alertmanager/dedup_test.go b/internal/alertmanager/dedup_test.go index 9487d7c41..2310fc0c9 100644 --- a/internal/alertmanager/dedup_test.go +++ b/internal/alertmanager/dedup_test.go @@ -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" ) diff --git a/internal/alertmanager/mapper.go b/internal/alertmanager/mapper.go index 10e5d98e5..98ae27daf 100644 --- a/internal/alertmanager/mapper.go +++ b/internal/alertmanager/mapper.go @@ -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 diff --git a/internal/alertmanager/metrics.go b/internal/alertmanager/metrics.go index 466d21f32..41d868711 100644 --- a/internal/alertmanager/metrics.go +++ b/internal/alertmanager/metrics.go @@ -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()) } diff --git a/internal/alertmanager/models.go b/internal/alertmanager/models.go index 6d4b9346c..d8bcfd0a9 100644 --- a/internal/alertmanager/models.go +++ b/internal/alertmanager/models.go @@ -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" ) diff --git a/internal/alertmanager/upstream.go b/internal/alertmanager/upstream.go index c09a9cba9..c7e202b1b 100644 --- a/internal/alertmanager/upstream.go +++ b/internal/alertmanager/upstream.go @@ -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 diff --git a/internal/config/config.go b/internal/config/config.go index 3ba60ebf5..a7c84d088 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -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") diff --git a/internal/config/config_test.go b/internal/config/config_test.go index 0e6bd1936..f851a16cb 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -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) } } diff --git a/internal/filters/autocomplete.go b/internal/filters/autocomplete.go index 1c9651433..2018d0a79 100644 --- a/internal/filters/autocomplete.go +++ b/internal/filters/autocomplete.go @@ -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 diff --git a/internal/filters/filter.go b/internal/filters/filter.go index ecc776627..fbb21189a 100644 --- a/internal/filters/filter.go +++ b/internal/filters/filter.go @@ -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 diff --git a/internal/filters/filter_age.go b/internal/filters/filter_age.go index fc5e90392..d8c59715b 100644 --- a/internal/filters/filter_age.go +++ b/internal/filters/filter_age.go @@ -5,7 +5,7 @@ import ( "strings" "time" - "github.com/prymitive/unsee/internal/models" + "github.com/prymitive/karma/internal/models" ) type ageFilter struct { diff --git a/internal/filters/filter_alertmanager.go b/internal/filters/filter_alertmanager.go index 7d278d6b1..3d9430bf0 100644 --- a/internal/filters/filter_alertmanager.go +++ b/internal/filters/filter_alertmanager.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - "github.com/prymitive/unsee/internal/models" + "github.com/prymitive/karma/internal/models" ) type alertmanagerInstanceFilter struct { diff --git a/internal/filters/filter_fuzzy.go b/internal/filters/filter_fuzzy.go index 4400811c9..a09a7ab3a 100644 --- a/internal/filters/filter_fuzzy.go +++ b/internal/filters/filter_fuzzy.go @@ -4,7 +4,7 @@ import ( "fmt" "regexp" - "github.com/prymitive/unsee/internal/models" + "github.com/prymitive/karma/internal/models" ) type fuzzyFilter struct { diff --git a/internal/filters/filter_label.go b/internal/filters/filter_label.go index d6e49ddab..c957c7aa6 100644 --- a/internal/filters/filter_label.go +++ b/internal/filters/filter_label.go @@ -5,7 +5,7 @@ import ( "strconv" "strings" - "github.com/prymitive/unsee/internal/models" + "github.com/prymitive/karma/internal/models" ) type labelFilter struct { diff --git a/internal/filters/filter_limit.go b/internal/filters/filter_limit.go index 56e0580ba..0e82642d9 100644 --- a/internal/filters/filter_limit.go +++ b/internal/filters/filter_limit.go @@ -5,7 +5,7 @@ import ( "strconv" "strings" - "github.com/prymitive/unsee/internal/models" + "github.com/prymitive/karma/internal/models" ) type limitFilter struct { diff --git a/internal/filters/filter_receiver.go b/internal/filters/filter_receiver.go index 823ad2bc4..b44fbaa05 100644 --- a/internal/filters/filter_receiver.go +++ b/internal/filters/filter_receiver.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - "github.com/prymitive/unsee/internal/models" + "github.com/prymitive/karma/internal/models" ) type receiverFilter struct { diff --git a/internal/filters/filter_silence_author.go b/internal/filters/filter_silence_author.go index b5ae0430f..d33a65d3f 100644 --- a/internal/filters/filter_silence_author.go +++ b/internal/filters/filter_silence_author.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - "github.com/prymitive/unsee/internal/models" + "github.com/prymitive/karma/internal/models" ) type silenceAuthorFilter struct { diff --git a/internal/filters/filter_silence_jira.go b/internal/filters/filter_silence_jira.go index 66e23574b..b71f71a54 100644 --- a/internal/filters/filter_silence_jira.go +++ b/internal/filters/filter_silence_jira.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - "github.com/prymitive/unsee/internal/models" + "github.com/prymitive/karma/internal/models" ) type silenceJiraFilter struct { diff --git a/internal/filters/filter_state.go b/internal/filters/filter_state.go index 45573ea4c..f233a5592 100644 --- a/internal/filters/filter_state.go +++ b/internal/filters/filter_state.go @@ -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 { diff --git a/internal/filters/filter_test.go b/internal/filters/filter_test.go index 83827ad2b..e256b4b65 100644 --- a/internal/filters/filter_test.go +++ b/internal/filters/filter_test.go @@ -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" ) diff --git a/internal/mapper/mapper.go b/internal/mapper/mapper.go index 29039996c..6d2153d50 100644 --- a/internal/mapper/mapper.go +++ b/internal/mapper/mapper.go @@ -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) diff --git a/internal/mapper/v04/alerts.go b/internal/mapper/v04/alerts.go index 338295745..85aa6e922 100644 --- a/internal/mapper/v04/alerts.go +++ b/internal/mapper/v04/alerts.go @@ -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{} diff --git a/internal/mapper/v04/silences.go b/internal/mapper/v04/silences.go index 86db83f51..a3cc6b68c 100644 --- a/internal/mapper/v04/silences.go +++ b/internal/mapper/v04/silences.go @@ -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{} diff --git a/internal/mapper/v05/alerts.go b/internal/mapper/v05/alerts.go index 600f47845..5d148855d 100644 --- a/internal/mapper/v05/alerts.go +++ b/internal/mapper/v05/alerts.go @@ -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{} diff --git a/internal/mapper/v05/silences.go b/internal/mapper/v05/silences.go index f684a4c64..35dfce99f 100644 --- a/internal/mapper/v05/silences.go +++ b/internal/mapper/v05/silences.go @@ -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{} diff --git a/internal/mapper/v061/alerts.go b/internal/mapper/v061/alerts.go index cc8be6c93..20c652065 100644 --- a/internal/mapper/v061/alerts.go +++ b/internal/mapper/v061/alerts.go @@ -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{} diff --git a/internal/mapper/v062/alerts.go b/internal/mapper/v062/alerts.go index ceae09a2a..2050a2e92 100644 --- a/internal/mapper/v062/alerts.go +++ b/internal/mapper/v062/alerts.go @@ -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{} diff --git a/internal/mock/Makefile b/internal/mock/Makefile index 5c8b51251..ca5600e72 100644 --- a/internal/mock/Makefile +++ b/internal/mock/Makefile @@ -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 \ diff --git a/internal/models/alert.go b/internal/models/alert.go index f4879f395..1c1ffd8b3 100644 --- a/internal/models/alert.go +++ b/internal/models/alert.go @@ -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 diff --git a/internal/models/alert_test.go b/internal/models/alert_test.go index 2d4b166b9..8c39f1e51 100644 --- a/internal/models/alert_test.go +++ b/internal/models/alert_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/prymitive/unsee/internal/models" + "github.com/prymitive/karma/internal/models" ) type alertStateTest struct { diff --git a/internal/models/alertgroup.go b/internal/models/alertgroup.go index 70439d641..d79a656f1 100644 --- a/internal/models/alertgroup.go +++ b/internal/models/alertgroup.go @@ -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 { diff --git a/internal/models/alertgroup_test.go b/internal/models/alertgroup_test.go index 9ee327acb..cfd7fcbde 100644 --- a/internal/models/alertgroup_test.go +++ b/internal/models/alertgroup_test.go @@ -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() diff --git a/internal/models/annotation.go b/internal/models/annotation.go index 1f7274d98..19bcab503 100644 --- a/internal/models/annotation.go +++ b/internal/models/annotation.go @@ -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 diff --git a/internal/models/annotation_test.go b/internal/models/annotation_test.go index 1ea3f7235..cd109ff41 100644 --- a/internal/models/annotation_test.go +++ b/internal/models/annotation_test.go @@ -4,7 +4,7 @@ import ( "reflect" "testing" - "github.com/prymitive/unsee/internal/models" + "github.com/prymitive/karma/internal/models" ) type annotationMapsTestCase struct { diff --git a/internal/models/api.go b/internal/models/api.go index 1df40ef4a..c2fc459ca 100644 --- a/internal/models/api.go +++ b/internal/models/api.go @@ -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"` diff --git a/internal/models/api_test.go b/internal/models/api_test.go index f4a0e6e11..0b1b54d05 100644 --- a/internal/models/api_test.go +++ b/internal/models/api_test.go @@ -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) { diff --git a/internal/models/silence.go b/internal/models/silence.go index 672ff401b..6422da38d 100644 --- a/internal/models/silence.go +++ b/internal/models/silence.go @@ -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"` } diff --git a/internal/slices/slices_test.go b/internal/slices/slices_test.go index e8b30a6b0..dee989619 100644 --- a/internal/slices/slices_test.go +++ b/internal/slices/slices_test.go @@ -3,7 +3,7 @@ package slices_test import ( "testing" - "github.com/prymitive/unsee/internal/slices" + "github.com/prymitive/karma/internal/slices" ) type stringSliceTest struct { diff --git a/internal/transform/autocomplete.go b/internal/transform/autocomplete.go index 2fdb34d74..472d24806 100644 --- a/internal/transform/autocomplete.go +++ b/internal/transform/autocomplete.go @@ -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 diff --git a/internal/transform/autocomplete_test.go b/internal/transform/autocomplete_test.go index db1ce3f7a..fa151a486 100644 --- a/internal/transform/autocomplete_test.go +++ b/internal/transform/autocomplete_test.go @@ -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" ) diff --git a/internal/transform/color_test.go b/internal/transform/color_test.go index 57b26a927..1116224bb 100644 --- a/internal/transform/color_test.go +++ b/internal/transform/color_test.go @@ -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 { diff --git a/internal/transform/colors.go b/internal/transform/colors.go index c88e997f7..b2793329d 100644 --- a/internal/transform/colors.go +++ b/internal/transform/colors.go @@ -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) { diff --git a/internal/transform/jira.go b/internal/transform/jira.go index f35f1706b..e08af0c9d 100644 --- a/internal/transform/jira.go +++ b/internal/transform/jira.go @@ -5,7 +5,7 @@ import ( "log" "regexp" - "github.com/prymitive/unsee/internal/models" + "github.com/prymitive/karma/internal/models" ) type jiraDetectRule struct { diff --git a/internal/transform/jira_test.go b/internal/transform/jira_test.go index 0fcc5984e..533ab011a 100644 --- a/internal/transform/jira_test.go +++ b/internal/transform/jira_test.go @@ -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 { diff --git a/internal/transform/strip.go b/internal/transform/strip.go index 5af395a7c..ac6aca737 100644 --- a/internal/transform/strip.go +++ b/internal/transform/strip.go @@ -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 diff --git a/internal/transform/strip_test.go b/internal/transform/strip_test.go index ae8db2a6e..a17c0260d 100644 --- a/internal/transform/strip_test.go +++ b/internal/transform/strip_test.go @@ -4,7 +4,7 @@ import ( "reflect" "testing" - "github.com/prymitive/unsee/internal/transform" + "github.com/prymitive/karma/internal/transform" ) type stripLabelTest struct { diff --git a/internal/uri/uri_test.go b/internal/uri/uri_test.go index 0c7c6cf64..e181db16b 100644 --- a/internal/uri/uri_test.go +++ b/internal/uri/uri_test.go @@ -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" ) diff --git a/internal/uri/urls_test.go b/internal/uri/urls_test.go index 5499bed45..08dd6f700 100644 --- a/internal/uri/urls_test.go +++ b/internal/uri/urls_test.go @@ -3,7 +3,7 @@ package uri_test import ( "testing" - "github.com/prymitive/unsee/internal/uri" + "github.com/prymitive/karma/internal/uri" ) type joinURLTest struct { diff --git a/main.go b/main.go index 8072f6e07..8be9099a8 100644 --- a/main.go +++ b/main.go @@ -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" diff --git a/main_test.go b/main_test.go index ca77ab577..eb12e1d77 100644 --- a/main_test.go +++ b/main_test.go @@ -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" ) diff --git a/proxy.go b/proxy.go index 618779966..c43ff662f 100644 --- a/proxy.go +++ b/proxy.go @@ -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" diff --git a/proxy_test.go b/proxy_test.go index f983c9323..b9465a083 100644 --- a/proxy_test.go +++ b/proxy_test.go @@ -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" ) diff --git a/timer.go b/timer.go index 52902e8f9..fdcd6f829 100644 --- a/timer.go +++ b/timer.go @@ -4,7 +4,7 @@ import ( "runtime" "sync" - "github.com/prymitive/unsee/internal/alertmanager" + "github.com/prymitive/karma/internal/alertmanager" log "github.com/sirupsen/logrus" ) diff --git a/ui/public/index.html b/ui/public/index.html index 50684982e..0003dc837 100644 --- a/ui/public/index.html +++ b/ui/public/index.html @@ -10,7 +10,7 @@ --> -