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

update OTLP proto to v0.9.0 #3740

Merged
merged 3 commits into from
Aug 3, 2021

Conversation

codeboten
Copy link
Contributor

@codeboten codeboten commented Jul 29, 2021

Description:
Update opentelemetry-proto to v0.9.0. As part of the change:

  • bumped submodule
  • updated sed patch file to support deprecated nullable StringKeyValue
  • added translation for labels to attributes in otlp_wrapper

Link to tracking Issue: Part of #3535

This is built on top of #3735

Remaining work once this PR is done:

Copy link
Member

@tigrannajaryan tigrannajaryan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the changeset open-telemetry/opentelemetry-proto@v0.8.0...v0.9.0 it seems like there are a couple more things that will need to be added:

  • schema_url
  • bytes data type
    Will these be added in a future PR? (I think that would be best to keep this one small).

func numberDataPointsLabelsToAttributes(dps []*otlpmetrics.NumberDataPoint) {
for i, _ := range dps {
if dps[i].Labels != nil {
dps[i].Attributes = labelsToAttributes(dps[i].Labels)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify: numberDataPointsLabelsToAttributes and its callers do not attempt to merge Labels and Attributes. The assumption is that the source data is in the old format so Attributes should be empty?
Is that true and is that how MetricsCompatibilityChanges is used in the codebase? If so can we clarify this somewhere in the comments?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been moved out of this PR, but I think it's an important point to clarify. Based on the comments in the proto, https://github.com/open-telemetry/opentelemetry-proto/blob/48ca003a72365f5591f1acd9b065ea8316be2ade/opentelemetry/proto/metrics/v1/metrics.proto#L307-L312 what are your thoughts on the right way to move forward? I suppose we can either:

  1. assume the Attributes are empty and override them with labels
  2. upsert Labels into Attributes
  3. insert Labels that are not present only

3 seems to make the most sense to me, but it's not a strong preference.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say we need to assume Attributes is empty:
Users cannot constructor custom protos since they are hidden. This case can happen only when we receive from the wire. So MetricsCompatibilityChanges is only called from data received on the wire which can be in new or old format but not a mix.

Depends how backwards compatible we want to be:

  1. If only labels is set we upsert everything to the Attributes
  2. If both are received the expectation is that they are the same, do nothing
  3. If only attributes is received then do nothing.

On the sent side:

  • If we want to do the correct thing we should translate attributes to labels and send both, but this is not what we did with IntSum/IntGauge. So maybe just a CHANGELOG entry and say that we broke this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it.

When receiving:

  • we should check if both labels and attributes are set, if so, don't do anything
  • if labels are set, upsert into attributes and leave labels as is.
  • don't do anything with the attributes only case.

When exporting, should labels always be dropped here? I worry that we would end up with inconsistent behaviour if labels are sometimes set and sometimes not.

model/pdata/metrics.go Outdated Show resolved Hide resolved
proto_patch.sed Outdated Show resolved Hide resolved
@codeboten
Copy link
Contributor Author

Looking at the changeset open-telemetry/opentelemetry-proto@v0.8.0...v0.9.0 it seems like there are a couple more things that will need to be added:

* schema_url

* bytes data type
  Will these be added in a future PR? (I think that would be best to keep this one small).

Yes that's correct, I'm only trying to do the bare minimum to get the tests passing w/ OTLP v0.9.0, I've added the rest to a task list on this PR's description, though they should probably go in the main issue #3535, but I don't have permission to add tasks there.

@codeboten codeboten force-pushed the codeboten/otlp-0.9.0 branch 2 times, most recently from 9346b16 to adcd7a2 Compare July 30, 2021 21:14
@bogdandrutu
Copy link
Member

Please rebase, and make more granular changes :)

@codeboten codeboten force-pushed the codeboten/otlp-0.9.0 branch 3 times, most recently from bccda7d to 1b349bb Compare August 2, 2021 20:11
@codeboten
Copy link
Contributor Author

Please rebase, and make more granular changes :)

@bogdandrutu done, will add separate PRs for converting labels to attributes.

@codeboten codeboten marked this pull request as ready for review August 2, 2021 20:19
@codeboten codeboten requested a review from a team as a code owner August 2, 2021 20:19
@bogdandrutu bogdandrutu merged commit 9808622 into open-telemetry:main Aug 3, 2021
@codeboten codeboten deleted the codeboten/otlp-0.9.0 branch August 11, 2021 23:34
dmitryax added a commit to signalfx/splunk-otel-collector that referenced this pull request Aug 18, 2021
Adapt code to changes in core:
- config.experimental.configsource.Watchable interface open-telemetry/opentelemetry-collector#3792
- Rename CustomUnmarshable to Unmarshallable open-telemetry/opentelemetry-collector#3774
- Switched metrics from Value() to DoubleVal() open-telemetry/opentelemetry-collector#3740
emaderer added a commit to signalfx/splunk-otel-collector that referenced this pull request Aug 18, 2021
* Bump smart agent version to v5.11.3

* Update CHANGELOG.md

* Update core/contrib deps

* Fix broken code due to renaming of CustomUnmarshable to Unmarshallable

* Fix broken code due to renaming of CustomUnmarshable to Unmarshallable

* Revert "Fix broken code due to renaming of CustomUnmarshable to Unmarshallable"

This reverts commit de03f5e.

* Revert "Fix broken code due to renaming of CustomUnmarshable to Unmarshallable"

This reverts commit e09a9e3.

* Update code according to changes in core

Adapt code to changes in core:
- config.experimental.configsource.Watchable interface open-telemetry/opentelemetry-collector#3792
- Rename CustomUnmarshable to Unmarshallable open-telemetry/opentelemetry-collector#3774
- Switched metrics from Value() to DoubleVal() open-telemetry/opentelemetry-collector#3740

Co-authored-by: Eyal Maderer <emaderer@splunk.com>
Co-authored-by: Dmitry <anoshindx@gmail.com>
// The aggregation value is over the time interval (start_time_unix_nano,
// time_unix_nano].
// This field will be removed in ~3 months, on July 1, 2021.
Labels []v11.StringKeyValue `protobuf:"bytes,1,rep,name=labels,proto3" json:"labels"` // Deprecated: Do not use.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has the Labels field been removed in the latest version? We still use the old version of the collector in some places. Is there any way to make it compatible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants