{"id":28512258,"url":"https://github.com/fluxninja/aperture-go","last_synced_at":"2025-10-14T18:38:37.440Z","repository":{"id":61625295,"uuid":"531293057","full_name":"fluxninja/aperture-go","owner":"fluxninja","description":"SDK to interact with Aperture Agent","archived":false,"fork":false,"pushed_at":"2024-02-05T12:04:09.000Z","size":492,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-09-01T18:47:59.975Z","etag":null,"topics":["concurrency-limiter","flow-control","rate-limiter","sdk","sre"],"latest_commit_sha":null,"homepage":"https://docs.fluxninja.com","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fluxninja.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-31T23:30:25.000Z","updated_at":"2024-01-31T21:04:59.000Z","dependencies_parsed_at":"2024-02-05T08:32:49.011Z","dependency_job_id":"e167c26d-1631-4871-802b-d0ac7d8d33a2","html_url":"https://github.com/fluxninja/aperture-go","commit_stats":null,"previous_names":[],"tags_count":38,"template":false,"template_full_name":null,"purl":"pkg:github/fluxninja/aperture-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluxninja%2Faperture-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluxninja%2Faperture-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluxninja%2Faperture-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluxninja%2Faperture-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fluxninja","download_url":"https://codeload.github.com/fluxninja/aperture-go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluxninja%2Faperture-go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279020348,"owners_count":26086866,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["concurrency-limiter","flow-control","rate-limiter","sdk","sre"],"created_at":"2025-06-09T00:37:25.093Z","updated_at":"2025-10-14T18:38:37.423Z","avatar_url":"https://github.com/fluxninja.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n🚀 \u003cb\u003e\u003c/b\u003eJust launched v1 of \u003ca href=\"https://blog.fluxninja.com/blog/aperture-v1-launch-2024/\"\u003emanaged rate limiting service\u003c/a\u003e\u003c/b\u003e\n  \u003cbr/\u003eSupport us with your feedback and questions on \u003ca href=\"https://www.producthunt.com/posts/fluxninja-aperture\"\u003eProduct Hunt\u003c/a\u003e or \u003ca href=\"https://discord.gg/U3N3fCZEPm\"\u003eDiscord\u003c/a\u003e\n  \u003cbr/\u003e\n\u003c/p\u003e\n\n# Rate Limiting for Golang Applications\n\nThe `aperture-go` SDK provides an easy way to integrate your Golang Applications\nwith [FluxNinja Aperture](https://github.com/fluxninja/aperture). It allows flow\ncontrol functionality on fine-grained features inside service code.\n\nRefer [documentation](https://docs.fluxninja.com/sdk/go/) for more details.\n\n## Usage\n\nRun the command below to install the SDK:\n\n```bash\ngo get github.com/fluxninja/aperture-go/v2\n```\n\n### ApertureClient Interface\n\nThe next step is to create an Aperture Client instance, for which, the address\nof the organization created in Aperture Cloud and API key are needed. You can\nlocate both these details by clicking on the Aperture tab in the sidebar menu of\nAperture Cloud.\n\n`ApertureClient` maintains a gRPC connection with Aperture Agent.\n\n```go\noptions := aperture.Options{\n   DialOptions: grpcOptions,\n   Address:     \"ORGANIZATION.app.fluxninja.com\",\n   APIKey: \"API_KEY\",\n}\n\n// initialize Aperture Client with the provided options.\napertureClient, err := aperture.NewClient(options)\nif err != nil {\n   log.Fatalf(\"failed to create client: %v\", err)\n}\n```\n\n### HTTP Middleware\n\n`aperture-go` provides an HTTP middleware to be used with routers.\n\n```go\n// Create a new mux router\nrouter := mux.NewRouter()\n\nsuperRouter := mux.PathPrefix(\"/super\").Subrouter()\nsuperRouter.HandleFunc(\"\", a.SuperHandler)\n\nsuperRouter.Use(aperturegomiddleware.NewHTTPMiddleware(apertureClient, \"awesomeFeature\", nil, nil, false, 2000*time.Millisecond).Handle)\n```\n\n### gRPC Unary Interceptor\n\n`aperture-go` provides a gRPC unary interceptor to be used with gRPC clients.\n\n```go\n// Create a new gRPC interceptor\ninterceptor := aperturegomiddleware.NewGRPCUnaryInterceptor(apertureClient, \"awesomeFeature\", nil, false, 2000*time.Millisecond)\n\n// Create a new gRPC server\ns := grpc.NewServer(grpc.UnaryInterceptor(interceptor))\n```\n\n### Flow Interface\n\n`Flow` is created every time `ApertureClient.StartFlow` is called.\n\n```go\n// StartFlow performs a flowcontrolv1.Check call to Aperture Agent. It returns a Flow object.\nflow := apertureClient.StartFlow(ctx, \"awesomeFeature\", labels, false, 200 * time.Millisecond)\n\n// See whether flow was accepted by Aperture Agent.\nif flow.ShouldRun() {\n   // Simulate work being done\n   time.Sleep(5 * time.Second)\n} else {\n   // Flow has been rejected by Aperture Agent.\n   flow.SetStatus(aperture.Error)\n}\n\n// Need to call End() on the Flow in order to provide telemetry to Aperture Agent for completing the control loop. SetStatus() method of Flow object can be used to capture whether the Flow was successful or resulted in an error. If not set, status defaults to OK.\n_ = flow.End()\n```\n\n## Relevant Resources\n\n[FluxNinja Aperture](https://github.com/fluxninja/aperture)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluxninja%2Faperture-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffluxninja%2Faperture-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluxninja%2Faperture-go/lists"}