Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use opentelemetry library for tracing #60

Merged
merged 11 commits into from
Nov 13, 2024
Merged

feat: use opentelemetry library for tracing #60

merged 11 commits into from
Nov 13, 2024

Conversation

jigetus
Copy link
Contributor

@jigetus jigetus commented Nov 11, 2024

I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en.

close #2

src/lib/context.ts Outdated Show resolved Hide resolved
docs/contexts.md Show resolved Hide resolved
docs/contexts.md Show resolved Hide resolved
test-apps/tracing/app/configs/common.ts Outdated Show resolved Hide resolved
@resure resure requested a review from main-kun November 12, 2024 09:33
@resure resure mentioned this pull request Nov 12, 2024
@melikhov-dev
Copy link
Contributor

It will be reviewed after #61

logFunction: (extra: Dict | undefined, message: string) => void,
): DiagLogFunction {
return (message, ...args) => {
const data = args.reduce((acc: Record<string, any>, cur, index) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const data = args.reduce((acc: Record<string, any>, cur, index) => {
const data = args.reduce((acc: Record<string, unknown>, cur, index) => {

return (message, ...args) => {
const data = args.reduce((acc: Record<string, any>, cur, index) => {
if (typeof cur === 'object' && !Array.isArray(cur)) {
acc = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to add

        "no-param-reassign": [
            "warn",
            {
                "props": true,
                "ignorePropertyModificationsFor": ["acc"]
            }
        ]

to the .eslintrc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I refactored the code and now it's without warnings

traceExporter:
appTracingSpanExporter ||
new OTLPTraceExporter({
url: appTracingCollectorEndpoint || DEFAULT_COLLECTOR_HOST,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think DEFAULT_COLLECTOR_HOST is redundant.

url is optional and can be omitted - default is http://localhost:4318/v1/traces
https://www.npmjs.com/package/@opentelemetry/exporter-trace-otlp-http

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree

@jigetus
Copy link
Contributor Author

jigetus commented Nov 13, 2024

@melikhov-dev I updated the pull request, take a look

Copy link
Contributor

@melikhov-dev melikhov-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jigetus jigetus merged commit a2e9653 into main Nov 13, 2024
4 checks passed
@jigetus jigetus deleted the otel-tracing branch November 13, 2024 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OpenTelemetry: Tracing
3 participants