* Jaeger: Migrate Services and Operations to the gRPC Jaeger endpoint (#112384) * add grpc feature toggle * move types into types.go * creates grpc client functions for services and operations * Call grpc services function when feature flag is enabled for health check * remove unnecessary double encoding * check for successful status code before decoding response and return nil in case of successful response * remove duplicate code * use variable * fix error type in testsz * Jaeger: Migrate search and Trace Search calls to use gRPC endpoint (#112610) * move all types into types package except for JagerClient * move all helper functions into utils package * change return type of search function to be frames and add grpc search functionality * fix tests * fix types and the way we check error response from grpc * change trace name and duration unit conversion * fix types and add tests * support queryAttributes * quick limit implementation in post processing * add todo for attributes / tags * make trace functionality ready to support grpc flow * add functions to process search response for a specific trace and create the Trace frame * tests for helper funtions * remove grpc querying for now! * change logic to be able to process and support multiple resource spans * remove logic for gRPC from grpc_client.go * add equivalent fields for logs and references * add tests for grpcTraceResponse function * fix types after merge with main * fix status code checks and return nil for error on successful responses * enable reading through config flag for trace search * create sigle key value type since they are similar for OTLP and non OTLP based formats * reference right type * convert events and links into references and logs * add status code, status message and kind to data frame * fix tests to accomodate new format * remove unused function and add more tests * remove edit flag for jsonc golden test files * add clarifying comment * fix tests and linting * fix golden files for testing * fix typo Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix typo Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix typo Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * add clarifying comment Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * remove unnecessary logging statement * fix downstream errors --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * use downstreamerrorf where applicable and add missing downstream eror sources. * tests --------- Co-authored-by: ismail simsek <ismailsimsek09@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
103 lines
2.6 KiB
Go
103 lines
2.6 KiB
Go
package jaeger
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/grafana/grafana-plugin-sdk-go/experimental"
|
|
"github.com/grafana/grafana/pkg/tsdb/jaeger/types"
|
|
)
|
|
|
|
func TestTransformDependenciesResponse(t *testing.T) {
|
|
t.Run("simple_dependencies", func(t *testing.T) {
|
|
dependencies := types.DependenciesResponse{
|
|
Data: []types.ServiceDependency{
|
|
{
|
|
Parent: "serviceA",
|
|
Child: "serviceB",
|
|
CallCount: 1,
|
|
},
|
|
{
|
|
Parent: "serviceA",
|
|
Child: "serviceC",
|
|
CallCount: 2,
|
|
},
|
|
{
|
|
Parent: "serviceB",
|
|
Child: "serviceC",
|
|
CallCount: 3,
|
|
},
|
|
},
|
|
}
|
|
|
|
frames := transformDependenciesResponse(dependencies, "test")
|
|
experimental.CheckGoldenJSONFrame(t, "./testdata", "simple_dependencies_nodes.golden", frames[0], false)
|
|
experimental.CheckGoldenJSONFrame(t, "./testdata", "simple_dependencies_edges.golden", frames[1], false)
|
|
})
|
|
|
|
t.Run("empty_dependencies", func(t *testing.T) {
|
|
dependencies := types.DependenciesResponse{
|
|
Data: []types.ServiceDependency{},
|
|
}
|
|
|
|
frames := transformDependenciesResponse(dependencies, "test")
|
|
experimental.CheckGoldenJSONFrame(t, "./testdata", "empty_dependencies_nodes.golden", frames[0], false)
|
|
experimental.CheckGoldenJSONFrame(t, "./testdata", "empty_dependencies_edges.golden", frames[1], false)
|
|
})
|
|
|
|
t.Run("complex_dependencies", func(t *testing.T) {
|
|
dependencies := types.DependenciesResponse{
|
|
Data: []types.ServiceDependency{
|
|
{
|
|
Parent: "frontend",
|
|
Child: "auth-service",
|
|
CallCount: 150,
|
|
},
|
|
{
|
|
Parent: "frontend",
|
|
Child: "api-gateway",
|
|
CallCount: 300,
|
|
},
|
|
{
|
|
Parent: "api-gateway",
|
|
Child: "user-service",
|
|
CallCount: 200,
|
|
},
|
|
{
|
|
Parent: "api-gateway",
|
|
Child: "order-service",
|
|
CallCount: 100,
|
|
},
|
|
{
|
|
Parent: "order-service",
|
|
Child: "payment-service",
|
|
CallCount: 80,
|
|
},
|
|
{
|
|
Parent: "order-service",
|
|
Child: "inventory-service",
|
|
CallCount: 90,
|
|
},
|
|
{
|
|
Parent: "user-service",
|
|
Child: "database",
|
|
CallCount: 500,
|
|
},
|
|
{
|
|
Parent: "payment-service",
|
|
Child: "database",
|
|
CallCount: 200,
|
|
},
|
|
{
|
|
Parent: "inventory-service",
|
|
Child: "database",
|
|
CallCount: 300,
|
|
},
|
|
},
|
|
}
|
|
|
|
frames := transformDependenciesResponse(dependencies, "test")
|
|
experimental.CheckGoldenJSONFrame(t, "./testdata", "complex_dependencies_nodes.golden", frames[0], false)
|
|
experimental.CheckGoldenJSONFrame(t, "./testdata", "complex_dependencies_edges.golden", frames[1], false)
|
|
})
|
|
}
|