You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/advanced-guide/circuit-breaker/page.md
-2Lines changed: 0 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,5 +42,3 @@ func main() {
42
42
43
43
Circuit breaker state changes to open when number of consecutive failed requests increases the threshold.
44
44
When it is in open state, GoFr makes request to the aliveness endpoint (default being - /.well-known/alive) at an equal interval of time provided in config.
45
-
46
-
To override the default aliveness endpoint {% new-tab-link newtab=false title="refer" href="/docs/advanced-guide/monitoring-service-health" /%}.
It involves sending the prefix `Basic` trailed by the Base64-encoded `<username>:<password>` within the standard `Authorization` header.
16
16
17
17
### Basic Authentication in GoFr
18
18
19
19
GoFr offers two ways to implement basic authentication:
20
20
21
21
**1. Predefined Credentials**
22
22
23
-
Use `EnableBasicAuth(username, password)` to configure Gofr with pre-defined credentials.
23
+
Use `EnableBasicAuth(username, password)` to configure GoFr with pre-defined credentials.
24
24
25
25
```go
26
26
funcmain() {
@@ -39,7 +39,8 @@ func main() {
39
39
40
40
**2. Custom Validation Function**
41
41
42
-
Use `EnableBasicAuthWithFunc(validationFunc)` to implement your own validation logic for credentials. The `validationFunc` takes the username and password as arguments and returns true if valid, false otherwise.
42
+
Use `EnableBasicAuthWithFunc(validationFunc)` to implement your own validation logic for credentials.
43
+
The `validationFunc` takes the username and password as arguments and returns true if valid, false otherwise.
This code snippet demonstrates how to add basic authentication to an HTTP service in GoFr and make a request with the appropriate Authorization header:
Users include a unique API key in the request header for validation against a store of authorized keys.
76
+
*API Key Authentication* is an HTTP authentication scheme where a unique API key is included in the request header for validation against a store of authorized keys.
77
77
78
78
### Usage:
79
79
GoFr offers two ways to implement API Keys authentication.
80
80
81
81
**1. Framework Default Validation**
82
-
-Users can select the framework's default validation using **_EnableAPIKeyAuth(apiKeys ...string)_**
82
+
-GoFr's default validation can be selected using **_EnableAPIKeyAuth(apiKeys ...string)_**
83
83
84
84
```go
85
85
package main
@@ -97,7 +97,7 @@ func main() {
97
97
```
98
98
99
99
**2. Custom Validation Function**
100
-
-Users can create their own validator function `apiKeyValidator(apiKey string) bool` for validating APIKeys and pass the func in **_EnableAPIKeyAuthWithFunc(validator)_**
100
+
-GoFr allows a custom validator function `apiKeyValidator(apiKey string) bool` for validating APIKeys and pass the func in **_EnableAPIKeyAuthWithFunc(validator)_**
OAuth 2.0 is the industry-standard protocol for authorization.
131
+
{% new-tab-link title="OAuth" href="https://www.rfc-editor.org/rfc/rfc6749" /%} 2.0 is the industry-standard protocol for authorization.
132
132
It focuses on client developer simplicity while providing specific authorization flows for web applications, desktop applications, mobile phones, and living room devices.
133
-
To know more about it refer {% new-tab-link title="here" href="https://www.rfc-editor.org/rfc/rfc6749" /%}
134
133
135
-
It involves sending the term`Bearer` trailed by the encoded token within the standard `Authorization` header.
134
+
It involves sending the prefix`Bearer` trailed by the encoded token within the standard `Authorization` header.
Enable OAuth 2.0 with three-legged flow to authenticate requests
143
142
144
-
Use `EnableOAuth(jwks-endpoint,refresh_interval)` to configure Gofr with pre-defined credentials.
143
+
Use `EnableOAuth(jwks-endpoint,refresh_interval)` to configure GoFr with pre-defined credentials.
145
144
146
145
```go
147
146
funcmain() {
@@ -163,17 +162,17 @@ For server-to-server communication it follows two-legged OAuth, also known as "c
163
162
where the client application directly exchanges its own credentials (ClientID and ClientSecret)
164
163
for an access token without involving any end-user interaction.
165
164
166
-
This code snippet demonstrates how two-legged OAuth authentication is added to an HTTP service in GoFr and make a request with the appropriate Authorization header.
165
+
This code snippet demonstrates how two-legged OAuth authentication is added to an HTTP service in GoFr and make a request with the appropriate Authorization header:
Copy file name to clipboardExpand all lines: docs/advanced-guide/monitoring-service-health/page.md
+9-8Lines changed: 9 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,15 @@
1
1
# Monitoring Service Health
2
2
3
-
Health check in microservices refers to a mechanism or process implemented within each service to assess its operational status and readiness to handle requests. It involves regularly querying the service to determine if it is functioning correctly, typically by evaluating its responsiveness and ability to perform essential tasks. Health checks play a critical role in ensuring service availability, detecting failures, preventing cascading issues, and facilitating effective traffic routing in distributed systems.
3
+
Health check in microservices refers to a mechanism or process implemented within each service to assess its operational status
4
+
and readiness to handle requests. It involves regularly querying the service to determine if it is functioning correctly,
5
+
typically by evaluating its responsiveness and ability to perform essential tasks. Health checks play a critical role in ensuring service availability,
6
+
detecting failures, preventing cascading issues, and facilitating effective traffic routing in distributed systems.
4
7
5
-
## GoFr by default registers two endpoints which are:
8
+
## GoFr by default registers two endpoints which are:
6
9
7
10
### 1. Aliveness - /.well-known/alive
8
11
9
-
It is an endpoint which return the following response when the service is UP with a 200 response code.
12
+
It is an endpoint which returns the following response with a 200 status code, when the service is UP.
10
13
11
14
```json
12
15
{
@@ -18,8 +21,7 @@ It is an endpoint which return the following response when the service is UP wit
18
21
19
22
It is also used when state of {% new-tab-link newtab=false title="circuit breaker" href="/docs/advanced-guide/circuit-breaker" /%} is open.
20
23
21
-
To override the endpoint when registering HTTP Service pass the following option.
22
-
24
+
To override this endpoint, pass the following option while registering HTTP Service:
23
25
```go
24
26
&service.HealthConfig{
25
27
HealthEndpoint: "breeds",
@@ -28,10 +30,9 @@ To override the endpoint when registering HTTP Service pass the following option
28
30
29
31
### 2. Health-Check - /.well-known/health-check
30
32
31
-
It returns if the service is UP or DOWN along with stats, host, status about the dependent datasources and services.
32
-
33
-
Sample response of how it appears when all the services, and connected data sources are up.
33
+
It is an endpoint which returns whether the service is UP or DOWN along with stats, host, status about the dependent datasources and services.
34
34
35
+
Sample response of how it appears when all the services, and connected data sources are UP:
GoFr publishes some {% new-tab-link newtab=false title="default metrics" href="/docs/quick-start/observability" /%}.
4
4
5
5
GoFr can handle multiple different metrics concurrently, each uniquely identified by its name during initialization.
6
6
It supports the following {% new-tab-link title="metrics" href="https://opentelemetry.io/docs/specs/otel/metrics/" /%} types in prometheus format:
@@ -10,7 +10,7 @@ It supports the following {% new-tab-link title="metrics" href="https://opentele
10
10
3. Histogram
11
11
4. Gauge
12
12
13
-
If any metric other than defaults provided, you can create them using custom metrics as shown below.
13
+
If any custom metric is required, it can be created by using custom metrics as shown below:
14
14
15
15
## Usage
16
16
@@ -46,7 +46,7 @@ func main() {
46
46
## 2. UpDown Counter Metrics
47
47
48
48
UpDownCounter is a {% new-tab-link title="synchronous Instrument" href="https://opentelemetry.io/docs/specs/otel/metrics/api/#synchronous-instrument-api" /%} which supports increments and decrements.
49
-
Note: if the value is monotonically increasing, use Counter instead.
49
+
Note: If the value is monotonically increasing, use Counter instead.
50
50
51
51
### Usage
52
52
@@ -75,7 +75,8 @@ func main() {
75
75
76
76
## 3. Histogram Metrics
77
77
78
-
Histogram is a {% new-tab-link title="synchronous Instrument" href="https://opentelemetry.io/docs/specs/otel/metrics/api/#synchronous-instrument-api" /%} which can be used to report arbitrary values that are likely to be statistically meaningful. It is intended for statistics such as histograms, summaries, and percentile.
78
+
Histogram is a {% new-tab-link title="synchronous Instrument" href="https://opentelemetry.io/docs/specs/otel/metrics/api/#synchronous-instrument-api" /%} which can be used to
79
+
report arbitrary values that are likely to be statistically meaningful. It is intended for statistics such as histograms, summaries, and percentile.
79
80
80
81
### Usage
81
82
@@ -141,12 +142,12 @@ func main() {
141
142
**Good To Know**
142
143
143
144
```doc
144
-
While registering a metrics two key pieces of information of required
145
+
While registering a metrics 2 key pieces of information of required:
145
146
- Name
146
147
- Description
147
148
148
-
When a registered Metrics has to be used 3 key pieces of information are required:
149
-
- Metrics name
149
+
When a registered metrics has to be used 3 key pieces of information are required:
Copy file name to clipboardExpand all lines: docs/quick-start/introduction/page.md
+1-3Lines changed: 1 addition & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,9 +77,7 @@ The `hello-world` server involves three essential steps:
77
77
> HTTP Handler functions should follow the `func(ctx *gofr.Context) (interface{}, error)` signature.
78
78
> They take a context as input, returning two values: the response data and an error (set to `nil` when there is no error).
79
79
80
-
In GoFr `ctx *gofr.Context` serves as a wrapper for requests, responses, and dependencies, providing various functionalities.
81
-
82
-
For more details about context, refer {% new-tab-link newtab=false title="here" href="/docs/references/context" /%}.
80
+
GoFr {% new-tab-link newtab=false title="context" href="/docs/references/context" /%} `ctx *gofr.Context` serves as a wrapper for requests, responses, and dependencies, providing various functionalities.
0 commit comments