-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
normalize attributes in different spans and update todos
- Loading branch information
1 parent
c98bf2c
commit 652e8c9
Showing
12 changed files
with
107 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,44 @@ | ||
# TODO | ||
|
||
- **we are reporting the size and time in `io.instruments.go` as both a counter and a histogram** | ||
(count can be extracted from histogram in all "backends": prometheus, datadog, new relic, etc..?) | ||
|
||
- allow different formats for the propagation of the trace (the `TextMapPropagator`) | ||
in [endpoint.go](../router/gin/endpoint.go). | ||
|
||
- review how we pass the state. | ||
|
||
- we cannot use `skipPaths` with the same value that we have to define the endpoints | ||
at the global layer, because we cannot know the matched pattern | ||
|
||
- clean shutdown | ||
|
||
- add configuration options to allow to use grpc credentials | ||
|
||
- allow to tweak the `bucket` limits for different histograms (like | ||
latency and size) | ||
- `http/client/transport_metrics.go`: `timeBucketsOpt`, `sizeBucketsOpt` | ||
- `http/server/metrics.go`: `timeBucketsOpt`, `sizeBucketsOpt` | ||
- `io/instrumens.go`: `timeBucketsOpt`, `sizeBucketsOpt` | ||
|
||
# TO DECIDE | ||
|
||
- do we want to have the `service_name` to override the global ServiceConfig name for | ||
the KrakenD gateway ? | ||
|
||
- in `exporter/prometheus/prometheus.go` we could add a config option that will | ||
add a prefix to all reported metrics (using the `WithNamespace` option). | ||
|
||
- in `lura/backend.go` and `lura/proxy.go` we are setting the static attrs, | ||
and using `semconv.ServerAddress`, to set the concatenated list of hosts. | ||
Is that something that we want ? | ||
|
||
# TO CHECK | ||
|
||
- in `exporter/otelcollector/otelcollector.go`, the `WithEndpoint` states that | ||
**no http** schema should be in cluded (nor path). To use `http` reporting methods, | ||
the `WithInsecure` option should be used (and to user a path `WithURLPath`). | ||
Check that current implementation works as expected, or fix it. | ||
|
||
- in `http/client/transport.go` we have commented out the `StartOptions` for | ||
trace: review if would be useful to expose that in the config. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package lura | ||
|
||
import ( | ||
"sort" | ||
"strings" | ||
|
||
"go.opentelemetry.io/otel/attribute" | ||
"go.opentelemetry.io/otel/semconv/v1.21.0" | ||
|
||
"github.com/luraproject/lura/v2/config" | ||
|
||
kotelconfig "github.com/krakend/krakend-otel/config" | ||
) | ||
|
||
// backendConfigAttributes returnsa list of attributes | ||
// that will be set for both traces and | ||
// metrics, as those are expected to have low cardinality | ||
// - the method: one of the `GET`, `POST`, `PUT` .. etc | ||
// - the "path" , that is actually the path "template" to not have different values | ||
// for different params but the same endpoint. | ||
// - the krakend stage, that can be one of | ||
// - router: includes from the very point of receiving a request until | ||
// a response is returned to the client. | ||
// - pipe: includes all the processing that is performed | ||
// for the endpoint part of a request (like merging and grouping | ||
// responses from different backends). | ||
// - backend: includes all middlewares and processing that is done for | ||
// a given backend. | ||
// - backend-request: when reporting the request to the backends | ||
// - server address: the host for the request | ||
func backendConfigAttributes(cfg *config.Backend, stage string) []attribute.KeyValue { | ||
|
||
urlPattern := kotelconfig.NormalizeURLPattern(cfg.URLPattern) | ||
parentEndpoint := kotelconfig.NormalizeURLPattern(cfg.ParentEndpoint) | ||
|
||
attrs := []attribute.KeyValue{ | ||
semconv.HTTPRequestMethodOriginal(cfg.Method), | ||
semconv.URLPath(urlPattern), // <- for traces we can use URLFull to not have the matched path | ||
attribute.String("krakend.stage", stage), | ||
attribute.String("krakend.endpoint", parentEndpoint), | ||
} | ||
numHosts := len(cfg.Host) | ||
if numHosts > 0 { | ||
if numHosts == 1 { | ||
attrs = append(attrs, semconv.ServerAddress(cfg.Host[0])) | ||
} else { | ||
hosts := make([]string, 0, numHosts) | ||
copy(hosts, cfg.Host) | ||
sort.StringSlice(hosts).Sort() | ||
strHosts := strings.Join(hosts, "_") | ||
attrs = append(attrs, semconv.ServerAddress(strHosts)) | ||
} | ||
} | ||
|
||
return attrs | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters