-
Notifications
You must be signed in to change notification settings - Fork 6
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
POC for trsnaltor for attributes #222
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This approach looks good to me 👍 Only important part missing is to avoid counting the metric itself, other than that just a few nits.
} | ||
|
||
// MapToSource gets a telemetry signal source from its attributes. | ||
func (p *Translator) MapToSource(ctx context.Context, attrs pcommon.Map, set attribute.Set) (source.Source, bool) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like the PR is missing the logic to avoid counting datadog.otlp_translator.attributes.missing_source
?
func extractHostNameAndServiceName(resourceAttrs pcommon.Map, logAttrs pcommon.Map) (host string, service string) { | ||
if src, ok := attributes.SourceFromAttrs(resourceAttrs); ok && src.Kind == source.HostnameKind { | ||
func (t *Translator) extractHostNameAndServiceName(resourceAttrs pcommon.Map, logAttrs pcommon.Map) (host string, service string) { | ||
// TODO: This maps the same resource multiple times and generates the metric multiple times :( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes/source" | ||
) | ||
|
||
const missingSourceMetricName string = "datadog.otlp_translator.attributes.missing_source" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const missingSourceMetricName string = "datadog.otlp_translator.attributes.missing_source" | |
const missingSourceMetricName string = "datadog.otlp_translator.resources.missing_source" |
Technically we are counting the number of resources without host identifying attributes, rather than attributes ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Assuming the logs code gets refactored)
missingSources, err := meter.Int64Counter( | ||
missingSourceMetricName, | ||
metric.WithDescription("OTLP payloads that are missing a source (e.g. hostname)"), | ||
metric.WithUnit("[payload]"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may need to change this to {resource}
if you agree with the suggestion above. In both cases I believe it needs to be curly braces.
Last part in #231, where I addressed all the comments here :) |
What does this PR do?
Motivation