Skip to content

Commit

Permalink
[pkg/inframetadata] Improve warning when host-identifying attributes …
Browse files Browse the repository at this point in the history
…are missing (#314)

* [pkg/inframetadata] Improve warning when host-identifying attributes are missing

* Update mx-psi_improve-warning.yaml
  • Loading branch information
mx-psi authored Apr 2, 2024
1 parent e74f782 commit ba4072f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
16 changes: 16 additions & 0 deletions .chloggen/mx-psi_improve-warning.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: bug_fix

# The name of the component (e.g. pkg/quantile)
component: pkg/inframetadata

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Fixes warning log where resource attributes were not correctly logged

# The PR related to this change
issues: [314]

# (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:
5 changes: 4 additions & 1 deletion pkg/inframetadata/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ func (r *Reporter) pushAndLog(ctx context.Context, hm payload.HostMetadata) {
func (r *Reporter) hostname(res pcommon.Resource) (string, bool) {
src, ok := attributes.SourceFromAttrs(res.Attributes())
if !ok {
r.logger.Warn("resource does not have host-identifying attributes", zap.Any("attributes", res.Attributes()))
r.logger.Warn("resource does not have host-identifying attributes",
zap.Any("attributes", res.Attributes().AsRaw()),
zap.String("further info", "https://docs.datadoghq.com/opentelemetry/schema_semantics/hostname/?tab=datadogexporter"),
)
return "", false
}
if src.Kind != source.HostnameKind {
Expand Down

0 comments on commit ba4072f

Please sign in to comment.