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
GoFr leverages metrics support by enabling labels. Labels are a key feature in metrics that allow you to categorize and filter metrics based on relevant information.
145
+
146
+
### Understanding Labels
147
+
148
+
Labels are key-value pairs attached to metrics. They provide additional context about the metric data.
149
+
150
+
Common examples of labels include:
151
+
- environment: (e.g., "production", "staging")
152
+
- service: (e.g., "api-gateway", "database")
153
+
- status: (e.g., "success", "failure")
154
+
155
+
By adding labels, you can create different time series for the same metric based on the label values.
156
+
This allows for more granular analysis and visualization in Grafana (or any other) dashboards.
157
+
158
+
### Additional Considerations
159
+
160
+
- Prefer to keep the number of labels manageable to avoid overwhelming complexity.
161
+
- Choose meaningful label names that clearly describe the data point.
162
+
- Ensure consistency in label naming conventions across your application.
163
+
164
+
By effectively using labels in GoFr, you can enrich your custom metrics and gain deeper insights into your application's performance and behavior.
165
+
166
+
### Usage:
167
+
168
+
Labels are added while populating the data for metrics, by passing them as arguments (comma separated key-value pairs)
169
+
in the GoFr's methods (namely: `IncreamentCounter`, `DeltaUpDownCounter`, `RecordHistogram`, `SetGauge`).
c.Metrics().DeltaUpDownCounter(c, "total_credit_day_sale", 10, "sale_type", "credit", "product_type", "beverage") // Here "sale_type" & "product_type" are the labels and "credit" & "beverage" are the values
0 commit comments