Shopify / Shopify/semian

Feature: support static config for Semian::NetHTTP and Semian::GRPC

Open
#350 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted Semian
Dominant language
Ruby
Stars
1.5k
Forks
88
Avg merge
3d 19h
Merged PRs (30d)
5

Description

Background

MySQL and Redis supports static config, while NetHTTP and GRPC currently only Proc. e.g.
https://github.com/Shopify/semian/blob/1d4b53be7819707f9c6eebc17bb9b50b46619271/lib/semian/mysql2.rb#L137-L140
https://github.com/Shopify/semian/blob/1d4b53be7819707f9c6eebc17bb9b50b46619271/lib/semian/net_http.rb#L67-L69
https://github.com/Shopify/semian/blob/1d4b53be7819707f9c6eebc17bb9b50b46619271/lib/semian/grpc.rb#L48-L50

Problem

If pass a static config to NetHTTP and GRPC, semian is disabled because retrieve_semian_configuration returns nil.

Proposal

allow static config if it is not callable

def retrieve_semian_configuration(host, port)
  return @semian_configuration unless @semian_configuration.respond_to?(:call) 

 @semian_configuration.call(host, port)
 end 

Alternative

Add validation to semian_configuration setter, assert whether static config or Proc is expected

https://github.com/Shopify/semian/blob/1d4b53be7819707f9c6eebc17bb9b50b46619271/lib/semian/net_http.rb#L61-L64

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with lib/semian/net_http.rb and lib/semian/grpc.rb, especially the semian_configuration setter and retrieve_semian_configuration methods; compare their behavior with the referenced implementation in lib/semian/mysql2.rb. Verify that static configurations are returned for both integrations, callable configurations still receive host and port, and the relevant existing tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.