Skip to content
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

feat: add honeycomb marker exporter structure #27001

Merged
merged 76 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
7a00beb
feat: add honeycomb marker exporter structure
fchikwekwe Sep 19, 2023
3304fe5
Merge branch 'main' into feat/marker-exporter
fchikwekwe Sep 19, 2023
c2d6549
fix: remove start and stop
fchikwekwe Sep 21, 2023
34c66e7
Merge branch 'feat/marker-exporter' of https://github.com/fchikwekwe/…
fchikwekwe Sep 21, 2023
3a21318
feat: add honeycomb marker exporter
fchikwekwe Sep 25, 2023
8a1393f
feat: add generated files for component
fchikwekwe Sep 25, 2023
3decc4c
Merge branch 'main' into feat/marker-exporter
fchikwekwe Sep 25, 2023
a82ba30
doc: add changelog
fchikwekwe Sep 25, 2023
c892bca
Merge branch 'feat/marker-exporter' of https://github.com/fchikwekwe/…
fchikwekwe Sep 25, 2023
cb9efe8
Merge branch 'main' into feat/marker-exporter
fchikwekwe Sep 25, 2023
09a4438
fix: remove presets and allow configurable markers and rules
fchikwekwe Sep 29, 2023
d7e8882
Merge branch 'feat/marker-exporter' of https://github.com/fchikwekwe/…
fchikwekwe Oct 2, 2023
cdf882a
fix: fix config examples and README to use configurable markers
fchikwekwe Oct 2, 2023
537b227
fix: parse logs through transform processor parser funcs
fchikwekwe Oct 3, 2023
52f85c8
Update exporter/honeycombmarkerexporter/factory.go
fchikwekwe Oct 3, 2023
792bdce
Update exporter/honeycombmarkerexporter/factory.go
fchikwekwe Oct 3, 2023
1fb07b0
Update exporter/honeycombmarkerexporter/metadata.yaml
fchikwekwe Oct 3, 2023
311a420
fix: use configopaque
fchikwekwe Oct 3, 2023
660d6a1
Merge branch 'feat/marker-exporter' of https://github.com/fchikwekwe/…
fchikwekwe Oct 3, 2023
a49faf1
fix: add support for checking log and resource conditions
fchikwekwe Oct 5, 2023
41a0858
Merge branch 'main' into feat/marker-exporter
fchikwekwe Oct 5, 2023
c553616
chore: update changelog
fchikwekwe Oct 5, 2023
4dfbff3
Merge branch 'feat/marker-exporter' of https://github.com/fchikwekwe/…
fchikwekwe Oct 5, 2023
f92d3df
refactor: rename exporter dir
fchikwekwe Oct 5, 2023
abdad4a
Merge branch 'main' into feat/marker-exporter
fchikwekwe Oct 5, 2023
44cbc2c
fix: revert changes to filter processor
fchikwekwe Oct 5, 2023
91c90ba
Merge branch 'feat/marker-exporter' of https://github.com/fchikwekwe/…
fchikwekwe Oct 5, 2023
414367b
fix: revert changes to filter processor
fchikwekwe Oct 5, 2023
372171c
fix: remove comments
fchikwekwe Oct 5, 2023
a8c920a
Update exporter/honeycombexporter/README.md
fchikwekwe Oct 5, 2023
03ba0bf
Update exporter/honeycombexporter/metadata.yaml
fchikwekwe Oct 6, 2023
ec08d37
Update .chloggen/feat_marker-exporter.yaml
fchikwekwe Oct 6, 2023
f21943a
test: update config test
fchikwekwe Oct 6, 2023
73453ed
Merge branch 'feat/marker-exporter' of https://github.com/fchikwekwe/…
fchikwekwe Oct 6, 2023
5c55fd6
test: add more config test cases
fchikwekwe Oct 6, 2023
71a9d77
Merge branch 'main' into feat/marker-exporter
fchikwekwe Oct 6, 2023
fc8970b
Merge branch 'main' into feat/marker-exporter
fchikwekwe Oct 6, 2023
bab5a8b
Update exporter/honeycombexporter/factory.go
fchikwekwe Oct 6, 2023
3981adc
test: fix no api url case
fchikwekwe Oct 10, 2023
f762563
Merge branch 'feat/marker-exporter' of https://github.com/fchikwekwe/…
fchikwekwe Oct 10, 2023
782ce2c
Merge branch 'main' into feat/marker-exporter
fchikwekwe Oct 10, 2023
fe60983
fix: update license in config test
fchikwekwe Oct 10, 2023
63800b5
Merge branch 'feat/marker-exporter' of https://github.com/fchikwekwe/…
fchikwekwe Oct 10, 2023
1cf336f
fix: rename exporter pkg
fchikwekwe Oct 10, 2023
c0014cc
fix: comply with linter
fchikwekwe Oct 10, 2023
7e8da90
fix: update url fields in config test
fchikwekwe Oct 10, 2023
78b1b0a
Merge branch 'main' into feat/marker-exporter
fchikwekwe Oct 10, 2023
b2306c2
Merge branch 'main' into feat/marker-exporter
fchikwekwe Oct 10, 2023
9573c13
chore: add go mod file
fchikwekwe Oct 10, 2023
c75e2e8
chore: update deps
fchikwekwe Oct 10, 2023
e511eb6
Merge branch 'main' into feat/marker-exporter
fchikwekwe Oct 10, 2023
c29a3a8
chore: update deps and comply with linter
fchikwekwe Oct 10, 2023
c16d9cd
Merge branch 'feat/marker-exporter' of https://github.com/fchikwekwe/…
fchikwekwe Oct 10, 2023
5c856ce
Update exporter/honeycombmarkerexporter/go.mod
TylerHelmuth Oct 10, 2023
09a68e5
chore: fix go mod
fchikwekwe Oct 10, 2023
50efce0
Merge branch 'feat/marker-exporter' of https://github.com/fchikwekwe/…
fchikwekwe Oct 10, 2023
35f2be8
chore: update deps
fchikwekwe Oct 10, 2023
19a1cf6
chore: update crosslink
fchikwekwe Oct 10, 2023
e8b2fce
chore: regenerate files
fchikwekwe Oct 10, 2023
86f43cb
Merge branch 'main' into feat/marker-exporter
fchikwekwe Oct 10, 2023
7d6d0c5
Merge branch 'main' into feat/marker-exporter
fchikwekwe Oct 11, 2023
278c548
Merge branch 'main' into feat/marker-exporter
fchikwekwe Oct 11, 2023
9183300
Merge branch 'main' into feat/marker-exporter
fchikwekwe Oct 11, 2023
f52e8c7
Merge branch 'main' into feat/marker-exporter
fchikwekwe Oct 11, 2023
026926e
chore: update go mod
fchikwekwe Oct 11, 2023
4b21e62
chore: run go mod tidy and update configopaue version
fchikwekwe Oct 11, 2023
89e659c
chore: regen dependabot yml
fchikwekwe Oct 11, 2023
e38fce0
chore: regen issue template files
fchikwekwe Oct 11, 2023
927660f
Merge branch 'main' into feat/marker-exporter
fchikwekwe Oct 11, 2023
d14c5df
chore: regen bug report
fchikwekwe Oct 11, 2023
237d03f
Merge branch 'feat/marker-exporter' of https://github.com/fchikwekwe/…
fchikwekwe Oct 11, 2023
cdf7a83
Merge branch 'main' into feat/marker-exporter
fchikwekwe Oct 11, 2023
d81ab3b
fix: change markertype and markercolor to type and color
fchikwekwe Oct 11, 2023
d1048eb
Merge branch 'feat/marker-exporter' of https://github.com/fchikwekwe/…
fchikwekwe Oct 11, 2023
dcc220e
Merge branch 'main' into feat/marker-exporter
fchikwekwe Oct 11, 2023
61d9f7d
Merge branch 'main' into feat/marker-exporter
fchikwekwe Oct 12, 2023
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: 1 addition & 0 deletions exporter/honeycombmarkerexporter/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ../../Makefile.Common
35 changes: 35 additions & 0 deletions exporter/honeycombmarkerexporter/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

package honeycombexporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/honeycombexporter"

import (
"fmt"

"go.opentelemetry.io/collector/component"
)

// Config defines configuration for the Honeycomb Marker exporter.
type Config struct {
APIKey string `mapstructure:"api_key"`
TylerHelmuth marked this conversation as resolved.
Show resolved Hide resolved
APIURL string `mapstructure:"api_url"`
Presets presets `mapstructure:"presets"`
}

type presets struct {
K8sEvents bool `mapstructure:"k8s_events"`
}

func (cfg *Config) Validate() error {
TylerHelmuth marked this conversation as resolved.
Show resolved Hide resolved
if cfg.APIKey == "" {
return fmt.Errorf("invalid API Key")
}

if cfg.APIURL == "" {
return fmt.Errorf("invalid URL")
fchikwekwe marked this conversation as resolved.
Show resolved Hide resolved
}

return nil
}

var _ component.Config = (*Config)(nil)
55 changes: 55 additions & 0 deletions exporter/honeycombmarkerexporter/config_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// SPDX-License-Identifier: Apache-2.0

package honeycombexporter

import (
"path/filepath"
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/confmap/confmaptest"
)

func TestLoadConfig(t *testing.T) {
t.Parallel()

cm, err := confmaptest.LoadConf(filepath.Join("testdata", "config.yaml"))
require.NoError(t, err)

defaultCfg := CreateDefaultConfig()

tests := []struct {
id component.ID
expected component.Config
}{

{
id: component.NewIDWithName("honeycomb", ""),
expected: defaultCfg,
},
}

for _, tt := range tests {
t.Run(tt.id.String(), func(t *testing.T) {
factory := NewFactory()
cfg := factory.CreateDefaultConfig()

sub, err := cm.Sub(tt.id.String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))

assert.NoError(t, component.ValidateConfig(cfg))
assert.Equal(t, tt.expected, cfg)
})
}
}

func withDefaultConfig(fns ...func(*Config)) *Config {
cfg := CreateDefaultConfig().(*Config)
for _, fn := range fns {
fn(cfg)
}
return cfg
}
51 changes: 51 additions & 0 deletions exporter/honeycombmarkerexporter/factory.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

package honeycombexporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/honeycombexporter"

import (
"context"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/exporter"
"go.opentelemetry.io/collector/exporter/exporterhelper"

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

Check failure on line 13 in exporter/honeycombmarkerexporter/factory.go

View workflow job for this annotation

GitHub Actions / unittest-matrix (~1.20.8, other)

no required module provides package github.com/open-telemetry/opentelemetry-collector-contrib/exporter/honeycombexporter/internal/metadata; to add it:
)

func NewFactory() exporter.Factory {
return exporter.NewFactory(
metadata.Type,
CreateDefaultConfig,
exporter.WithLogs(createLogsExporter, component.StabilityLevelDevelopment),
TylerHelmuth marked this conversation as resolved.
Show resolved Hide resolved
fchikwekwe marked this conversation as resolved.
Show resolved Hide resolved
exporter.WithTraces(createTracesExporter, component.StabilityLevelDevelopment),
exporter.WithMetrics(createMetricsExporter, component.StabilityLevelDevelopment),
)
}

func CreateDefaultConfig() component.Config {
return &Config{
APIKey: "",
APIURL: "",
fchikwekwe marked this conversation as resolved.
Show resolved Hide resolved
Presets: true,
}
}

func createLogsExporter(
ctx context.Context,
set exporter.CreateSettings,
cfg component.Config,
) (exporter.Logs, error) {
cf := cfg.(*Config)

exporter := newLogsExporter(set.Logger, cf)

return exporterhelper.NewLogsExporter(
ctx,
set,
cfg,
exporter.pushLogsData,
exporterhelper.WithStart(exporter.start),
exporterhelper.WithShutdown(exporter.shutdown),
fchikwekwe marked this conversation as resolved.
Show resolved Hide resolved
)
}
36 changes: 36 additions & 0 deletions exporter/honeycombmarkerexporter/factory_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

package honeycombexporter

import (
"context"
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/exporter/exportertest"
)

const defaultURL = `https://api.example.com/v1`

func TestCreateDefaultConfig(t *testing.T) {
factory := NewFactory()
cfg := factory.CreateDefaultConfig()
assert.NotNil(t, cfg, "failed to create default config")
assert.NoError(t, componenttest.CheckConfigStruct(cfg))
}

func TestFactory_CreateLogsExporter(t *testing.T) {
factory := NewFactory()
cfg := withDefaultConfig(func(cfg *Config) {
cfg.APIURL = defaultURL
})
params := exportertest.NewNopCreateSettings()
exporter, err := factory.CreateLogsExporter(context.Background(), params, cfg)
require.NoError(t, err)
require.NotNil(t, exporter)

require.NoError(t, exporter.Shutdown(context.TODO()))
}
36 changes: 36 additions & 0 deletions exporter/honeycombmarkerexporter/internal/logs_exporter.go
fchikwekwe marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

package honeycombexporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/honeycombexporter"

import (
"context"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/pdata/plog"
"go.uber.org/zap"
)

type honeycombLogsExporter struct {
logger *zap.Logger
}

func newLogsExporter(logger *zap.Logger, _ *Config) *honeycombLogsExporter {
logsExp := &honeycombLogsExporter{
logger: logger,
}
return logsExp
}

func (e *honeycombLogsExporter) start(_ context.Context, _ component.Host) error {

return nil
}

func (e *honeycombLogsExporter) shutdown(_ context.Context) error {
return nil
}
fchikwekwe marked this conversation as resolved.
Show resolved Hide resolved

func (e *honeycombLogsExporter) pushLogsData(_ context.Context, _ plog.Logs) error {
fchikwekwe marked this conversation as resolved.
Show resolved Hide resolved
return nil
}
7 changes: 7 additions & 0 deletions exporter/honeycombmarkerexporter/internal/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type: honeycomb

status:
class: exporter
stability:
development: [logs]
distributions: []
5 changes: 5 additions & 0 deletions exporter/honeycombmarkerexporter/testdata/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
honeycomb:
apikey:
apiurl: http://localhost:8080/
presets:

1 change: 1 addition & 0 deletions versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ module-sets:
- github.com/open-telemetry/opentelemetry-collector-contrib/exporter/googlecloudexporter
- github.com/open-telemetry/opentelemetry-collector-contrib/exporter/googlemanagedprometheusexporter
- github.com/open-telemetry/opentelemetry-collector-contrib/exporter/googlecloudpubsubexporter
- github.com/open-telemetry/opentelemetry-collector-contrib/exporter/honeycombexporter
TylerHelmuth marked this conversation as resolved.
Show resolved Hide resolved
- github.com/open-telemetry/opentelemetry-collector-contrib/exporter/influxdbexporter
- github.com/open-telemetry/opentelemetry-collector-contrib/exporter/instanaexporter
- github.com/open-telemetry/opentelemetry-collector-contrib/exporter/kafkaexporter
Expand Down
Loading