contrib icon indicating copy to clipboard operation
contrib copied to clipboard

migrate go version from `1.19 -> 1.20`, upgrade semiconv package version and fix deprecated usages...

Open alioktar opened this issue 11 months ago โ€ข 1 comments

This pr represents version upgrades and deprecated usages fix for otelfiber package Changes Includes :

  • go version upgrade
  • opentelemetry semi convention package version upgrade
  • usages fix in otelfiber package
  • removed WithServerName configuration because http.server_name don't using anymore on opentelemetry semi conventions

Summary by CodeRabbit

  • Refactor
    • Removed the server name configuration option, streamlining HTTP metrics and span status handling.
    • Updated attribute assignments for telemetry tracing and metrics to align with new conventions.
  • Chores
    • Upgraded OpenTelemetry dependencies to the latest semantic conventions.
  • Tests
    • Enhanced unit tests for HTTP status code handling and updated assertions to validate the new telemetry attribute names and values.

alioktar avatar Feb 09 '25 17:02 alioktar

Walkthrough

This pull request removes the WithServerName configuration option from the otelfiber middleware by eliminating the ServerName field and its setter function from the configuration. The documentation has been updated to reflect these changes. Additionally, the OpenTelemetry semantic conventions dependency has been upgraded (e.g., semconv from v1.12.0/v1.4.0 to v1.21.0), prompting updates to HTTP attribute keys and telemetry processing logic across the codebase. A new internal helper has been introduced to compute span statuses from HTTP status codes and span kinds.

Changes

File(s) Change Summary
otelfiber/README.md, otelfiber/config.go Removed the WithServerName configuration option and the ServerName field; updated WithPort documentation in config.
otelfiber/fiber.go, otelfiber/otelfiber_test/fiber_test.go, otelfiber/semconv.go Upgraded OpenTelemetry semconv dependency to v1.21.0; updated HTTP attribute keys and telemetry processing logic (e.g., response attributes, span status, renaming of httpFlavorAttribute).
otelfiber/internal/http.go Added new internal helper functions: SpanStatusFromHTTPStatusCodeAndSpanKind and isCode4xx for computing span statuses based on HTTP status codes and span kinds.
otelfiber/internal/http_test.go Introduced unit tests for isCode4xx and SpanStatusFromHTTPStatusCodeAndSpanKind functions to validate HTTP status code handling.

Sequence Diagram(s)

sequenceDiagram
    participant C as Client
    participant M as Fiber Middleware
    participant I as Internal Helper
    participant OT as OpenTelemetry
    C->>+M: HTTP Request
    M->>+I: Compute Span Status (using HTTP status & span kind)
    I-->>-M: Span Status Result
    M->>OT: Record Telemetry Attributes (HTTP status, response size, etc.)
    M-->>C: HTTP Response

Suggested labels

โœ๏ธ Feature

Suggested reviewers

  • sixcolors
  • gaby
  • ReneWerner87
  • efectn

Poem

I'm a hopping coder, a little bunny on the run,
Skipping old configs beneath the rising sun.
Server names bid farewell, out of sight,
New telemetry dances in the code's soft light.
Fiber flows gracefully with updated tune,
Hexed by semconv's new, bright boon.
Hoppy changes make my circuits swoon! ๐Ÿฐ๐ŸŒŸ

[!TIP]

โšก๐Ÿ’ฌ Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.

๐Ÿ“œ Recent review details

Configuration used: CodeRabbit UI Review profile: CHILL Plan: Pro

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between b244320e15954a3df314a63b1cf2f702275dfe4c and 3c23ea070d7b0ddaf2c21167b257da0687fa7025.

๐Ÿ“’ Files selected for processing (2)
  • otelfiber/README.md (1 hunks)
  • otelfiber/internal/http.go (1 hunks)
๐Ÿšง Files skipped from review as they are similar to previous changes (2)
  • otelfiber/README.md
  • otelfiber/internal/http.go

๐Ÿชง Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Feb 09 '25 17:02 coderabbitai[bot]

Hi,

Is there any progress on this pull request, it is so important for us to our services which is used library on production ๐Ÿ™๐Ÿฟ

@gaby @sixcolors @ReneWerner87 @efectn

seckinsen avatar Apr 14 '25 14:04 seckinsen

@seckinsen Will review today after work

gaby avatar Apr 14 '25 14:04 gaby

@alioktar @seckinsen Please fix the merge conflicts

gaby avatar Apr 15 '25 11:04 gaby

Hi @gaby! I fixed conflicts, can you review again pls ๐Ÿ™๐Ÿผ

@sixcolors @ReneWerner87 @efectn also :fyi: ๐Ÿ™๐Ÿผ

alioktar avatar Apr 20 '25 11:04 alioktar

@efectn I fixed your reviews, can you review it again ๐Ÿ™๐Ÿผ

alioktar avatar Apr 21 '25 15:04 alioktar

@gaby @sixcolors @ReneWerner87 hi again, if the changes are ok for you guys could you please review and approve this merge request thanks!

seckinsen avatar Apr 22 '25 13:04 seckinsen

@seckinsen Will review after work, lots of PR's in the queue right now ๐Ÿ˜

gaby avatar Apr 22 '25 13:04 gaby

Thx for the changes

ReneWerner87 avatar Apr 22 '25 17:04 ReneWerner87