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

Google output resource to labels #425

Merged
merged 2 commits into from
Sep 16, 2021
Merged
Changes from all commits
Commits
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
13 changes: 13 additions & 0 deletions operator/builtin/output/googlecloud/google_cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,5 +369,18 @@ func (g *GoogleCloudOutput) createProtobufEntry(e *entry.Entry) (newEntry *logpb

newEntry.Resource = getResource(e)

// Google monitored resources wipe out Stanza's entry.Resources with
// a static set of resources, therefore we need to move the entry's resources
// to entry.Labels
for k, v := range e.Resource {
if val, ok := newEntry.Labels[k]; ok {
if val != v {
g.Warnf("resource to labels merge failed, entry has label %s=%s, tried to add %s=%s", k, val, k, v)
}
continue
}
newEntry.Labels[k] = v
}

return newEntry, nil
}