Skip to content

Commit

Permalink
Merge branch 'main' into googlecloudmonitoringreceiver-phase1
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishek-at-cloudwerx authored Aug 12, 2024
2 parents 499ccd1 + 2e8fc49 commit aaa9904
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 9 deletions.
27 changes: 27 additions & 0 deletions .chloggen/codeboten_more-scope-7.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: breaking

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: cloudflarereceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: "Update the scope name for telemetry produced by the cloudflarereceiver from `otelcol/cloudflare` to `github.com/open-telemetry/opentelemetry-collector-contrib/receiver/cloudflarereceiver`"

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [34613]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: []
4 changes: 1 addition & 3 deletions receiver/cloudflarereceiver/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ type logsReceiver struct {

const secretHeaderName = "X-CF-Secret"

var receiverScopeName = "otelcol/" + metadata.Type.String()

func newLogsReceiver(params rcvr.Settings, cfg *Config, consumer consumer.Logs) (*logsReceiver, error) {
recv := &logsReceiver{
cfg: &cfg.Logs,
Expand Down Expand Up @@ -233,7 +231,7 @@ func (l *logsReceiver) processLogs(now pcommon.Timestamp, logs []map[string]any)
resource.Attributes().PutStr("cloudflare.zone", zone)
}
scopeLogs := resourceLogs.ScopeLogs().AppendEmpty()
scopeLogs.Scope().SetName(receiverScopeName)
scopeLogs.Scope().SetName(metadata.ScopeName)

for _, log := range logGroup {
logRecord := scopeLogs.LogRecords().AppendEmpty()
Expand Down
4 changes: 2 additions & 2 deletions receiver/cloudflarereceiver/logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func TestPayloadToLogRecord(t *testing.T) {
logs := plog.NewLogs()
rl := logs.ResourceLogs().AppendEmpty()
sl := rl.ScopeLogs().AppendEmpty()
sl.Scope().SetName(receiverScopeName)
sl.Scope().SetName("github.com/open-telemetry/opentelemetry-collector-contrib/receiver/cloudflarereceiver")

for idx, line := range strings.Split(payload, "\n") {
lr := sl.LogRecords().AppendEmpty()
Expand Down Expand Up @@ -86,7 +86,7 @@ func TestPayloadToLogRecord(t *testing.T) {
}))

sl := rl.ScopeLogs().AppendEmpty()
sl.Scope().SetName(receiverScopeName)
sl.Scope().SetName("github.com/open-telemetry/opentelemetry-collector-contrib/receiver/cloudflarereceiver")
lr := sl.LogRecords().AppendEmpty()

require.NoError(t, lr.Attributes().FromRaw(map[string]any{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,4 +284,4 @@ resourceLogs:
timeUnixNano: "1677821346000000000"
traceId: ""
scope:
name: otelcol/cloudflare
name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/cloudflarereceiver
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ resourceLogs:
timeUnixNano: "1677821345000000000"
traceId: ""
scope:
name: otelcol/cloudflare
name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/cloudflarereceiver
- resource:
attributes:
- key: cloudflare.zone
Expand Down Expand Up @@ -178,7 +178,7 @@ resourceLogs:
timeUnixNano: "1677821345000000000"
traceId: ""
scope:
name: otelcol/cloudflare
name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/cloudflarereceiver
- resource:
attributes:
- key: cloudflare.zone
Expand Down Expand Up @@ -230,4 +230,4 @@ resourceLogs:
timeUnixNano: "1677821345000000000"
traceId: ""
scope:
name: otelcol/cloudflare
name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/cloudflarereceiver

0 comments on commit aaa9904

Please sign in to comment.