Skip to content

Commit

Permalink
[chore] [exporter/alertmanager] Fix default generator_url and update …
Browse files Browse the repository at this point in the history
…readme
  • Loading branch information
mcube8 committed Oct 24, 2023
1 parent 326c841 commit c750d54
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
4 changes: 2 additions & 2 deletions exporter/alertmanagerexporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
[contrib]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib
<!-- end autogenerated section -->

Exports Span Events as alerts to [Alertmanager](https://prometheus.io/docs/alerting/latest/alertmanager/) back-end.
Exports OTEL Events (SpanEvent in Tracing added by AddEvent API) as Alerts to [Alertmanager] (https://prometheus.io/docs/alerting/latest/alertmanager/) back-end to notify Errors or Change events.

Supported pipeline types: traces

Expand Down Expand Up @@ -56,5 +56,5 @@ exporters:
initial_interval: 10s
max_interval: 60s
max_elapsed_time: 10m
generator_url: "otelcol:55681"
generator_url: "http://example.com/otelcol"
```
2 changes: 1 addition & 1 deletion exporter/alertmanagerexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestLoadConfig(t *testing.T) {
{
id: component.NewIDWithName(metadata.Type, "2"),
expected: &Config{
GeneratorURL: "otelcol:55681",
GeneratorURL: "http://example.com/otelcol",
DefaultSeverity: "info",
SeverityAttribute: "foo",
TimeoutSettings: exporterhelper.TimeoutSettings{
Expand Down
8 changes: 5 additions & 3 deletions exporter/alertmanagerexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import (
"go.opentelemetry.io/collector/config/configopaque"
"go.opentelemetry.io/collector/exporter"
"go.opentelemetry.io/collector/exporter/exporterhelper"

"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/alertmanagerexporter/internal/metadata"
)

const (
Expand All @@ -24,14 +26,14 @@ const (
// NewFactory creates a factory for Alertmanager exporter
func NewFactory() exporter.Factory {
return exporter.NewFactory(
typeStr,
metadata.Type,
createDefaultConfig,
exporter.WithTraces(createTracesExporter, stability))
exporter.WithTraces(createTracesExporter, metadata.TracesStability))
}

func createDefaultConfig() component.Config {
return &Config{
GeneratorURL: "otelcol:55681",
GeneratorURL: "http://example.com/otelcol",
DefaultSeverity: "info",
TimeoutSettings: exporterhelper.NewDefaultTimeoutSettings(),
RetrySettings: exporterhelper.NewDefaultRetrySettings(),
Expand Down
6 changes: 6 additions & 0 deletions exporter/alertmanagerexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,14 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect
)

replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal => ../../internal/coreinternal

retract (
v0.76.2
v0.76.1
v0.65.0
)

replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil => ../../pkg/pdatautil

replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest => ../../pkg/pdatatest
2 changes: 1 addition & 1 deletion exporter/alertmanagerexporter/testdata/config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
alertmanager:
alertmanager/2:
endpoint: "a.new.alertmanager.target:9093"
generator_url: "otelcol:55681"
generator_url: "http://example.com/otelcol"
severity: "info"
severity_attribute: "foo"
tls:
Expand Down

0 comments on commit c750d54

Please sign in to comment.