Skip to content

feat(opsgenie.go): Add Entity field #201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pkg/batch/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"time"
)


// Writer allows to buffer some items and call the Handler function either when the buffer is full or the timeout is
// reached. There will also be support for concurrency for high volume. The handler function is supposed to return an
// array of booleans to indicate whether the transfer was successful or not. It can be replaced with status codes in
Expand Down
6 changes: 3 additions & 3 deletions pkg/exporter/channel_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import (
// and we might need a mechanism to drop the vents
// On closing, the registry sends a signal on all exit channels, and then waits for all to complete.
type ChannelBasedReceiverRegistry struct {
ch map[string]chan kube.EnhancedEvent
exitCh map[string]chan interface{}
wg *sync.WaitGroup
ch map[string]chan kube.EnhancedEvent
exitCh map[string]chan interface{}
wg *sync.WaitGroup
MetricsStore *metrics.Store
}

Expand Down
1 change: 0 additions & 1 deletion pkg/exporter/event.go
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
package exporter

2 changes: 1 addition & 1 deletion pkg/sinks/email.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package sinks

// Just kidding, please don't implement this
// Just kidding, please don't implement this
2 changes: 0 additions & 2 deletions pkg/sinks/inmemory.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,3 @@ func (i *InMemory) Send(ctx context.Context, ev *kube.EnhancedEvent) error {
func (i *InMemory) Close() {
// No-op
}


2 changes: 1 addition & 1 deletion pkg/sinks/loki.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
"errors"
"fmt"
"github.com/resmoio/kubernetes-event-exporter/pkg/kube"
"github.com/rs/zerolog/log"
"io/ioutil"
"net/http"
"strconv"
"time"
"github.com/rs/zerolog/log"
)

type promtailStream struct {
Expand Down
9 changes: 8 additions & 1 deletion pkg/sinks/opsgenie.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package sinks

import (
"context"
"github.com/resmoio/kubernetes-event-exporter/pkg/kube"
"github.com/opsgenie/opsgenie-go-sdk-v2/alert"
"github.com/opsgenie/opsgenie-go-sdk-v2/client"
"github.com/resmoio/kubernetes-event-exporter/pkg/kube"
)

type OpsgenieConfig struct {
Expand All @@ -16,6 +16,13 @@ type OpsgenieConfig struct {
Description string `yaml:"description"`
Tags []string `yaml:"tags"`
Details map[string]string `yaml:"details"`
Entity string `yaml:"entity"`
Responders []Responder `yaml:"responders"`
}

type Responder struct {
Id string
Type string
}

type OpsgenieSink struct {
Expand Down
4 changes: 2 additions & 2 deletions pkg/sinks/pipe.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
)

type PipeConfig struct {
Path string `yaml:"path"`
Path string `yaml:"path"`
// DeDot all labels and annotations in the event. For both the event and the involvedObject
DeDot bool `yaml:"deDot"`
DeDot bool `yaml:"deDot"`
Layout map[string]interface{} `yaml:"layout"`
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/sinks/sms.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package sinks

// Just kidding, please don't implement this
// Just kidding, please don't implement this
2 changes: 1 addition & 1 deletion pkg/sinks/tmpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"encoding/json"
"text/template"

"github.com/resmoio/kubernetes-event-exporter/pkg/kube"
"github.com/Masterminds/sprig/v3"
"github.com/resmoio/kubernetes-event-exporter/pkg/kube"
)

func GetString(event *kube.EnhancedEvent, text string) (string, error) {
Expand Down
8 changes: 4 additions & 4 deletions pkg/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ var (

func Revision() string {
bi, ok := debug.ReadBuildInfo()
if ok {

if ok {
for _, kv := range bi.Settings {
switch kv.Key {
case "vcs.revision":
return kv.Value
case "vcs.revision":
return kv.Value
}
}
}
Expand Down