Skip to content

Add "opentelemetry" linter #3722

Closed
@leonklingele

Description

@leonklingele

Your feature request related to a problem? Please describe.

The go-opentelemetry-lint linter helps with properly using the OpenTelemetry SDK for Go.

// bad
func Query(ctx context.Context, db *sql.DB) error {
	row := db.QueryRowContext(ctx, `SELECT * FROM sample_text`)
	return row.Err()
}

// good
func Query(ctx context.Context, db *sql.DB) error {
	ctx, span := tracer().Start(ctx, "query")
	defer span.End()

	row := db.QueryRowContext(ctx, `SELECT * FROM sample_text`)
	return row.Err()
}

https://github.com/polyfloyd/go-opentelemetry-lint

Describe the solution you'd like.

Describe alternatives you've considered.

Additional context.

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or improvementlinter: newSupport new linterno decisionNo decision to fix or not

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions