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

Add message about available components to AgentDetails #201

Merged
merged 16 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions proto/opamp.proto
Original file line number Diff line number Diff line change
Expand Up @@ -609,10 +609,24 @@ message AgentDescription {
// with this Agent.
repeated KeyValue non_identifying_attributes = 2;

// Details about the components available in the agent.
ComponentDetails component_details = 3;
BinaryFissionGames marked this conversation as resolved.
Show resolved Hide resolved

// TODO: add ability to specify related entities (such as the Service the Agent is
// is responsible/associated with).
}

message ComponentDetails {
// Extra key/value pairs that may be used to describe the component.
// The key/value pairs are according to semantic conventions, see:
// https://opentelemetry.io/docs/specs/semconv/
tigrannajaryan marked this conversation as resolved.
Show resolved Hide resolved
repeated KeyValue metadata = 1;

// A map of component ID to sub components details. It can nest as deeply as needed to
// describe the underlying system.
map<string, ComponentDetails> sub_component_map = 2;
}

enum AgentCapabilities {
// The capabilities field is unspecified.
AgentCapabilities_Unspecified = 0;
Expand Down
127 changes: 126 additions & 1 deletion specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ Status: [Beta]
+ [AgentDescription Message](#agentdescription-message)
- [AgentDescription.identifying_attributes](#agentdescriptionidentifying_attributes)
- [AgentDescription.non_identifying_attributes](#agentdescriptionnon_identifying_attributes)
- [AgentDescription.component_details](#agentdescriptioncomponent_details)
+ [ComponentDetails Message](#componentdetails-message)
- [ComponentDetails.metadata](#componentdetailsmetadata)
- [ComponentDetails.sub_component_map](#componentdetailssub_component_map)
- [Examples](#examples)
* [OpenTelemetry Collector](#opentelemetry-collector)
* [Fluent Bit](#fluent-bit)
+ [ComponentHealth Message](#componenthealth-message)
- [ComponentHealth.healthy](#componenthealthhealthy)
- [ComponentHealth.start_time_unix_nano](#componenthealthstart_time_unix_nano)
Expand Down Expand Up @@ -163,7 +170,7 @@ Status: [Beta]
- [CustomMessage.capability](#custommessagecapability)
- [CustomMessage.type](#custommessagetype)
- [CustomMessage.data](#custommessagedata)
+ [Examples](#examples)
+ [Examples](#examples-1)
- [Pause/Resume Example](#pauseresume-example)
* [Agent Connection](#agent-connection)
* [Pause](#pause)
Expand Down Expand Up @@ -1152,6 +1159,124 @@ The following attributes SHOULD be included:
- any user-defined attributes that the end user would like to associate with
this Agent.

##### AgentDescription.component_details

Details about the available components in the agent.

This field gives a description of what components are available, as well
as extra metadata about the components.

The structure of ComponentDetails DOES NOT need to be a 1-to-1 match with
the ComponentHealth structure. ComponentHealth generally refers to instances of
BinaryFissionGames marked this conversation as resolved.
Show resolved Hide resolved
components, while ComponentDetails refers to the available types of components.
BinaryFissionGames marked this conversation as resolved.
Show resolved Hide resolved

This field is not required to be specified.
BinaryFissionGames marked this conversation as resolved.
Show resolved Hide resolved
BinaryFissionGames marked this conversation as resolved.
Show resolved Hide resolved

#### ComponentDetails Message

Status: [Beta]

The ComponentDetails message has the following structure:

```protobuf
message ComponentDetails {
map<string, ComponentDetails> sub_component_map = 1;
repeated KeyValue metadata = 2;
}
```

##### ComponentDetails.metadata

Extra key/value pairs that may be used to describe the component.

The key/value pairs are according to semantic conventions, see
the [OpenTelemetry Semantic Conventions](https://opentelemetry.io/docs/specs/semconv/) for more information.

##### ComponentDetails.sub_component_map

A map of component ID to sub components details. It can nest as deeply as needed to
describe the underlying system.

##### Examples

###### OpenTelemetry Collector

Here is an example of how ComponentDetails could hold information regarding the included
components for a custom build collector:
BinaryFissionGames marked this conversation as resolved.
Show resolved Hide resolved

```json
{
"sub_component_data": {
"receivers": {
"sub_component_data": {
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/[email protected]": {
"metadata": {
"type": "hostmetrics",
}
}
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 ID here works for how everything is structured in contrib. I'm wondering if you could cause a collision through, simply by having multiple components in one module? Do we need to support that? I don't think the builder supports that case currently, either.

Choose a reason for hiding this comment

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

Technically the builder does support this, though I don't think it's frequently used. If components are hosted under different paths inside the same module, the builder can be told to include a component per package. That is, if the module is github.com/open-telemetry/opentelemetry-collector-contrib, the path could be receiver/hostmetricsreceiver or processor/transform for the package within the module where the component is found. I think it's safe to say that these could be reported as github.com/open-telemetry/opentelemetry-collector-contrib/[...]@vX.Y.Z, though I'm not sure how this is currently handled in the Collector's reporting of each module.

If that's accounted for, the builder limits each path/package to a single component, so we're okay from that perspective.

Copy link
Contributor Author

@BinaryFissionGames BinaryFissionGames Oct 24, 2024

Choose a reason for hiding this comment

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

This is a good point.

I inverted the ID to be the type string instead; I think the type should be unique within it's class (e.g. there is only one "hostmetricsreceiver" in any given build of the agent). Then the module is in the metadata as extra information to identify the exact version of code.

}
},
"processors": {
"sub_component_data": {
"go.opentelemetry.io/collector/processor/[email protected]": {
"metadata": {
"type": "batch",
}
},
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/[email protected]": {
"metadata": {
"type": "transform",
}
},
}
},
"exporters": {
"sub_component_data": {
"go.opentelemetry.io/collector/exporter/[email protected]": {
"metadata": {
"type": "nop",
}
}
}
}
}
// ... Component list continues for extensions and collectors ...
}
```

###### Fluent Bit

Here's an example of how Fluent Bit could report what components it has available.

```json
{
"sub_component_data": {
"input": {
"sub_component_data": {
"tail": {}
}
},
BinaryFissionGames marked this conversation as resolved.
Show resolved Hide resolved
"parser": {
"sub_component_data": {
"json": {}
}
},
"filter": {
"sub_component_data": {
"lua": {},
"modify": {}
}
},
"output": {
"sub_component_data": {
"null": {},
"file": {},
}
}
}
}
```

#### ComponentHealth Message

Status: [Beta]
Expand Down
Loading