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

Cleanup after the Otel upgrade #4359

Merged
merged 5 commits into from
Jul 12, 2023
Merged

Cleanup after the Otel upgrade #4359

merged 5 commits into from
Jul 12, 2023

Conversation

ptodev
Copy link
Contributor

@ptodev ptodev commented Jul 6, 2023

PR Description

#3858 updated to version 0.80 of Otel Collector, but some work was still yet to be done. This PR completes the Otel upgrade by doing the following:

  • Updates our components to use the latest features of Collector's components
  • Disables Otel Collector "process" metrics
  • Uses version v1.0.0-rcv0013 of pdata and featuregate modules instead of the ones from the fork.

This PR completes the upgrade to version 0.80 of the Collector. No more work is expected to be needed.

PR Checklist

  • CHANGELOG updated
  • Documentation added
  • Tests updated

@ptodev ptodev requested review from a team and clayton-cornell as code owners July 6, 2023 14:26
Copy link
Contributor

@clayton-cornell clayton-cornell left a comment

Choose a reason for hiding this comment

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

Two suggestions.

For not syntax, we should migrate to the correct markdown as we come across them in the topics. It's fine to leave existing notes as-is for now.

Comment on lines +10 to +14
> **NOTE**: `otelcol.exporter.jaeger` is a wrapper over the
> [upstream](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/jaegerexporter)
> OpenTelemetry Collector `jaeger` exporter. The upstream
> exporter has been deprecated and will be removed from future versions of
> both OpenTelemetry Collector and Grafana Agent because Jaeger supports OTLP directly.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
> **NOTE**: `otelcol.exporter.jaeger` is a wrapper over the
> [upstream](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/jaegerexporter)
> OpenTelemetry Collector `jaeger` exporter. The upstream
> exporter has been deprecated and will be removed from future versions of
> both OpenTelemetry Collector and Grafana Agent because Jaeger supports OTLP directly.
{{% admonition type="note" %}}
`otelcol.exporter.jaeger` is a wrapper over the [upstream](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/jaegerexporter) OpenTelemetry Collector `jaeger` exporter.
The upstream exporter has been deprecated and will be removed from future versions of both OpenTelemetry Collector and Grafana Agent because Jaeger supports OTLP directly.
{{% /admonition %}}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We use the > **NOTE**: syntax in all the Flow Otel pages. I would be happy to change it, but it'd be best to do it for all pages at once so we are consistent. Would you like me to raise a separate issue for it? It would also be nice to know why the {{% admonition type="note" %}} syntax is preferable?

Copy link
Contributor

Choose a reason for hiding this comment

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

The > **NOTE**: syntax formats the note as a blockquote. This works, but it relies on the blockquote formatting in the stylesheets staying constant and as expected.

The shortcode {{% admonition type="note" %}} ensures that ALL notes are formatted the same regardless of where they are in the docs... same with warnings and cautions... and the stylesheet is easier to manage.

Refer also to https://grafana.com/docs/writers-toolkit/write/shortcodes/#admonition-shortcode for formatting of the admonition shortcode.

So yes, if it's in the template we should update it.

Copy link
Contributor

Choose a reason for hiding this comment

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

If we leave it as-is in this PR, that's fine. We should plan to update the template for future

@ptodev ptodev force-pushed the upgrade-otel-cleanup2 branch from 5b8b935 to 3b2ae1f Compare July 11, 2023 07:43
@ptodev ptodev requested a review from clayton-cornell July 11, 2023 07:47
Copy link
Member

@rfratto rfratto left a comment

Choose a reason for hiding this comment

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

Thanks!

Comment on lines +120 to +129
func (a *Action) UnmarshalText(text []byte) error {
str := Action(strings.ToLower(string(text)))
switch str {
case ActionInsert, ActionUpdate, ActionUpsert, ActionDelete:
*a = str
return nil
default:
return fmt.Errorf("unknown action %v", str)
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Does this need to exist or is the Validate method enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

UnmarshalText needs to be implemented because otherwise River won't be able to unmarshal Action. Since I already had to implement it, I thought I might as well verify if it's correct since it doesn't make sense to unmarshal to an incorrect value.

Copy link
Member

Choose a reason for hiding this comment

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

UnmarshalText needs to be implemented because otherwise River won't be able to unmarshal Action.

Are you sure? Action is just a string.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, I see, there's text transformation going on when unmarshaling to make it case insensitive. OK, that adds some validity to UnmarshalText but it's still not strictly necessary.

I'm ok with keeping it in both cases (including the tail sampling case being discussed below)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The text transformation isn't the main reason. If I don't implement UnmarshalText, I get this error:

panic: reflect.Set: value of type string is not assignable to type headers.Action [recovered]
	panic: reflect.Set: value of type string is not assignable to type headers.Action

The text transformation was simply so that we match what the Collector does. TBH I'm not 100% sure if I like it or if we should just stick to some Agent convention, but I wasn't sure if we have a convention and thought this way it'll be easier to migrate Collector configs to the Agent.

Comment on lines 260 to 269
func (e *ErrorMode) UnmarshalText(text []byte) error {
str := ErrorMode(strings.ToLower(string(text)))
switch str {
case ErrorModeIgnore, ErrorModePropagate:
*e = str
return nil
default:
return fmt.Errorf("unknown error mode %v", str)
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Does this need to exist or is the Validate method enough?

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 is the same as the Action type in the other file in this PR.

UnmarshalText needs to be implemented because otherwise River won't be able to unmarshal ErrorMode. Since I already had to implement it, I thought I might as well verify if it's correct since it doesn't make sense to unmarshal to an incorrect value.

Comment on lines 271 to 273
// OttlConditionCfg holds the configurable setting to create a OTTL condition filter
// sampling policy evaluator.
type OttlConditionCfg struct {
Copy link
Member

Choose a reason for hiding this comment

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

The name here feels misaligned with our normal naming convention; this would usually be OTTLConditionConfig.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I changed the name of this type and all the other types in this file (they all used to end with Cfg)

@@ -30,8 +29,7 @@ func init() {

// Arguments configures the otelcol.receiver.jaeger component.
type Arguments struct {
Protocols ProtocolsArguments `river:"protocols,block"`
RemoteSampling *RemoteSamplingArguments `river:"remote_sampling,block,optional"`
Copy link
Member

Choose a reason for hiding this comment

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

This is a breaking change, right? It should be documented as such in the changelog.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's true, but I didn't list it as a breaking change because it's not documented in the docs. Would you agree?
I know that it's technically a breaking change, but since it's undocumented I think we could make an exception.
Btw I raised a similar PR upstream.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, sure, since it's not documented I agree it's safe to remove without a breaking change notice.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There was a discussion on this in the upstream PR, and I'm going to backtrack and just add an entry in the upgrade guide and in the changelog 😅

@@ -23,11 +23,36 @@ Main (unreleased)

- `otelcol.exporter.loki` now includes the instrumentation scope in its output. (@ptodev)

- `otelcol.extension.jaeger_remote_sampling` removes the `\` HTTP endpoint. The `/sampling` endpoint is still functional.
- `otelcol.extension.jaeger_remote_sampling` removes the `/` HTTP endpoint. The `/sampling` endpoint is still functional.
Copy link
Member

Choose a reason for hiding this comment

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

Note that all breaking changes need to be documented with details and potential migration instructions in the upgrade guide.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you, I forgot to update the guide in #3858. I added three entries to it now!

Copy link
Contributor

@thampiotr thampiotr left a comment

Choose a reason for hiding this comment

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

I don't have much context, but it looks good to me from the outside 👍

go.mod Outdated Show resolved Hide resolved
@ptodev ptodev force-pushed the upgrade-otel-cleanup2 branch from 46d1d2f to d4377d4 Compare July 12, 2023 15:38
@ptodev ptodev force-pushed the upgrade-otel-cleanup2 branch from d67af11 to d06c667 Compare July 12, 2023 21:19
Comment on lines +259 to +261
if e == nil || *e == "" {
return ottl.ErrorMode("")
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rfratto - after your review I had to fix a linter issue, and I added this clause. It feels dodgy because ottl.ErrorMode("") is not a valid error mode, but I can't think of a better way to handle this. I'm just going to merge it as it is, I hope you don't mind.

@ptodev ptodev merged commit 1b7e538 into main Jul 12, 2023
@ptodev ptodev deleted the upgrade-otel-cleanup2 branch July 12, 2023 21:42
clayton-cornell added a commit that referenced this pull request Aug 14, 2023
* Cleanup after the Otel upgrade

* Update docs/sources/flow/reference/components/otelcol.processor.batch.md

Co-authored-by: Clayton Cornell <[email protected]>

* PR review improvements

* Update comment

* Fix linter issue, document remote_sampling change

---------

Co-authored-by: Clayton Cornell <[email protected]>
clayton-cornell added a commit that referenced this pull request Aug 14, 2023
* Cleanup after the Otel upgrade

* Update docs/sources/flow/reference/components/otelcol.processor.batch.md

Co-authored-by: Clayton Cornell <[email protected]>

* PR review improvements

* Update comment

* Fix linter issue, document remote_sampling change

---------

Co-authored-by: Clayton Cornell <[email protected]>
@github-actions github-actions bot added the frozen-due-to-age Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed. label Feb 22, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
frozen-due-to-age Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants