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/monitoring-service-health/page.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
# Monitoring Service Health
2
+
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.
2
3
3
-
As there can be multiple service, they need to be checked if they are UP or not.
4
-
GoFr registers two endpoints by default which are :
4
+
## GoFr by default registers two endpoints which are :
5
5
6
-
1. Aliveness - /.well-known/alive
6
+
### 1. Aliveness - /.well-known/alive
7
7
8
8
It is an endpoint which return the following response when the service is UP with a 200 response code.
9
9
```json
@@ -24,7 +24,7 @@ To override the endpoint when registering HTTP Service pass the following option
24
24
}
25
25
```
26
26
27
-
2. Health-Check - /.well-known/health-check
27
+
### 2. Health-Check - /.well-known/health-check
28
28
29
29
It returns if the service is UP or DOWN along with stats, host, status about the dependent datasources and services.
Copy file name to clipboardExpand all lines: docs/advanced-guide/publishing-custom-metrics/page.md
+19-3Lines changed: 19 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,17 @@
1
1
# Publishing Custom Metrics
2
2
3
3
For GoFr default metrics refer: [observability](/docs/quick-start/observability).
4
-
If there is a requirement of a metric other than the GoFr defaults, you can create them using custom metrics as shown below.
5
4
6
-
GoFr supports the following [metric](https://opentelemetry.io/docs/specs/otel/metrics/) types in prometheus format:
5
+
GoFr can handle multiple different metrics concurrently, each uniquely identified by its name during initialization.
6
+
It supports the following [metrics](https://opentelemetry.io/docs/specs/otel/metrics/) types in prometheus format:
7
7
8
8
1. Counter
9
9
2. UpDownCounter
10
10
3. Histogram
11
11
4. Gauge
12
12
13
-
GoFr is capable of handling multiple Counter, UpDownCounter, Histogram, and Gauge metrics concurrently, each uniquely identified by its name during initialization.
13
+
If any metric other than defaults provided, you can create them using custom metrics as shown below.
14
+
14
15
15
16
## Usage
16
17
@@ -136,3 +137,18 @@ func main() {
136
137
app.Run()
137
138
}
138
139
```
140
+
141
+
**Good To Know**
142
+
```doc
143
+
While registering a metrics two key pieces of information of required
144
+
- Name
145
+
- Description
146
+
147
+
When a registered Metrics has to be used 3 key pieces of information are required:
148
+
- Metrics name
149
+
- Value
150
+
- A set of key-value pairs called tags or labels.
151
+
152
+
A permutation of these key-value values provides the metric cardinality.
153
+
Lower the cardinality, faster the query performance and lower the monitoring resource utilisation.
Copy file name to clipboardExpand all lines: docs/advanced-guide/remote-log-level-change/page.md
+13-10Lines changed: 13 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,19 @@
1
1
# Remote Log Level Change
2
-
Gofr makes it easy to adjust the detail captured in your application's logs, even while it's running! This feature empowers
3
-
users to effortlessly fine-tune logging levels without the need for redeployment, enhancing the monitoring and debugging experience.
4
-
This feature is facilitated through simple configuration settings.
2
+
Gofr makes it easy to adjust the detail captured in your application's logs, even while it's running!
5
3
6
-
## Why it is important?
7
-
-**Effortless Adjustments:** Modify the level of detail in your logs anytime without restarting your application.
8
-
This is especially helpful during troubleshooting or when log volume needs to be adjusted based on the situation.
9
-
-**Enhanced Visibility:** Easily switch to a more detailed log level (e.g., `DEBUG`) to gain deeper insights into specific issues,
10
-
and then switch back to a less detailed level (e.g., `INFO`) for regular operation.
4
+
This feature allows users to effortlessly fine-tune logging levels without the need for redeployment, enhancing the monitoring and debugging experience.
5
+
It is facilitated through simple configuration settings.
6
+
7
+
## How it helps?
8
+
-**Effortless Adjustments:** Modify the level of detail in your logs anytime without restarting your application.
9
+
This is especially helpful during troubleshooting.
10
+
-**Enhanced Visibility:** Easily switch to a more detailed log level (e.g., `DEBUG`) to gain deeper insights into specific issues,
11
+
and then switch back to a less detailed level (e.g., `INFO`) for regular operation.
12
+
-**Improved Performance:** Generating a large number of logs can overwhelm the logging system, leading to increased I/O operations and resource consumption,
13
+
changing to Warn or Error Level reduces the number of logs, and enhancing performance.
11
14
12
15
## Configuration
13
-
To enable remote log level updating, users need to specify the following configuration parameter:
16
+
To enable remote log level update, users need to specify the following configuration parameter:
14
17
15
18
```dotenv
16
19
REMOTE_LOG_URL=<URL to your remote log level endpoint> (e.g., https://your-service.com/log-levels)
@@ -40,7 +43,7 @@ The remote log level endpoint should return a JSON response in the following for
40
43
-**logLevel:** The new log level you want to set for the specified service.
41
44
42
45
43
-
GoFr parses this response and dynamically adjusts log levels according to the provided configurations.
46
+
GoFr parses this response and adjusts log levels based on the provided configurations.
Copy file name to clipboardExpand all lines: docs/quick-start/configuration/page.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ GoFr reads configuration via environment variables. It provides an easy way to m
4
4
5
5
Configs in GoFr can be used to initialise datasources, tracing. In doing so it abstract the logic and gives an easy interface to setup different things.
6
6
7
-
To set configs create a `configs`folder in the project's root and add `.env` file.
7
+
To set configs create a `configs`directory in the project's root and add `.env` file.
8
8
9
9
By default, GoFr starts HTTP server at port 8000, in order to change that we can add the config `HTTP_PORT`
10
10
Similarly to Set the app-name you can add `APP_NAME`. For example:
Copy file name to clipboardExpand all lines: docs/quick-start/introduction/page.md
+11-10Lines changed: 11 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,9 @@
1
1
# Prerequisite
2
2
3
-
- Install or update [Go](https://go.dev/dl/).
3
+
- Go 1.19 or above.
4
+
To check the version use the following command `go version`.
4
5
5
-
To check the version use the following command `go version`.
6
-
7
-
- Prior familiarity with Golang syntax is essential. [Golang Tour](https://tour.golang.org/) is highly recommended as it has an excellent guided tour.
6
+
- Prior familiarity with Golang syntax is essential. [Golang Tour](https://tour.golang.org/) is highly recommended as it has an excellent guided tour.
8
7
9
8
## Write your first GoFr API
10
9
@@ -45,7 +44,7 @@ func main() {
45
44
}
46
45
```
47
46
48
-
Before running the server run the following command to go needs to download and sync the required modules.
47
+
Before running the server run the following go command to download and sync the required modules.
49
48
50
49
`go mod tidy`
51
50
@@ -69,20 +68,22 @@ The `hello-world` server involves three essential steps:
69
68
70
69
_This single line is a standard part of all gofr-based servers._
71
70
71
+
72
72
2.**Attaching a Handler to a Path:**
73
73
74
74
In this step, we instruct the server to associate an HTTP request with a specific handler function. This is achieved through `app.GET("/greet", HandlerFunction)`, where _GET /hello_ maps to HandlerFunction. Likewise, `app.POST("/todo", ToDoCreationHandler)` links a _POST_ request to the /todo endpoint with _ToDoCreationHandler_.
75
75
76
+
76
77
**Good To Know**
77
78
78
-
In Go, functions are first-class citizens, allowing easy handler definition and reference.
79
-
Handler functions should follow the `func(ctx *gofr.Context) (interface{}, error)` signature.
80
-
They take a context as input, returning two values: the response data and an error (set to `nil`on success).
79
+
> In Go, functions are first-class citizens, allowing easy handler definition and reference.
80
+
HTTP Handler functions should follow the `func(ctx *gofr.Context) (interface{}, error)` signature.
81
+
They take a context as input, returning two values: the response data and an error (set to `nil`when there is no error).
81
82
82
83
In GoFr `ctx *gofr.Context` serves as a wrapper for requests, responses, and dependencies, providing various functionalities.
83
84
84
-
For more details about context, refer [here](/docs/v1/references/context).
85
+
For more details about context, refer [here](/docs/references/context).
85
86
86
87
3.**Starting the server**
87
88
88
-
When `app.Run()` is called, it configures ,initiates and runs the HTTP server, middlewares based on provided configs. It manages essential features such as routes for health checks, swagger UI etc. It starts the server on the default port 8000.
89
+
When `app.Run()` is called, it configures ,initiates and runs the HTTP server, middlewares. It manages essential features such as routes for health check endpoints, metrics server, favicon etc. It starts the server on the default port 8000.
0 commit comments