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

feat: payload collection instrumentation rule #1488

Merged
merged 36 commits into from
Sep 9, 2024

Conversation

blumamir
Copy link
Collaborator

@blumamir blumamir commented Sep 4, 2024

No description provided.

Language common.ProgrammingLanguage `json:"language"`
}

type PayloadCollection struct {
Copy link
Collaborator

Choose a reason for hiding this comment

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

What do you think about taking it out to a new directory?
rules/
payload/
payload_collection.go
otherRule/
otherrule.go

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

great idea, refactored 👍

type PayloadCollection struct {
// Collect HTTP request payload data when available.
// Can be a client (outgoing) request or a server (incoming) request, depending on the instrumentation library
HttpRequest *HttpPayloadCollectionRule `json:"httpRequest,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think better to remove the Rule from it's name
these are attributes/options within payloadCollectionRule ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

make sense. changed

HeadSamplingConfig HeadSamplingConfig `json:"headSamplerConfig,omitempty"`
HeadSamplingConfig *HeadSamplingConfig `json:"headSamplerConfig,omitempty"`

DefaultPayloadCollection PayloadCollection `json:"payloadCollection"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

why the defaultPayloadCollection is in the SdkConfig level but the config itself is in InstrumentationLibraryConfig?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It exists in both, so one can give a default to the SDK (recommended) but then override it with a specific config for a specific instrumentation library


Instrumentation Rules control how telemetry is recorded from your application.

## Rule Types:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe worth to mention that soon it will be available from the UI?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think the docs should say what we have and not our plans. Also, there isn't anything in the docs at the moment about the ui. I support adding documentation about the UI but not with this PR

sidebarTitle: "Payload Collection"
---

The "Payload Collection" Rule can be used to add span attributes containing payload data to traces.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Adding "star" - enterprise support only

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added

- `maxPayloadLength` (optional): Maximum length of the payload to collect. If the payload is longer than this value, it will be truncated or dropped, based on the value of `dropPartialPayloads` config option. When not specified (recommended), the instrumentation library will use any reasonable default value
- `dropPartialPayloads` (optional, default is false): If the payload is larger than the MaxPayloadLength, this parameter will determine if the payload should be partially collected up to the allowed length, or not collected at all. This is useful if you require some decoding of the payload (like json) and having it partially is not useful.

- `dbQuery` (optional): Collect database query payload info when available.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think need to mention Added attributes

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I will add it once the implementation in the eBPF is changed to use it

@@ -98,3 +98,11 @@ rules:
- patch
- update
- watch
- apiGroups:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just comment: Need to add also in the legacy chart one right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

}

// delete all existing sdk configs to re-calculate them
ic.Spec.SdkConfigs = []odigosv1alpha1.SdkConfig{}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe better create a new []odigosv1alpha1.SdkConfig{} object in memory and replace only at the end of the function?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

like it. refactored

instrumentor/controllers/instrumentationconfig/common.go Outdated Show resolved Hide resolved
Scheme *runtime.Scheme
}

func (r *InstrumentedApplicationReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why we also need to updateInstrumentationConfigForWorkload in the instrumentedapplication reconcile ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Once the language is detected, we need to update the config for this workload. Otherwise it will remain empty until a new rule is added

@blumamir blumamir merged commit 3c63617 into odigos-io:main Sep 9, 2024
22 checks passed
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.

2 participants