Skip to content

[flagd] ContextEnrichment for inprocess improvements by extracting logic onto the channelmonitor #1231

@aepfli

Description

@aepfli

Currently our Context Enrichment is handled here:

Exception metadataException = null;
log.debug("Initializing sync stream request");
final GetMetadataRequest.Builder metadataRequest = GetMetadataRequest.newBuilder();
GetMetadataResponse metadataResponse = GetMetadataResponse.getDefaultInstance();
try (CancellableContext context = Context.current().withCancellation()) {
try {
metadataResponse = grpcConnector.getResolver().getMetadata(metadataRequest.build());
} catch (Exception e) {
// the chances this call fails but the syncRequest does not are slim
// it could be that the server doesn't implement this RPC
// instead of logging and throwing here, retain the exception and handle in the
// stream logic below
metadataException = e;
log.debug("Metadata exception: {}", e.getMessage(), e);
}

We always try to fetch the metadata before we reestablish a connection, during our stream listening logic.

This might be a little bit tricky, as we are always relying on the same process, and if eg. the timeline exceeds etc. the whole process breaks.

The question is how important it is to fetch this metadata, as we could theoretically also do this unary call when the channel state changes to READY, instead of always during the loop.

This would decouple our sync from the metadata, and might increase our robustness.

WDYT?

cc: @guidobrei @toddbaert @beeme1mr @alexandraoberaigner @chrfwow

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs TriageThis issue needs to be investigated by a maintainer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions