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

GRPC Agent #203

Closed
wants to merge 10 commits into from
Closed

GRPC Agent #203

wants to merge 10 commits into from

Conversation

santigimeno
Copy link
Member

agents: add protofiles for GRPCAgent service
agents: add GrpcClient implementation

The static `GrpcClient` namespace exposes multiple methods implementing
part of the NSolidService rpc's.

- The `MakeChannel()` methods, which accepts `OtlpGrpcClientOptions` as
  a param, which allows creating a gRPC channel.
- The `MakeClientContext()` method which ºsets up a gRPC client context with
  metadata: `nsolid-agent-id: agent_id` and `nsolid-saas-token: token`.
- The `MakeNSolidServiceStub` method which creates a stub for the N|Solid service
  to facilitate communication with the N|Solid Console.
- The `DelegateAsyncExport()` methods which perform all the unary rpc
  calls defined in `NSolidService`.
agents: implement CommandStream class
    
It implements the bi-directional `Command` rpc using the gRPC Callback
API by inheriting from
`grpc::ClientBidiReactor<grpcagent::CommandResponse,grpcagent::CommandRequest>`.

Also add `nsolid_grpc_agent` as a "debuggable` native module.
agents: implement AssetStream class
    
It implements the gRPC Client Streaming `ExportAsset` rpc using the gRPC
Callback API by inheriting from
`grpc::ClientWriteReactor<grpcagent::Asset>`.
agents: GrpcAgent initial implementation

This implementation, in principle, implements exactly the same
functionality the `ZmqAgent` provides.

Expanded the `ProfileOptionsBase` to add `google::protobuf::Struct
metadata_pb`, so the metadata can be stored as a protobuf struct.
agents: implement JS bindings to the gRPC Agent

They implement the asset collection API's mirroring the bindings in the
`ZmqAgent`.
lib,src: gRPCAgent integration in N|Solid
    
For now the integration looks like this:

The `NSOLID_GRPC` env variable needs to be set to enable the agent. Its
value can be interpreted in 2 different ways:
- If a SaaS token is provided (via NSOLID_SAAS for example), its value
  has no meaning but "enable gRPC Agent".
- Otoh, if no SaaS token is provided, its contents are parsed as the
  endpoint the `gRPCAgent` should connect to.
test: add gRPC agent tests

@santigimeno santigimeno self-assigned this Oct 28, 2024
@santigimeno santigimeno force-pushed the santi/grpc_agent_pr branch 4 times, most recently from 6346451 to 5364e4c Compare October 28, 2024 22:43
Copy link
Member

@trevnorris trevnorris left a comment

Choose a reason for hiding this comment

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

Awesome stuff.

void InitGrpcAgent(Local<Object> exports,
Local<Value> unused,
Local<Context> context,
void* priv) {
Copy link
Member

Choose a reason for hiding this comment

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

nit: left alignment.

const ProfileType& type,
ProfileOptions& options); // NOLINT(runtime/references)

// ErrorType do_start_prof(const grpcagent::CommandRequest& req,
Copy link
Member

Choose a reason for hiding this comment

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

Can this be removed, or was it for something we'll need in the future?

The static `GrpcClient` namespace exposes multiple methods implementing
part of the NSolidService rpc's.

- The `MakeChannel()` methods, which accepts `OtlpGrpcClientOptions` as
  a param, which allows creating a gRPC channel.
- The `MakeClientContext()` method which ºsets up a gRPC client context with
  metadata: `nsolid-agent-id: agent_id` and `nsolid-saas-token: token`.
- The `MakeNSolidServiceStub` method which creates a stub for the N|Solid service
  to facilitate communication with the N|Solid Console.
- The `DelegateAsyncExport()` methods which perform all the unary rpc
  calls defined in `NSolidService`.
It implements the bi-directional `Command` rpc using the gRPC Callback
API by inheriting from
`grpc::ClientBidiReactor<grpcagent::CommandResponse,grpcagent::CommandRequest>`.

Also add `nsolid_grpc_agent` as a "debuggable` native module.
It implements the gRPC Client Streaming `ExportAsset` rpc using the gRPC
Callback API by inheriting from
`grpc::ClientWriteReactor<grpcagent::Asset>`.
@santigimeno santigimeno force-pushed the santi/grpc_agent_pr branch 2 times, most recently from 9c02817 to a657715 Compare October 30, 2024 15:48
This implementation, in principle, implements exactly the same
functionality the `ZmqAgent` provides.

Expanded the `ProfileOptionsBase` to add `google::protobuf::Struct
metadata_pb`, so the metadata can be stored as a protobuf struct.
They implement the asset collection API's mirroring the bindings in the
`ZmqAgent`.
For now the integration looks like this:

The `NSOLID_GRPC` env variable needs to be set to enable the agent. Its
value can be interpreted in 2 different ways:
- If a SaaS token is provided (via NSOLID_SAAS for example), its value
  has no meaning but "enable gRPC Agent".
- Otoh, if no SaaS token is provided, its contents are parsed as the
  endpoint the `gRPCAgent` should connect to.
It should be a valid URL otherwise, `opentelemetry-cpp` `URLParser` will
throw.

Also fixed handling of `grpc` configuration via package.json.
santigimeno added a commit that referenced this pull request Nov 1, 2024
santigimeno added a commit that referenced this pull request Nov 1, 2024
The static `GrpcClient` namespace exposes multiple methods implementing
part of the NSolidService rpc's.

- The `MakeChannel()` methods, which accepts `OtlpGrpcClientOptions` as
  a param, which allows creating a gRPC channel.
- The `MakeClientContext()` method which ºsets up a gRPC client context with
  metadata: `nsolid-agent-id: agent_id` and `nsolid-saas-token: token`.
- The `MakeNSolidServiceStub` method which creates a stub for the N|Solid service
  to facilitate communication with the N|Solid Console.
- The `DelegateAsyncExport()` methods which perform all the unary rpc
  calls defined in `NSolidService`.

PR-URL: #203
Reviewed-By: Trevor Norris <[email protected]>
santigimeno added a commit that referenced this pull request Nov 1, 2024
It implements the bi-directional `Command` rpc using the gRPC Callback
API by inheriting from
`grpc::ClientBidiReactor<grpcagent::CommandResponse,grpcagent::CommandRequest>`.

Also add `nsolid_grpc_agent` as a "debuggable` native module.

PR-URL: #203
Reviewed-By: Trevor Norris <[email protected]>
santigimeno added a commit that referenced this pull request Nov 1, 2024
It implements the gRPC Client Streaming `ExportAsset` rpc using the gRPC
Callback API by inheriting from
`grpc::ClientWriteReactor<grpcagent::Asset>`.

PR-URL: #203
Reviewed-By: Trevor Norris <[email protected]>
santigimeno added a commit that referenced this pull request Nov 1, 2024
This implementation, in principle, implements exactly the same
functionality the `ZmqAgent` provides.

Expanded the `ProfileOptionsBase` to add `google::protobuf::Struct
metadata_pb`, so the metadata can be stored as a protobuf struct.

PR-URL: #203
Reviewed-By: Trevor Norris <[email protected]>
santigimeno added a commit that referenced this pull request Nov 1, 2024
They implement the asset collection API's mirroring the bindings in the
`ZmqAgent`.

PR-URL: #203
Reviewed-By: Trevor Norris <[email protected]>
santigimeno added a commit that referenced this pull request Nov 1, 2024
For now the integration looks like this:

The `NSOLID_GRPC` env variable needs to be set to enable the agent. Its
value can be interpreted in 2 different ways:
- If a SaaS token is provided (via NSOLID_SAAS for example), its value
  has no meaning but "enable gRPC Agent".
- Otoh, if no SaaS token is provided, its contents are parsed as the
  endpoint the `gRPCAgent` should connect to.

PR-URL: #203
Reviewed-By: Trevor Norris <[email protected]>
santigimeno added a commit that referenced this pull request Nov 1, 2024
PR-URL: #203
Reviewed-By: Trevor Norris <[email protected]>
trevnorris pushed a commit that referenced this pull request Nov 1, 2024
trevnorris pushed a commit that referenced this pull request Nov 1, 2024
The static `GrpcClient` namespace exposes multiple methods implementing
part of the NSolidService rpc's.

- The `MakeChannel()` methods, which accepts `OtlpGrpcClientOptions` as
  a param, which allows creating a gRPC channel.
- The `MakeClientContext()` method which ºsets up a gRPC client context with
  metadata: `nsolid-agent-id: agent_id` and `nsolid-saas-token: token`.
- The `MakeNSolidServiceStub` method which creates a stub for the N|Solid service
  to facilitate communication with the N|Solid Console.
- The `DelegateAsyncExport()` methods which perform all the unary rpc
  calls defined in `NSolidService`.

PR-URL: #203
Reviewed-By: Trevor Norris <[email protected]>
trevnorris pushed a commit that referenced this pull request Nov 1, 2024
It implements the bi-directional `Command` rpc using the gRPC Callback
API by inheriting from
`grpc::ClientBidiReactor<grpcagent::CommandResponse,grpcagent::CommandRequest>`.

Also add `nsolid_grpc_agent` as a "debuggable` native module.

PR-URL: #203
Reviewed-By: Trevor Norris <[email protected]>
trevnorris pushed a commit that referenced this pull request Nov 1, 2024
It implements the gRPC Client Streaming `ExportAsset` rpc using the gRPC
Callback API by inheriting from
`grpc::ClientWriteReactor<grpcagent::Asset>`.

PR-URL: #203
Reviewed-By: Trevor Norris <[email protected]>
trevnorris pushed a commit that referenced this pull request Nov 1, 2024
This implementation, in principle, implements exactly the same
functionality the `ZmqAgent` provides.

Expanded the `ProfileOptionsBase` to add `google::protobuf::Struct
metadata_pb`, so the metadata can be stored as a protobuf struct.

PR-URL: #203
Reviewed-By: Trevor Norris <[email protected]>
trevnorris pushed a commit that referenced this pull request Nov 1, 2024
They implement the asset collection API's mirroring the bindings in the
`ZmqAgent`.

PR-URL: #203
Reviewed-By: Trevor Norris <[email protected]>
trevnorris pushed a commit that referenced this pull request Nov 1, 2024
For now the integration looks like this:

The `NSOLID_GRPC` env variable needs to be set to enable the agent. Its
value can be interpreted in 2 different ways:
- If a SaaS token is provided (via NSOLID_SAAS for example), its value
  has no meaning but "enable gRPC Agent".
- Otoh, if no SaaS token is provided, its contents are parsed as the
  endpoint the `gRPCAgent` should connect to.

PR-URL: #203
Reviewed-By: Trevor Norris <[email protected]>
trevnorris pushed a commit that referenced this pull request Nov 1, 2024
PR-URL: #203
Reviewed-By: Trevor Norris <[email protected]>
trevnorris pushed a commit that referenced this pull request Nov 1, 2024
It should be a valid URL otherwise, `opentelemetry-cpp` `URLParser` will
throw.

Also fixed handling of `grpc` configuration via package.json.

PR-URL: #203
Reviewed-By: Trevor Norris <[email protected]>
trevnorris pushed a commit that referenced this pull request Nov 1, 2024
trevnorris pushed a commit that referenced this pull request Nov 1, 2024
trevnorris pushed a commit that referenced this pull request Nov 1, 2024
The static `GrpcClient` namespace exposes multiple methods implementing
part of the NSolidService rpc's.

- The `MakeChannel()` methods, which accepts `OtlpGrpcClientOptions` as
  a param, which allows creating a gRPC channel.
- The `MakeClientContext()` method which ºsets up a gRPC client context with
  metadata: `nsolid-agent-id: agent_id` and `nsolid-saas-token: token`.
- The `MakeNSolidServiceStub` method which creates a stub for the N|Solid service
  to facilitate communication with the N|Solid Console.
- The `DelegateAsyncExport()` methods which perform all the unary rpc
  calls defined in `NSolidService`.

PR-URL: #203
Reviewed-By: Trevor Norris <[email protected]>
trevnorris pushed a commit that referenced this pull request Nov 1, 2024
It implements the bi-directional `Command` rpc using the gRPC Callback
API by inheriting from
`grpc::ClientBidiReactor<grpcagent::CommandResponse,grpcagent::CommandRequest>`.

Also add `nsolid_grpc_agent` as a "debuggable` native module.

PR-URL: #203
Reviewed-By: Trevor Norris <[email protected]>
trevnorris pushed a commit that referenced this pull request Nov 1, 2024
It implements the gRPC Client Streaming `ExportAsset` rpc using the gRPC
Callback API by inheriting from
`grpc::ClientWriteReactor<grpcagent::Asset>`.

PR-URL: #203
Reviewed-By: Trevor Norris <[email protected]>
trevnorris pushed a commit that referenced this pull request Nov 1, 2024
This implementation, in principle, implements exactly the same
functionality the `ZmqAgent` provides.

Expanded the `ProfileOptionsBase` to add `google::protobuf::Struct
metadata_pb`, so the metadata can be stored as a protobuf struct.

PR-URL: #203
Reviewed-By: Trevor Norris <[email protected]>
trevnorris pushed a commit that referenced this pull request Nov 1, 2024
They implement the asset collection API's mirroring the bindings in the
`ZmqAgent`.

PR-URL: #203
Reviewed-By: Trevor Norris <[email protected]>
trevnorris pushed a commit that referenced this pull request Nov 1, 2024
For now the integration looks like this:

The `NSOLID_GRPC` env variable needs to be set to enable the agent. Its
value can be interpreted in 2 different ways:
- If a SaaS token is provided (via NSOLID_SAAS for example), its value
  has no meaning but "enable gRPC Agent".
- Otoh, if no SaaS token is provided, its contents are parsed as the
  endpoint the `gRPCAgent` should connect to.

PR-URL: #203
Reviewed-By: Trevor Norris <[email protected]>
trevnorris pushed a commit that referenced this pull request Nov 1, 2024
PR-URL: #203
Reviewed-By: Trevor Norris <[email protected]>
trevnorris pushed a commit that referenced this pull request Nov 1, 2024
It should be a valid URL otherwise, `opentelemetry-cpp` `URLParser` will
throw.

Also fixed handling of `grpc` configuration via package.json.

PR-URL: #203
Reviewed-By: Trevor Norris <[email protected]>
trevnorris pushed a commit that referenced this pull request Nov 1, 2024
trevnorris pushed a commit that referenced this pull request Nov 1, 2024
trevnorris pushed a commit that referenced this pull request Nov 1, 2024
The static `GrpcClient` namespace exposes multiple methods implementing
part of the NSolidService rpc's.

- The `MakeChannel()` methods, which accepts `OtlpGrpcClientOptions` as
  a param, which allows creating a gRPC channel.
- The `MakeClientContext()` method which ºsets up a gRPC client context with
  metadata: `nsolid-agent-id: agent_id` and `nsolid-saas-token: token`.
- The `MakeNSolidServiceStub` method which creates a stub for the N|Solid service
  to facilitate communication with the N|Solid Console.
- The `DelegateAsyncExport()` methods which perform all the unary rpc
  calls defined in `NSolidService`.

PR-URL: #203
Reviewed-By: Trevor Norris <[email protected]>
trevnorris pushed a commit that referenced this pull request Nov 1, 2024
It implements the bi-directional `Command` rpc using the gRPC Callback
API by inheriting from
`grpc::ClientBidiReactor<grpcagent::CommandResponse,grpcagent::CommandRequest>`.

Also add `nsolid_grpc_agent` as a "debuggable` native module.

PR-URL: #203
Reviewed-By: Trevor Norris <[email protected]>
trevnorris pushed a commit that referenced this pull request Nov 1, 2024
It implements the gRPC Client Streaming `ExportAsset` rpc using the gRPC
Callback API by inheriting from
`grpc::ClientWriteReactor<grpcagent::Asset>`.

PR-URL: #203
Reviewed-By: Trevor Norris <[email protected]>
trevnorris pushed a commit that referenced this pull request Nov 1, 2024
This implementation, in principle, implements exactly the same
functionality the `ZmqAgent` provides.

Expanded the `ProfileOptionsBase` to add `google::protobuf::Struct
metadata_pb`, so the metadata can be stored as a protobuf struct.

PR-URL: #203
Reviewed-By: Trevor Norris <[email protected]>
trevnorris pushed a commit that referenced this pull request Nov 1, 2024
They implement the asset collection API's mirroring the bindings in the
`ZmqAgent`.

PR-URL: #203
Reviewed-By: Trevor Norris <[email protected]>
trevnorris pushed a commit that referenced this pull request Nov 1, 2024
For now the integration looks like this:

The `NSOLID_GRPC` env variable needs to be set to enable the agent. Its
value can be interpreted in 2 different ways:
- If a SaaS token is provided (via NSOLID_SAAS for example), its value
  has no meaning but "enable gRPC Agent".
- Otoh, if no SaaS token is provided, its contents are parsed as the
  endpoint the `gRPCAgent` should connect to.

PR-URL: #203
Reviewed-By: Trevor Norris <[email protected]>
trevnorris pushed a commit that referenced this pull request Nov 1, 2024
PR-URL: #203
Reviewed-By: Trevor Norris <[email protected]>
trevnorris pushed a commit that referenced this pull request Nov 1, 2024
It should be a valid URL otherwise, `opentelemetry-cpp` `URLParser` will
throw.

Also fixed handling of `grpc` configuration via package.json.

PR-URL: #203
Reviewed-By: Trevor Norris <[email protected]>
trevnorris pushed a commit that referenced this pull request Nov 1, 2024
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