Skip to content

[TT-11389]: moved graphql span attributes#6088

Merged
kofoworola merged 5 commits into
masterfrom
fix/tt-11389/missing-attr-fail-req
Mar 7, 2024
Merged

[TT-11389]: moved graphql span attributes#6088
kofoworola merged 5 commits into
masterfrom
fix/tt-11389/missing-attr-fail-req

Conversation

@kofoworola

@kofoworola kofoworola commented Mar 4, 2024

Copy link
Copy Markdown
Contributor

User description

moved the document info attributes for graphql requests to the GraphqlMiddlewareValidation span

Description

Moved the graphql-specific span attributes higher up the span chain so they can still be seen in the event of a request failure when detailed tracing is turned on

TT-11389

Related Issue

Motivation and Context

How This Has Been Tested

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactoring or add test (improvements in base code or adds test coverage to functionality)

Checklist

  • I ensured that the documentation is up to date
  • I explained why this PR updates go.mod in detail with reasoning why it's required
  • I would like a code coverage CI quality gate exception and have explained why

Type

enhancement


Description

  • Added OpenTelemetry semantic conventions for GraphQL operation name, type, and document in ProcessAndStoreGraphQLRequest method to enhance tracing capabilities.
  • Refactored the way GraphQL operation type is determined and set on spans across different parts of the codebase.
  • Removed redundant span attributes setting in the ValidateForSchema method of the detailed GraphQL engine.

Changes walkthrough

Relevant files
Enhancement
engine_v2.go
Add OpenTelemetry Attributes for GraphQL Requests               

internal/graphengine/engine_v2.go

  • Added OpenTelemetry semantic conventions for GraphQL in
    ProcessAndStoreGraphQLRequest method.
  • Set attributes for GraphQL operation name, type, and document on the
    span.
  • +13/-0   
    otel_graphql_engine_basic.go
    Use PrintOperationType for Span Attributes                             

    internal/graphql/otel_graphql_engine_basic.go

  • Modified to use PrintOperationType for setting GraphQL operation type
    attribute on the span.
  • +1/-1     
    otel_graphql_engine_detailed.go
    Refactor Span Attributes Setting in GraphQL Engine             

    internal/graphql/otel_graphql_engine_detailed.go

  • Removed span attributes setting from ValidateForSchema method.
  • Exposed PrintOperationType function for external use.
  • +2/-15   

    PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    @kofoworola
    kofoworola requested review from buraksezer, pvormste and rhianeKobar and removed request for buraksezer March 4, 2024 09:09
    @github-actions

    github-actions Bot commented Mar 4, 2024

    Copy link
    Copy Markdown
    Contributor

    PR Description updated to latest commit (90f7569)

    @github-actions

    github-actions Bot commented Mar 4, 2024

    Copy link
    Copy Markdown
    Contributor

    API Changes

    no api changes detected

    @github-actions

    github-actions Bot commented Mar 4, 2024

    Copy link
    Copy Markdown
    Contributor

    PR Review

    ⏱️ Estimated effort to review [1-5]

    2, because the changes are focused on moving span attributes for better visibility in tracing, which involves understanding the tracing logic and ensuring the attributes are correctly set. The changes are not extensive but require careful review to ensure they don't introduce any issues with tracing functionality.

    🧪 Relevant tests

    No

    🔍 Possible issues

    Possible Bug: In the engine_v2.go file, the error from gqlRequest.OperationType() is logged but not handled in any way. This could potentially lead to setting incorrect attributes on the span if the operation type is essential for the tracing context.

    Consistency Issue: The PrintOperationType function is made public in otel_graphql_engine_detailed.go but is used in a different file otel_graphql_engine_basic.go. This could lead to potential issues if the function is modified for one use case but affects another unintentionally.

    🔒 Security concerns

    No

    Code feedback:
    relevant fileinternal/graphengine/engine_v2.go
    suggestion      

    Consider handling the error from gqlRequest.OperationType() more robustly. If the operation type is critical for the span attributes, you might want to abort setting the attributes or set a default value in case of an error. [important]

    relevant lineoperationType, err := gqlRequest.OperationType()

    relevant fileinternal/graphql/otel_graphql_engine_basic.go
    suggestion      

    Ensure that making PrintOperationType public and using it across different files does not lead to inconsistencies. Consider adding a comment or documentation indicating its shared use to prevent future accidental modifications that could affect its behavior in other parts of the code. [medium]

    relevant linesemconv.GraphQLOperationType(PrintOperationType(ast.OperationType(operationType))),

    relevant fileinternal/graphql/otel_graphql_engine_detailed.go
    suggestion      

    Since the validation error handling in ValidateForSchema method directly sets the span status and returns the error, ensure that this behavior is consistent with how errors are expected to be handled in the rest of your tracing logic. It might be beneficial to also log the error for better debugging. [medium]

    relevant lineerr := o.engine.ValidateForSchema(operation)


    ✨ Review tool usage guide:

    Overview:
    The review tool scans the PR code changes, and generates a PR review. The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on any PR.
    When commenting, to edit configurations related to the review tool (pr_reviewer section), use the following template:

    /review --pr_reviewer.some_config1=... --pr_reviewer.some_config2=...
    

    With a configuration file, use the following template:

    [pr_reviewer]
    some_config1=...
    some_config2=...
    
    Utilizing extra instructions

    The review tool can be configured with extra instructions, which can be used to guide the model to a feedback tailored to the needs of your project.

    Be specific, clear, and concise in the instructions. With extra instructions, you are the prompter. Specify the relevant sub-tool, and the relevant aspects of the PR that you want to emphasize.

    Examples for extra instructions:

    [pr_reviewer] # /review #
    extra_instructions="""
    In the 'possible issues' section, emphasize the following:
    - Does the code logic cover relevant edge cases?
    - Is the code logic clear and easy to understand?
    - Is the code logic efficient?
    ...
    """
    

    Use triple quotes to write multi-line instructions. Use bullet points to make the instructions more readable.

    How to enable\disable automation
    • When you first install PR-Agent app, the default mode for the review tool is:
    pr_commands = ["/review", ...]
    

    meaning the review tool will run automatically on every PR, with the default configuration.
    Edit this field to enable/disable the tool, or to change the used configurations

    Auto-labels

    The review tool can auto-generate two specific types of labels for a PR:

    • a possible security issue label, that detects possible security issues (enable_review_labels_security flag)
    • a Review effort [1-5]: x label, where x is the estimated effort to review the PR (enable_review_labels_effort flag)
    Extra sub-tools

    The review tool provides a collection of possible feedbacks about a PR.
    It is recommended to review the possible options, and choose the ones relevant for your use case.
    Some of the feature that are disabled by default are quite useful, and should be considered for enabling. For example:
    require_score_review, require_soc2_ticket, and more.

    Auto-approve PRs

    By invoking:

    /review auto_approve
    

    The tool will automatically approve the PR, and add a comment with the approval.

    To ensure safety, the auto-approval feature is disabled by default. To enable auto-approval, you need to actively set in a pre-defined configuration file the following:

    [pr_reviewer]
    enable_auto_approval = true
    

    (this specific flag cannot be set with a command line argument, only in the configuration file, committed to the repository)

    You can also enable auto-approval only if the PR meets certain requirements, such as that the estimated_review_effort is equal or below a certain threshold, by adjusting the flag:

    [pr_reviewer]
    maximal_review_effort = 5
    
    More PR-Agent commands

    To invoke the PR-Agent, add a comment using one of the following commands:

    • /review: Request a review of your Pull Request.
    • /describe: Update the PR title and description based on the contents of the PR.
    • /improve [--extended]: Suggest code improvements. Extended mode provides a higher quality feedback.
    • /ask <QUESTION>: Ask a question about the PR.
    • /update_changelog: Update the changelog based on the PR's contents.
    • /add_docs 💎: Generate docstring for new components introduced in the PR.
    • /generate_labels 💎: Generate labels for the PR based on the PR's contents.
    • /analyze 💎: Automatically analyzes the PR, and presents changes walkthrough for each component.

    See the tools guide for more details.
    To list the possible configuration parameters, add a /config comment.

    See the review usage page for a comprehensive guide on using this tool.

    @github-actions

    github-actions Bot commented Mar 4, 2024

    Copy link
    Copy Markdown
    Contributor

    PR Code Suggestions

    CategorySuggestions                                                                                                                                                       
    Enhancement
    Improve error handling for gqlRequest.OperationType().

    Consider handling the error from gqlRequest.OperationType() more robustly. Instead of just
    logging the error, it might be beneficial to also terminate the current function early or
    handle the error in a way that does not proceed with setting span attributes when
    operationType could be in an undefined state.

    internal/graphengine/engine_v2.go [220-222]

     operationType, err := gqlRequest.OperationType()
     if err != nil {
         e.logger.Debug("error while getting operation type for trace", abstractlogger.Error(err))
    +    return // or handle error appropriately
     }
     
    Best practice
    Ensure consistent function naming conventions.

    Ensure consistency in function naming conventions. The function PrintOperationType is
    capitalized in one file, suggesting it's exported, but used in a context that seems
    internal. If this function is intended for use only within this package, consider renaming
    it to printOperationType to follow Go's convention for unexported functions.

    internal/graphql/otel_graphql_engine_basic.go [65]

    -semconv.GraphQLOperationType(PrintOperationType(ast.OperationType(operationType))),
    +semconv.GraphQLOperationType(printOperationType(ast.OperationType(operationType))),
     
    Check for cancelled context before starting a new span.

    It's good practice to check if the context from the request (r.Context()) is not already
    cancelled before starting a new span. This can save resources and avoid starting spans
    that will immediately be cancelled.

    internal/graphengine/engine_v2.go [217]

    +if r.Context().Err() != nil {
    +    return // or handle the cancelled context appropriately
    +}
     ctx, span := e.OpenTelemetry.TracerProvider.Tracer().Start(r.Context(), "GraphqlMiddleware Validation")
     
    Possible issue
    Reconsider the removal of span attributes setting for detailed telemetry.

    The removal of setting span attributes after operation type retrieval in the detailed
    engine suggests a change in how errors or operation types are handled. Ensure that this
    change aligns with the intended telemetry and error handling strategy, as it reduces the
    granularity of telemetry data.

    internal/graphql/otel_graphql_engine_detailed.go [77]

    -err := o.engine.ValidateForSchema(operation)
    +operationType, err := operation.OperationType()
    +if err != nil {
    +    span.SetStatus(otel.SPAN_STATUS_ERROR, "request validation failed")
    +    return err
    +}
    +span.SetAttributes(
    +    semconv.GraphQLOperationName(operation.OperationName),
    +    semconv.GraphQLOperationType(PrintOperationType(ast.OperationType(operationType))),
    +    semconv.GraphQLDocument(operation.Query),
    +)
    +err = o.engine.ValidateForSchema(operation)
     
    Maintainability
    Move PrintOperationType to a shared location for reuse.

    Since PrintOperationType is now used across multiple files, consider moving this function
    to a more central location or package where it can be shared. This avoids duplication and
    keeps the operation type printing logic consistent across the application.

    internal/graphql/otel_graphql_engine_detailed.go [163]

    +// This function should be moved to a shared package
     func PrintOperationType(operationType ast.OperationType) string {
     

    ✨ Improve tool usage guide:

    Overview:
    The improve tool scans the PR code changes, and automatically generates suggestions for improving the PR code. The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on a PR.
    When commenting, to edit configurations related to the improve tool (pr_code_suggestions section), use the following template:

    /improve --pr_code_suggestions.some_config1=... --pr_code_suggestions.some_config2=...
    

    With a configuration file, use the following template:

    [pr_code_suggestions]
    some_config1=...
    some_config2=...
    
    Enabling\disabling automation

    When you first install the app, the default mode for the improve tool is:

    pr_commands = ["/improve --pr_code_suggestions.summarize=true", ...]
    

    meaning the improve tool will run automatically on every PR, with summarization enabled. Delete this line to disable the tool from running automatically.

    Utilizing extra instructions

    Extra instructions are very important for the improve tool, since they enable to guide the model to suggestions that are more relevant to the specific needs of the project.

    Be specific, clear, and concise in the instructions. With extra instructions, you are the prompter. Specify relevant aspects that you want the model to focus on.

    Examples for extra instructions:

    [pr_code_suggestions] # /improve #
    extra_instructions="""
    Emphasize the following aspects:
    - Does the code logic cover relevant edge cases?
    - Is the code logic clear and easy to understand?
    - Is the code logic efficient?
    ...
    """
    

    Use triple quotes to write multi-line instructions. Use bullet points to make the instructions more readable.

    A note on code suggestions quality
    • While the current AI for code is getting better and better (GPT-4), it's not flawless. Not all the suggestions will be perfect, and a user should not accept all of them automatically.
    • Suggestions are not meant to be simplistic. Instead, they aim to give deep feedback and raise questions, ideas and thoughts to the user, who can then use his judgment, experience, and understanding of the code base.
    • Recommended to use the 'extra_instructions' field to guide the model to suggestions that are more relevant to the specific needs of the project, or use the custom suggestions 💎 tool
    • With large PRs, best quality will be obtained by using 'improve --extended' mode.
    More PR-Agent commands

    To invoke the PR-Agent, add a comment using one of the following commands:

    • /review: Request a review of your Pull Request.
    • /describe: Update the PR title and description based on the contents of the PR.
    • /improve [--extended]: Suggest code improvements. Extended mode provides a higher quality feedback.
    • /ask <QUESTION>: Ask a question about the PR.
    • /update_changelog: Update the changelog based on the PR's contents.
    • /add_docs 💎: Generate docstring for new components introduced in the PR.
    • /generate_labels 💎: Generate labels for the PR based on the PR's contents.
    • /analyze 💎: Automatically analyzes the PR, and presents changes walkthrough for each component.

    See the tools guide for more details.
    To list the possible configuration parameters, add a /config comment.

    See the improve usage page for a more comprehensive guide on using this tool.

    @github-actions

    github-actions Bot commented Mar 4, 2024

    Copy link
    Copy Markdown
    Contributor

    💥 CI tests failed 🙈

    git-state

    diff --git a/internal/graphengine/engine_v2.go b/internal/graphengine/engine_v2.go
    index 7b5c8e3..173f860 100644
    --- a/internal/graphengine/engine_v2.go
    +++ b/internal/graphengine/engine_v2.go
    @@ -3,9 +3,10 @@ package graphengine
     import (
     	"context"
     	"errors"
    +	"net/http"
    +
     	"github.com/TykTechnologies/graphql-go-tools/pkg/ast"
     	semconv "github.com/TykTechnologies/opentelemetry/semconv/v1.0.0"
    -	"net/http"
     
     	"github.com/jensneuse/abstractlogger"
     	"github.com/sirupsen/logrus"

    Please look at the run or in the Checks tab.

    1 similar comment
    @github-actions

    github-actions Bot commented Mar 4, 2024

    Copy link
    Copy Markdown
    Contributor

    💥 CI tests failed 🙈

    git-state

    diff --git a/internal/graphengine/engine_v2.go b/internal/graphengine/engine_v2.go
    index 7b5c8e3..173f860 100644
    --- a/internal/graphengine/engine_v2.go
    +++ b/internal/graphengine/engine_v2.go
    @@ -3,9 +3,10 @@ package graphengine
     import (
     	"context"
     	"errors"
    +	"net/http"
    +
     	"github.com/TykTechnologies/graphql-go-tools/pkg/ast"
     	semconv "github.com/TykTechnologies/opentelemetry/semconv/v1.0.0"
    -	"net/http"
     
     	"github.com/jensneuse/abstractlogger"
     	"github.com/sirupsen/logrus"

    Please look at the run or in the Checks tab.

    @buger

    buger commented Mar 4, 2024

    Copy link
    Copy Markdown
    Member

    API tests result - postgres15-sha256 env: success
    Branch used: refs/heads/master
    Commit: 5ce6148 TT-11389: moved graphql span attributes (#6088)

    User description

    moved the document info attributes for graphql requests to the
    GraphqlMiddlewareValidation span

    Description

    Moved the graphql-specific span attributes higher up the span chain so
    they can still be seen in the event of a request failure when detailed
    tracing is turned on

    TT-11389

    Related Issue

    Motivation and Context

    How This Has Been Tested

    Screenshots (if appropriate)

    Types of changes

    • Bug fix (non-breaking change which fixes an issue)
    • New feature (non-breaking change which adds functionality)
    • Breaking change (fix or feature that would cause existing
      functionality to change)
    • Refactoring or add test (improvements in base code or adds test
      coverage to functionality)

    Checklist

    • I ensured that the documentation is up to date
    • I explained why this PR updates go.mod in detail with reasoning
      why it's required
    • I would like a code coverage CI quality gate exception and have
      explained why

    Type

    enhancement


    Description

    • Added OpenTelemetry semantic conventions for GraphQL operation name,
      type, and document in ProcessAndStoreGraphQLRequest method to enhance
      tracing capabilities.
    • Refactored the way GraphQL operation type is determined and set on
      spans across different parts of the codebase.
    • Removed redundant span attributes setting in the ValidateForSchema
      method of the detailed GraphQL engine.

    Changes walkthrough

    Relevant files
    Enhancement
    engine_v2.go
    Add OpenTelemetry Attributes for GraphQL Requests               

    internal/graphengine/engine_v2.go

  • Added OpenTelemetry semantic conventions for GraphQL in
    ProcessAndStoreGraphQLRequest method.
  • Set attributes for GraphQL operation name, type, and document on the
    span.
  • +13/-0   
    otel_graphql_engine_basic.go
    Use PrintOperationType for Span Attributes                             

    internal/graphql/otel_graphql_engine_basic.go

  • Modified to use PrintOperationType for setting GraphQL operation type
    attribute on the span.
  • +1/-1     
    otel_graphql_engine_detailed.go
    Refactor Span Attributes Setting in GraphQL Engine             

    internal/graphql/otel_graphql_engine_detailed.go

  • Removed span attributes setting from ValidateForSchema method.
  • Exposed PrintOperationType function for external use.
  • +2/-15   

    PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools
    and their descriptions
    Triggered by: push (@kofoworola)
    Execution page

    @buger

    buger commented Mar 4, 2024

    Copy link
    Copy Markdown
    Member

    API tests result - mongo44-sha256 env: success
    Branch used: refs/heads/master
    Commit: 5ce6148 TT-11389: moved graphql span attributes (#6088)

    User description

    moved the document info attributes for graphql requests to the
    GraphqlMiddlewareValidation span

    Description

    Moved the graphql-specific span attributes higher up the span chain so
    they can still be seen in the event of a request failure when detailed
    tracing is turned on

    TT-11389

    Related Issue

    Motivation and Context

    How This Has Been Tested

    Screenshots (if appropriate)

    Types of changes

    • Bug fix (non-breaking change which fixes an issue)
    • New feature (non-breaking change which adds functionality)
    • Breaking change (fix or feature that would cause existing
      functionality to change)
    • Refactoring or add test (improvements in base code or adds test
      coverage to functionality)

    Checklist

    • I ensured that the documentation is up to date
    • I explained why this PR updates go.mod in detail with reasoning
      why it's required
    • I would like a code coverage CI quality gate exception and have
      explained why

    Type

    enhancement


    Description

    • Added OpenTelemetry semantic conventions for GraphQL operation name,
      type, and document in ProcessAndStoreGraphQLRequest method to enhance
      tracing capabilities.
    • Refactored the way GraphQL operation type is determined and set on
      spans across different parts of the codebase.
    • Removed redundant span attributes setting in the ValidateForSchema
      method of the detailed GraphQL engine.

    Changes walkthrough

    Relevant files
    Enhancement
    engine_v2.go
    Add OpenTelemetry Attributes for GraphQL Requests               

    internal/graphengine/engine_v2.go

  • Added OpenTelemetry semantic conventions for GraphQL in
    ProcessAndStoreGraphQLRequest method.
  • Set attributes for GraphQL operation name, type, and document on the
    span.
  • +13/-0   
    otel_graphql_engine_basic.go
    Use PrintOperationType for Span Attributes                             

    internal/graphql/otel_graphql_engine_basic.go

  • Modified to use PrintOperationType for setting GraphQL operation type
    attribute on the span.
  • +1/-1     
    otel_graphql_engine_detailed.go
    Refactor Span Attributes Setting in GraphQL Engine             

    internal/graphql/otel_graphql_engine_detailed.go

  • Removed span attributes setting from ValidateForSchema method.
  • Exposed PrintOperationType function for external use.
  • +2/-15   

    PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools
    and their descriptions
    Triggered by: push (@kofoworola)
    Execution page

    @kofoworola
    kofoworola force-pushed the fix/tt-11389/missing-attr-fail-req branch from 90f7569 to a4f5916 Compare March 5, 2024 09:22
    @kofoworola
    kofoworola requested a review from a team as a code owner March 5, 2024 09:22
    @github-actions

    github-actions Bot commented Mar 5, 2024

    Copy link
    Copy Markdown
    Contributor

    💥 CI tests failed 🙈

    git-state

    diff --git a/internal/graphengine/engine_v2.go b/internal/graphengine/engine_v2.go
    index 7b5c8e3..173f860 100644
    --- a/internal/graphengine/engine_v2.go
    +++ b/internal/graphengine/engine_v2.go
    @@ -3,9 +3,10 @@ package graphengine
     import (
     	"context"
     	"errors"
    +	"net/http"
    +
     	"github.com/TykTechnologies/graphql-go-tools/pkg/ast"
     	semconv "github.com/TykTechnologies/opentelemetry/semconv/v1.0.0"
    -	"net/http"
     
     	"github.com/jensneuse/abstractlogger"
     	"github.com/sirupsen/logrus"

    Please look at the run or in the Checks tab.

    @kofoworola
    kofoworola force-pushed the fix/tt-11389/missing-attr-fail-req branch from a4f5916 to 34c8882 Compare March 5, 2024 15:04
    @github-actions

    github-actions Bot commented Mar 5, 2024

    Copy link
    Copy Markdown
    Contributor

    💥 CI tests failed 🙈

    git-state

    diff --git a/internal/graphengine/engine_v2.go b/internal/graphengine/engine_v2.go
    index 7b5c8e3..173f860 100644
    --- a/internal/graphengine/engine_v2.go
    +++ b/internal/graphengine/engine_v2.go
    @@ -3,9 +3,10 @@ package graphengine
     import (
     	"context"
     	"errors"
    +	"net/http"
    +
     	"github.com/TykTechnologies/graphql-go-tools/pkg/ast"
     	semconv "github.com/TykTechnologies/opentelemetry/semconv/v1.0.0"
    -	"net/http"
     
     	"github.com/jensneuse/abstractlogger"
     	"github.com/sirupsen/logrus"

    Please look at the run or in the Checks tab.

    1 similar comment
    @github-actions

    github-actions Bot commented Mar 5, 2024

    Copy link
    Copy Markdown
    Contributor

    💥 CI tests failed 🙈

    git-state

    diff --git a/internal/graphengine/engine_v2.go b/internal/graphengine/engine_v2.go
    index 7b5c8e3..173f860 100644
    --- a/internal/graphengine/engine_v2.go
    +++ b/internal/graphengine/engine_v2.go
    @@ -3,9 +3,10 @@ package graphengine
     import (
     	"context"
     	"errors"
    +	"net/http"
    +
     	"github.com/TykTechnologies/graphql-go-tools/pkg/ast"
     	semconv "github.com/TykTechnologies/opentelemetry/semconv/v1.0.0"
    -	"net/http"
     
     	"github.com/jensneuse/abstractlogger"
     	"github.com/sirupsen/logrus"

    Please look at the run or in the Checks tab.

    Comment thread internal/graphengine/engine_v2.go Outdated
    @kofoworola
    kofoworola force-pushed the fix/tt-11389/missing-attr-fail-req branch from 34c8882 to 4d40caa Compare March 6, 2024 11:03
    @kofoworola
    kofoworola requested a review from buraksezer March 6, 2024 11:04
    @github-actions

    github-actions Bot commented Mar 6, 2024

    Copy link
    Copy Markdown
    Contributor

    💥 CI tests failed 🙈

    git-state

    diff --git a/internal/graphengine/engine_v2.go b/internal/graphengine/engine_v2.go
    index d0a7d37..58863d9 100644
    --- a/internal/graphengine/engine_v2.go
    +++ b/internal/graphengine/engine_v2.go
    @@ -3,9 +3,10 @@ package graphengine
     import (
     	"context"
     	"errors"
    +	"net/http"
    +
     	"github.com/TykTechnologies/graphql-go-tools/pkg/ast"
     	semconv "github.com/TykTechnologies/opentelemetry/semconv/v1.0.0"
    -	"net/http"
     
     	"github.com/jensneuse/abstractlogger"
     	"github.com/sirupsen/logrus"

    Please look at the run or in the Checks tab.

    @github-actions

    github-actions Bot commented Mar 6, 2024

    Copy link
    Copy Markdown
    Contributor

    💥 CI tests failed 🙈

    git-state

    diff --git a/internal/graphengine/engine_v2.go b/internal/graphengine/engine_v2.go
    index d0a7d37..58863d9 100644
    --- a/internal/graphengine/engine_v2.go
    +++ b/internal/graphengine/engine_v2.go
    @@ -3,9 +3,10 @@ package graphengine
     import (
     	"context"
     	"errors"
    +	"net/http"
    +
     	"github.com/TykTechnologies/graphql-go-tools/pkg/ast"
     	semconv "github.com/TykTechnologies/opentelemetry/semconv/v1.0.0"
    -	"net/http"
     
     	"github.com/jensneuse/abstractlogger"
     	"github.com/sirupsen/logrus"

    Please look at the run or in the Checks tab.

    @kofoworola
    kofoworola force-pushed the fix/tt-11389/missing-attr-fail-req branch from 4d40caa to 0412775 Compare March 6, 2024 15:07
    @github-actions

    github-actions Bot commented Mar 6, 2024

    Copy link
    Copy Markdown
    Contributor

    💥 CI tests failed 🙈

    git-state

    diff --git a/internal/graphengine/engine_v2.go b/internal/graphengine/engine_v2.go
    index d0a7d37..58863d9 100644
    --- a/internal/graphengine/engine_v2.go
    +++ b/internal/graphengine/engine_v2.go
    @@ -3,9 +3,10 @@ package graphengine
     import (
     	"context"
     	"errors"
    +	"net/http"
    +
     	"github.com/TykTechnologies/graphql-go-tools/pkg/ast"
     	semconv "github.com/TykTechnologies/opentelemetry/semconv/v1.0.0"
    -	"net/http"
     
     	"github.com/jensneuse/abstractlogger"
     	"github.com/sirupsen/logrus"

    Please look at the run or in the Checks tab.

    @kofoworola
    kofoworola enabled auto-merge (squash) March 7, 2024 09:15
    @kofoworola
    kofoworola force-pushed the fix/tt-11389/missing-attr-fail-req branch from 0412775 to 682090a Compare March 7, 2024 09:16
    @github-actions

    github-actions Bot commented Mar 7, 2024

    Copy link
    Copy Markdown
    Contributor

    💥 CI tests failed 🙈

    git-state

    diff --git a/internal/graphengine/engine_v2.go b/internal/graphengine/engine_v2.go
    index d0a7d37..58863d9 100644
    --- a/internal/graphengine/engine_v2.go
    +++ b/internal/graphengine/engine_v2.go
    @@ -3,9 +3,10 @@ package graphengine
     import (
     	"context"
     	"errors"
    +	"net/http"
    +
     	"github.com/TykTechnologies/graphql-go-tools/pkg/ast"
     	semconv "github.com/TykTechnologies/opentelemetry/semconv/v1.0.0"
    -	"net/http"
     
     	"github.com/jensneuse/abstractlogger"
     	"github.com/sirupsen/logrus"

    Please look at the run or in the Checks tab.

    1 similar comment
    @github-actions

    github-actions Bot commented Mar 7, 2024

    Copy link
    Copy Markdown
    Contributor

    💥 CI tests failed 🙈

    git-state

    diff --git a/internal/graphengine/engine_v2.go b/internal/graphengine/engine_v2.go
    index d0a7d37..58863d9 100644
    --- a/internal/graphengine/engine_v2.go
    +++ b/internal/graphengine/engine_v2.go
    @@ -3,9 +3,10 @@ package graphengine
     import (
     	"context"
     	"errors"
    +	"net/http"
    +
     	"github.com/TykTechnologies/graphql-go-tools/pkg/ast"
     	semconv "github.com/TykTechnologies/opentelemetry/semconv/v1.0.0"
    -	"net/http"
     
     	"github.com/jensneuse/abstractlogger"
     	"github.com/sirupsen/logrus"

    Please look at the run or in the Checks tab.

    @kofoworola
    kofoworola force-pushed the fix/tt-11389/missing-attr-fail-req branch from 682090a to e5096b9 Compare March 7, 2024 10:33
    @github-actions

    github-actions Bot commented Mar 7, 2024

    Copy link
    Copy Markdown
    Contributor

    💥 CI tests failed 🙈

    git-state

    all ok

    Please look at the run or in the Checks tab.

    @kofoworola
    kofoworola force-pushed the fix/tt-11389/missing-attr-fail-req branch from 42a1f7c to 4385a0a Compare March 7, 2024 13:27
    @sonarqubecloud

    sonarqubecloud Bot commented Mar 7, 2024

    Copy link
    Copy Markdown

    Quality Gate Failed Quality Gate failed

    Failed conditions
    36.4% Coverage on New Code (required ≥ 80%)
    C Reliability Rating on New Code (required ≥ A)

    See analysis details on SonarCloud

    Catch issues before they fail your Quality Gate with our IDE extension SonarLint

    @kofoworola
    kofoworola merged commit 5ce6148 into master Mar 7, 2024
    @kofoworola
    kofoworola deleted the fix/tt-11389/missing-attr-fail-req branch March 7, 2024 15:05
    @buger

    buger commented Mar 7, 2024

    Copy link
    Copy Markdown
    Member

    API tests result - mongo44-murmur64 env: success
    Branch used: refs/heads/master
    Commit: 5ce6148 TT-11389: moved graphql span attributes (#6088)

    User description

    moved the document info attributes for graphql requests to the
    GraphqlMiddlewareValidation span

    Description

    Moved the graphql-specific span attributes higher up the span chain so
    they can still be seen in the event of a request failure when detailed
    tracing is turned on

    TT-11389

    Related Issue

    Motivation and Context

    How This Has Been Tested

    Screenshots (if appropriate)

    Types of changes

    • Bug fix (non-breaking change which fixes an issue)
    • New feature (non-breaking change which adds functionality)
    • Breaking change (fix or feature that would cause existing
      functionality to change)
    • Refactoring or add test (improvements in base code or adds test
      coverage to functionality)

    Checklist

    • I ensured that the documentation is up to date
    • I explained why this PR updates go.mod in detail with reasoning
      why it's required
    • I would like a code coverage CI quality gate exception and have
      explained why

    Type

    enhancement


    Description

    • Added OpenTelemetry semantic conventions for GraphQL operation name,
      type, and document in ProcessAndStoreGraphQLRequest method to enhance
      tracing capabilities.
    • Refactored the way GraphQL operation type is determined and set on
      spans across different parts of the codebase.
    • Removed redundant span attributes setting in the ValidateForSchema
      method of the detailed GraphQL engine.

    Changes walkthrough

    Relevant files
    Enhancement
    engine_v2.go
    Add OpenTelemetry Attributes for GraphQL Requests               

    internal/graphengine/engine_v2.go

  • Added OpenTelemetry semantic conventions for GraphQL in
    ProcessAndStoreGraphQLRequest method.
  • Set attributes for GraphQL operation name, type, and document on the
    span.
  • +13/-0   
    otel_graphql_engine_basic.go
    Use PrintOperationType for Span Attributes                             

    internal/graphql/otel_graphql_engine_basic.go

  • Modified to use PrintOperationType for setting GraphQL operation type
    attribute on the span.
  • +1/-1     
    otel_graphql_engine_detailed.go
    Refactor Span Attributes Setting in GraphQL Engine             

    internal/graphql/otel_graphql_engine_detailed.go

  • Removed span attributes setting from ValidateForSchema method.
  • Exposed PrintOperationType function for external use.
  • +2/-15   

    PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools
    and their descriptions
    Triggered by: push (@kofoworola)
    Execution page

    @buger

    buger commented Mar 7, 2024

    Copy link
    Copy Markdown
    Member

    API tests result - postgres15-murmur64 env: success
    Branch used: refs/heads/master
    Commit: 5ce6148 TT-11389: moved graphql span attributes (#6088)

    User description

    moved the document info attributes for graphql requests to the
    GraphqlMiddlewareValidation span

    Description

    Moved the graphql-specific span attributes higher up the span chain so
    they can still be seen in the event of a request failure when detailed
    tracing is turned on

    TT-11389

    Related Issue

    Motivation and Context

    How This Has Been Tested

    Screenshots (if appropriate)

    Types of changes

    • Bug fix (non-breaking change which fixes an issue)
    • New feature (non-breaking change which adds functionality)
    • Breaking change (fix or feature that would cause existing
      functionality to change)
    • Refactoring or add test (improvements in base code or adds test
      coverage to functionality)

    Checklist

    • I ensured that the documentation is up to date
    • I explained why this PR updates go.mod in detail with reasoning
      why it's required
    • I would like a code coverage CI quality gate exception and have
      explained why

    Type

    enhancement


    Description

    • Added OpenTelemetry semantic conventions for GraphQL operation name,
      type, and document in ProcessAndStoreGraphQLRequest method to enhance
      tracing capabilities.
    • Refactored the way GraphQL operation type is determined and set on
      spans across different parts of the codebase.
    • Removed redundant span attributes setting in the ValidateForSchema
      method of the detailed GraphQL engine.

    Changes walkthrough

    Relevant files
    Enhancement
    engine_v2.go
    Add OpenTelemetry Attributes for GraphQL Requests               

    internal/graphengine/engine_v2.go

  • Added OpenTelemetry semantic conventions for GraphQL in
    ProcessAndStoreGraphQLRequest method.
  • Set attributes for GraphQL operation name, type, and document on the
    span.
  • +13/-0   
    otel_graphql_engine_basic.go
    Use PrintOperationType for Span Attributes                             

    internal/graphql/otel_graphql_engine_basic.go

  • Modified to use PrintOperationType for setting GraphQL operation type
    attribute on the span.
  • +1/-1     
    otel_graphql_engine_detailed.go
    Refactor Span Attributes Setting in GraphQL Engine             

    internal/graphql/otel_graphql_engine_detailed.go

  • Removed span attributes setting from ValidateForSchema method.
  • Exposed PrintOperationType function for external use.
  • +2/-15   

    PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools
    and their descriptions
    Triggered by: push (@kofoworola)
    Execution page

    @kofoworola

    Copy link
    Copy Markdown
    Contributor Author

    /release to release-5.3

    @tykbot

    tykbot Bot commented Mar 8, 2024

    Copy link
    Copy Markdown

    Working on it! Note that it can take a few minutes.

    tykbot Bot pushed a commit that referenced this pull request Mar 8, 2024
    ## **User description**
    moved the document info attributes for graphql requests to the
    GraphqlMiddlewareValidation span
    
    <!-- Provide a general summary of your changes in the Title above -->
    
    ## Description
    Moved the graphql-specific span attributes higher up the span chain so
    they can still be seen in the event of a request failure when detailed
    tracing is turned on
    
    [TT-11389](https://tyktech.atlassian.net/browse/TT-11389)
    
    <!-- Describe your changes in detail -->
    
    ## Related Issue
    
    <!-- This project only accepts pull requests related to open issues. -->
    <!-- If suggesting a new feature or change, please discuss it in an
    issue first. -->
    <!-- If fixing a bug, there should be an issue describing it with steps
    to reproduce. -->
    <!-- OSS: Please link to the issue here. Tyk: please create/link the
    JIRA ticket. -->
    
    ## Motivation and Context
    
    <!-- Why is this change required? What problem does it solve? -->
    
    ## How This Has Been Tested
    
    <!-- Please describe in detail how you tested your changes -->
    <!-- Include details of your testing environment, and the tests -->
    <!-- you ran to see how your change affects other areas of the code,
    etc. -->
    <!-- This information is helpful for reviewers and QA. -->
    
    ## Screenshots (if appropriate)
    
    ## Types of changes
    
    <!-- What types of changes does your code introduce? Put an `x` in all
    the boxes that apply: -->
    
    - [ ] Bug fix (non-breaking change which fixes an issue)
    - [ ] New feature (non-breaking change which adds functionality)
    - [ ] Breaking change (fix or feature that would cause existing
    functionality to change)
    - [ ] Refactoring or add test (improvements in base code or adds test
    coverage to functionality)
    
    ## Checklist
    
    <!-- Go over all the following points, and put an `x` in all the boxes
    that apply -->
    <!-- If there are no documentation updates required, mark the item as
    checked. -->
    <!-- Raise up any additional concerns not covered by the checklist. -->
    
    - [ ] I ensured that the documentation is up to date
    - [ ] I explained why this PR updates go.mod in detail with reasoning
    why it's required
    - [ ] I would like a code coverage CI quality gate exception and have
    explained why
    
    
    [TT-11389]:
    https://tyktech.atlassian.net/browse/TT-11389?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
    
    
    ___
    
    ## **Type**
    enhancement
    
    
    ___
    
    ## **Description**
    - Added OpenTelemetry semantic conventions for GraphQL operation name,
    type, and document in `ProcessAndStoreGraphQLRequest` method to enhance
    tracing capabilities.
    - Refactored the way GraphQL operation type is determined and set on
    spans across different parts of the codebase.
    - Removed redundant span attributes setting in the `ValidateForSchema`
    method of the detailed GraphQL engine.
    
    
    ___
    
    
    
    ## **Changes walkthrough**
    <table><thead><tr><th></th><th align="left">Relevant
    files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
    <tr>
      <td>
        <details>
    <summary><strong>engine_v2.go</strong><dd><code>Add OpenTelemetry
    Attributes for GraphQL Requests</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    internal/graphengine/engine_v2.go
    <li>Added OpenTelemetry semantic conventions for GraphQL in
    <br><code>ProcessAndStoreGraphQLRequest</code> method.<br> <li> Set
    attributes for GraphQL operation name, type, and document on the
    <br>span.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6088/files#diff-b1eaa954c9836f395e1d49090e85c739e3878747c8bd748f556fc5a53ff7b191">+13/-0</a>&nbsp;
    &nbsp; </td>
    </tr>                    
    
    <tr>
      <td>
        <details>
    <summary><strong>otel_graphql_engine_basic.go</strong><dd><code>Use
    PrintOperationType for Span Attributes</code>&nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; </dd></summary>
    <hr>
    
    internal/graphql/otel_graphql_engine_basic.go
    <li>Modified to use <code>PrintOperationType</code> for setting GraphQL
    operation type <br>attribute on the span.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6088/files#diff-d2e2ab0951855338accb48c6985c5f880a8ea2746872c7cea5b64f308a5214c8">+1/-1</a>&nbsp;
    &nbsp; &nbsp; </td>
    </tr>                    
    
    <tr>
      <td>
        <details>
    
    <summary><strong>otel_graphql_engine_detailed.go</strong><dd><code>Refactor
    Span Attributes Setting in GraphQL Engine</code>&nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    internal/graphql/otel_graphql_engine_detailed.go
    <li>Removed span attributes setting from <code>ValidateForSchema</code>
    method.<br> <li> Exposed <code>PrintOperationType</code> function for
    external use.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6088/files#diff-799c8fc0e5c351c4903c0ecfcc1b9997473f469edcd25118edf447dc6ea4e771">+2/-15</a>&nbsp;
    &nbsp; </td>
    </tr>                    
    </table></td></tr></tr></tbody></table>
    
    ___
    
    > ✨ **PR-Agent usage**:
    >Comment `/help` on the PR to get a list of all available PR-Agent tools
    and their descriptions
    
    (cherry picked from commit 5ce6148)
    @tykbot

    tykbot Bot commented Mar 8, 2024

    Copy link
    Copy Markdown

    @kofoworola Seems like there is conflict and it require manual merge.

    kofoworola added a commit that referenced this pull request Mar 11, 2024
    ) (#6129)
    
    ## **User description**
    [TT-11389]: moved graphql span attributes (#6088)
    
    ## **User description**
    moved the document info attributes for graphql requests to the
    GraphqlMiddlewareValidation span
    
    <!-- Provide a general summary of your changes in the Title above -->
    
    ## Description
    Moved the graphql-specific span attributes higher up the span chain so
    they can still be seen in the event of a request failure when detailed
    tracing is turned on
    
    [TT-11389](https://tyktech.atlassian.net/browse/TT-11389)
    
    <!-- Describe your changes in detail -->
    
    ## Related Issue
    
    <!-- This project only accepts pull requests related to open issues. -->
    <!-- If suggesting a new feature or change, please discuss it in an
    issue first. -->
    <!-- If fixing a bug, there should be an issue describing it with steps
    to reproduce. -->
    <!-- OSS: Please link to the issue here. Tyk: please create/link the
    JIRA ticket. -->
    
    ## Motivation and Context
    
    <!-- Why is this change required? What problem does it solve? -->
    
    ## How This Has Been Tested
    
    <!-- Please describe in detail how you tested your changes -->
    <!-- Include details of your testing environment, and the tests -->
    <!-- you ran to see how your change affects other areas of the code,
    etc. -->
    <!-- This information is helpful for reviewers and QA. -->
    
    ## Screenshots (if appropriate)
    
    ## Types of changes
    
    <!-- What types of changes does your code introduce? Put an `x` in all
    the boxes that apply: -->
    
    - [ ] Bug fix (non-breaking change which fixes an issue)
    - [ ] New feature (non-breaking change which adds functionality)
    - [ ] Breaking change (fix or feature that would cause existing
    functionality to change)
    - [ ] Refactoring or add test (improvements in base code or adds test
    coverage to functionality)
    
    ## Checklist
    
    <!-- Go over all the following points, and put an `x` in all the boxes
    that apply -->
    <!-- If there are no documentation updates required, mark the item as
    checked. -->
    <!-- Raise up any additional concerns not covered by the checklist. -->
    
    - [ ] I ensured that the documentation is up to date
    - [ ] I explained why this PR updates go.mod in detail with reasoning
    why it's required
    - [ ] I would like a code coverage CI quality gate exception and have
    explained why
    
    
    [TT-11389]:
    
    https://tyktech.atlassian.net/browse/TT-11389?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
    
    
    ___
    
    ## **Type**
    enhancement
    
    
    ___
    
    ## **Description**
    - Added OpenTelemetry semantic conventions for GraphQL operation name,
    type, and document in `ProcessAndStoreGraphQLRequest` method to enhance
    tracing capabilities.
    - Refactored the way GraphQL operation type is determined and set on
    spans across different parts of the codebase.
    - Removed redundant span attributes setting in the `ValidateForSchema`
    method of the detailed GraphQL engine.
    
    
    ___
    
    
    
    ## **Changes walkthrough**
    <table><thead><tr><th></th><th align="left">Relevant
    
    files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
    <tr>
      <td>
        <details>
    <summary><strong>engine_v2.go</strong><dd><code>Add OpenTelemetry
    Attributes for GraphQL Requests</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    internal/graphengine/engine_v2.go
    <li>Added OpenTelemetry semantic conventions for GraphQL in
    <br><code>ProcessAndStoreGraphQLRequest</code> method.<br> <li> Set
    attributes for GraphQL operation name, type, and document on the
    <br>span.
    
    
    </details>
        
    
      </td>
    <td><a
    
    href="https://github.com/TykTechnologies/tyk/pull/6088/files#diff-b1eaa954c9836f395e1d49090e85c739e3878747c8bd748f556fc5a53ff7b191">+13/-0</a>&nbsp;
    &nbsp; </td>
    </tr>                    
    
    <tr>
      <td>
        <details>
    <summary><strong>otel_graphql_engine_basic.go</strong><dd><code>Use
    PrintOperationType for Span Attributes</code>&nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; </dd></summary>
    <hr>
    
    internal/graphql/otel_graphql_engine_basic.go
    <li>Modified to use <code>PrintOperationType</code> for setting GraphQL
    operation type <br>attribute on the span.
    
    
    </details>
        
    
      </td>
    <td><a
    
    href="https://github.com/TykTechnologies/tyk/pull/6088/files#diff-d2e2ab0951855338accb48c6985c5f880a8ea2746872c7cea5b64f308a5214c8">+1/-1</a>&nbsp;
    &nbsp; &nbsp; </td>
    </tr>                    
    
    <tr>
      <td>
        <details>
    
    
    <summary><strong>otel_graphql_engine_detailed.go</strong><dd><code>Refactor
    Span Attributes Setting in GraphQL Engine</code>&nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    internal/graphql/otel_graphql_engine_detailed.go
    <li>Removed span attributes setting from <code>ValidateForSchema</code>
    method.<br> <li> Exposed <code>PrintOperationType</code> function for
    external use.
    
    
    </details>
        
    
      </td>
    <td><a
    
    href="https://github.com/TykTechnologies/tyk/pull/6088/files#diff-799c8fc0e5c351c4903c0ecfcc1b9997473f469edcd25118edf447dc6ea4e771">+2/-15</a>&nbsp;
    &nbsp; </td>
    </tr>                    
    </table></td></tr></tr></tbody></table>
    
    ___
    
    > ✨ **PR-Agent usage**:
    >Comment `/help` on the PR to get a list of all available PR-Agent tools
    and their descriptions
    
    [TT-11389]:
    https://tyktech.atlassian.net/browse/TT-11389?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
    [TT-11389]:
    https://tyktech.atlassian.net/browse/TT-11389?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
    [TT-11389]:
    https://tyktech.atlassian.net/browse/TT-11389?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
    
    
    ___
    
    ## **Type**
    enhancement, tests
    
    
    ___
    
    ## **Description**
    - Enhanced error handling in GraphQL normalization and validation by
    setting detailed span attributes upon failure.
    - Refactored operation type utility for broader usage across the
    codebase.
    - Updated Docker build command in Makefile.
    - Added new tracing test scenarios for GraphQL, including handling of
    invalid requests and detailed tracing disabled cases.
    
    
    ___
    
    
    
    ## **Changes walkthrough**
    <table><thead><tr><th></th><th align="left">Relevant
    files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
    <tr>
      <td>
        <details>
    <summary><strong>otel_graphql_engine_basic.go</strong><dd><code>Enhance
    GraphQL Span Attributes and Error Handling</code>&nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    internal/graphql/otel_graphql_engine_basic.go
    <li>Added error handling to set GraphQL span attributes upon
    normalization <br>failure.<br> <li> Enhanced operation type extraction
    and error handling.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6129/files#diff-d2e2ab0951855338accb48c6985c5f880a8ea2746872c7cea5b64f308a5214c8">+18/-2</a>&nbsp;
    &nbsp; </td>
    </tr>                    
    
    <tr>
      <td>
        <details>
    
    <summary><strong>otel_graphql_engine_detailed.go</strong><dd><code>Improve
    Error Handling and Refactor Operation Type Utility</code></dd></summary>
    <hr>
    
    internal/graphql/otel_graphql_engine_detailed.go
    <li>Improved normalization and validation error handling with detailed
    <br>span attributes.<br> <li> Refactored <code>printOperationType</code>
    to <code>PrintOperationType</code> for broader usage.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6129/files#diff-799c8fc0e5c351c4903c0ecfcc1b9997473f469edcd25118edf447dc6ea4e771">+10/-3</a>&nbsp;
    &nbsp; </td>
    </tr>                    
    </table></td></tr><tr><td><strong>Tests</strong></td><td><table>
    <tr>
      <td>
        <details>
    <summary><strong>opentelemetry.yml</strong><dd><code>Add New Tracing
    Test Scenarios for GraphQL</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    </dd></summary>
    <hr>
    
    .taskfiles/opentelemetry.yml
    <li>Added new tracing test scenarios for GraphQL with detailed tracing
    <br>disabled.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6129/files#diff-3a4b761dd20bd83804466e1295ad58db13b87b5e35e6120efc59c2b7bfaa27e1">+2/-0</a>&nbsp;
    &nbsp; &nbsp; </td>
    </tr>                    
    
    <tr>
      <td>
        <details>
    
    <summary><strong>tyk_test-graphql-detailed-tracing-disabled_400.yaml</strong><dd><code>New
    Test Scenario for GraphQL Detailed Tracing with Invalid
    Request</code></dd></summary>
    <hr>
    
    
    ci/tests/tracing/scenarios/tyk_test-graphql-detailed-tracing-disabled_400.yaml
    <li>Introduced a new test scenario for GraphQL detailed tracing with
    <br>invalid request.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6129/files#diff-66d2f9c1731064ac100ea574a98a12c3847abad914d5e8e61e7d9b69c1cafca2">+21/-0</a>&nbsp;
    &nbsp; </td>
    </tr>                    
    
    <tr>
      <td>
        <details>
    
    <summary><strong>tyk_test-graphql-tracing_200.yml</strong><dd><code>Modify
    Assertions for GraphQL Operation Details
    Validation</code></dd></summary>
    <hr>
    
    ci/tests/tracing/scenarios/tyk_test-graphql-tracing_200.yml
    <li>Modified assertions to correctly validate GraphQL operation details.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6129/files#diff-2df94df431a444a3778f2b00fd47d911dcfa2e0c9c883de72f72adcd509c890a">+6/-9</a>&nbsp;
    &nbsp; &nbsp; </td>
    </tr>                    
    
    <tr>
      <td>
        <details>
    <summary><strong>tyk_test-graphql-tracing_400.yml</strong><dd><code>New
    Test Scenario for Bad GraphQL Request Tracing</code>&nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    ci/tests/tracing/scenarios/tyk_test-graphql-tracing_400.yml
    - Added a test scenario for handling bad GraphQL requests in tracing.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6129/files#diff-ff037bf3b758b91e239d4f0c5d9af67062c7e4d18a895713c9e14e38b04d108f">+20/-0</a>&nbsp;
    &nbsp; </td>
    </tr>                    
    </table></td></tr><tr><td><strong>Configuration
    changes</strong></td><td><table>
    <tr>
      <td>
        <details>
    <summary><strong>Makefile</strong><dd><code>Update Docker Build
    Command</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; </dd></summary>
    <hr>
    
    Makefile
    - Updated Docker build command.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6129/files#diff-76ed074a9305c04054cdebb9e9aad2d818052b07091de1f20cad0bbac34ffb52">+1/-1</a>&nbsp;
    &nbsp; &nbsp; </td>
    </tr>                    
    </table></td></tr></tr></tbody></table>
    
    ___
    
    > ✨ **PR-Agent usage**:
    >Comment `/help` on the PR to get a list of all available PR-Agent tools
    and their descriptions
    
    Co-authored-by: Kofo Okesola <[email protected]>
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    3 participants