-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[Metrics builder] Set schema version from metadata.yaml #9010
[Metrics builder] Set schema version from metadata.yaml #9010
Conversation
@tigrannajaryan I see you enforced setting of |
5984fef
to
c5aea01
Compare
Any receiver that uses otel semantic conventions to set Resource or Metric attributes should set SchemaURL. I am not sure if scraping receivers use such attributes, I don't know where in the code to look for it. Can you point me to the right place? Anyway, if the scrapers do use semantic conventions then, yes this change is good, we should definitely set SchemaURL. |
Currently, only process scraper of host metrics receiver uses the semantic conventions. For now it's hardcoded in metadata.yaml, but I'll migrate it to use semantic convention names as the next step #8840. This PR is meant to just add the |
Yes. If nothing from actual conventions is used including the SchemaURL is pointless (and potentially confusing). |
c5aea01
to
25cc3cd
Compare
Sounds good. Thanks. I updated the PR to set SchemaURL in the process scraper only for now. PTAL |
@codeboten @djaglowski can you also take a look please? |
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.
It would be useful to document somewhere how the new sem_conv_version
setting must be used when adding new scrapers.
Maybe add a short paragraph in hostmetricsreceiver/README.md and explain how to add new scrapers and how sem_conv_version
field is important?
I'll add a README paragraph in the next PR for #8840 to outline its full purpose |
This change sets schema field in metric scrapers based on a metadata field `conventions_version`. The field is required only if metrics are emitted with semantic convention attributes. This makes `wrapBySchemaURLSetterConsumer` function redundant, and it can be removed.
25cc3cd
to
e1a958e
Compare
@tigrannajaryan I updated the PR to set |
One final confirmation, the telemetry emitted by hostmetrics receiver is going to be the same before and after this change, right? |
Yes |
@codeboten thanks for resolving the Changelog conflicts! I think it's good to be merged now |
This change sets the
SchemaURL
field on the metrics reported by all metric scrapers. The version is taken from a new required metadata fieldconventions_version
.After this change, metrics from all the scrapers migrated to the new metrics builder will be reported with the latest schema version 1.9.0.
This makes
wrapBySchemaURLSetterConsumer
function redundant, and it can be removed. This approach enforces theSchemaURL
by making sure it's explicitly defined in the metadata fieldconventions_version
. We could've make a default version applied in the metrics builded instead of asking for it explicitly, but I don't think it's the best approach. We have all the metrics metadata defined in the yaml file so far, so I don't think we should introduce anything applied implicitly here.Closes: #8841