Skip to content

Commit

Permalink
Make changes suggested in PR
Browse files Browse the repository at this point in the history
  • Loading branch information
cparkins committed Dec 5, 2023
1 parent 44f3b68 commit 91a3bb2
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion receiver/kafkareceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ The following settings can be optionally configured:
- `raw`: (logs only) the payload's bytes are inserted as the body of a log record.
- `text`: (logs only) the payload are decoded as text and inserted as the body of a log record. By default, it uses UTF-8 to decode. You can use `text_<ENCODING>`, like `text_utf-8`, `text_shift_jis`, etc., to customize this behavior.
- `json`: (logs only) the payload is decoded as JSON and inserted as the body of a log record.
- `azureresourcelogs`: (logs only) the payload is converted from Azure Resource Logs format to OTel format.
- `azure_resource_logs`: (logs only) the payload is converted from Azure Resource Logs format to OTel format.
- `group_id` (default = otel-collector): The consumer group that receiver will be consuming messages from
- `client_id` (default = otel-collector): The consumer client ID that receiver will use
- `initial_offset` (default = latest): The initial offset to use if no offset was previously committed. Must be `latest` or `earliest`.
Expand Down
10 changes: 5 additions & 5 deletions receiver/kafkareceiver/azureresourcelogs_unmarshaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ import (
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/azure"
)

type AzureResourceLogsUnmarshaler struct {
type azureResourceLogsUnmarshaler struct {
unmarshaler *azure.ResourceLogsUnmarshaler
}

func newAzureResourceLogsUnmarshaler(version string, logger *zap.Logger) LogsUnmarshaler {
return AzureResourceLogsUnmarshaler{
return azureResourceLogsUnmarshaler{
unmarshaler: &azure.ResourceLogsUnmarshaler{
Version: version,
Logger: logger,
},
}
}

func (r AzureResourceLogsUnmarshaler) Unmarshal(buf []byte) (plog.Logs, error) {
func (r azureResourceLogsUnmarshaler) Unmarshal(buf []byte) (plog.Logs, error) {
return r.unmarshaler.UnmarshalLogs(buf)
}

func (r AzureResourceLogsUnmarshaler) Encoding() string {
return "azureresourcelogs"
func (r azureResourceLogsUnmarshaler) Encoding() string {
return "azure_resource_logs"
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ import (

func TestNewAzureResourceLogsUnmarshaler(t *testing.T) {
um := newAzureResourceLogsUnmarshaler("Test Version", zap.NewNop())
assert.Equal(t, "azureresourcelogs", um.Encoding())
assert.Equal(t, "azure_resource_logs", um.Encoding())
}
4 changes: 2 additions & 2 deletions receiver/kafkareceiver/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/kafkaexporter v0.90.1
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.90.1
github.com/open-telemetry/opentelemetry-collector-contrib/internal/kafka v0.90.1
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/azure v0.90.1
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/azure v0.90.1
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger v0.90.1
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/zipkin v0.90.1
github.com/openzipkin/zipkin-go v0.4.2
Expand Down Expand Up @@ -78,7 +78,7 @@ require (
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.15.0 // indirect
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 // indirect
golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect
golang.org/x/net v0.18.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions receiver/kafkareceiver/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions receiver/kafkareceiver/unmarshaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ func defaultMetricsUnmarshalers() map[string]MetricsUnmarshaler {
}

func defaultLogsUnmarshalers(version string, logger *zap.Logger) map[string]LogsUnmarshaler {
azureresourcelogs := newAzureResourceLogsUnmarshaler(version, logger)
azureResourceLogs := newAzureResourceLogsUnmarshaler(version, logger)
otlpPb := newPdataLogsUnmarshaler(&plog.ProtoUnmarshaler{}, defaultEncoding)
raw := newRawLogsUnmarshaler()
text := newTextLogsUnmarshaler()
json := newJSONLogsUnmarshaler()
return map[string]LogsUnmarshaler{
azureresourcelogs.Encoding(): azureresourcelogs,
azureResourceLogs.Encoding(): azureResourceLogs,
otlpPb.Encoding(): otlpPb,
raw.Encoding(): raw,
text.Encoding(): text,
Expand Down
2 changes: 1 addition & 1 deletion receiver/kafkareceiver/unmarshaler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func TestDefaultLogsUnMarshaler(t *testing.T) {
"raw",
"text",
"json",
"azureresourcelogs",
"azure_resource_logs",
}
marshalers := defaultLogsUnmarshalers("Test Version", zap.NewNop())
assert.Equal(t, len(expectedEncodings), len(marshalers))
Expand Down

0 comments on commit 91a3bb2

Please sign in to comment.