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

trace: replace zipkin with uptrace #330

Closed
wants to merge 7 commits into from
Closed

Conversation

najeal
Copy link
Contributor

@najeal najeal commented Aug 3, 2023

Related to #230

@najeal
Copy link
Contributor Author

najeal commented Aug 4, 2023

@patrick-ogrady I face one problem when enabling tracing TRACE=true ./scripts/tests.load.sh.
On main branch and uptrace branch test [It] creates blocks fails with error message no transactions.
My first opinion is some transactions are losts.

Except this data is loaded in uptrace as expected.

@@ -35,6 +35,7 @@ type Config struct {
// Tracing
TraceEnabled bool `json:"traceEnabled"`
TraceSampleRate float64 `json:"traceSampleRate"`
DSN string `json:"dsn"`
Copy link
Contributor

Choose a reason for hiding this comment

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

To confirm, this is provided by Uptrace on startup?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it is provided by the running uptrace.
It contains a secret to communicate with uptrace, is it safe to use it in this config?

Copy link
Contributor

Choose a reason for hiding this comment

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

We can set the default value (like I did in my patch).

@patrick-ogrady
Copy link
Contributor

@patrick-ogrady I face one problem when enabling tracing TRACE=true ./scripts/tests.load.sh. On main branch and uptrace branch test [It] creates blocks fails with error message no transactions. My first opinion is some transactions are losts.

Except this data is loaded in uptrace as expected.

Hmmm. Let me look rq.

@patrick-ogrady
Copy link
Contributor

It worked for me:
image

I just had to do this diff (run go mod tidy and add a default DSN):
patch.txt

@patrick-ogrady
Copy link
Contributor

The next iteration here will also be adding the prometheus metrics ingestion to this tool ❤️

@najeal
Copy link
Contributor Author

najeal commented Aug 5, 2023

@patrick-ogrady the data is loaded in your uptrace but you confirm that the load tests are successul with trace enabled and uptrace running?

I will add prometheus in the same PR.

@patrick-ogrady
Copy link
Contributor

@patrick-ogrady the data is loaded in your uptrace but you confirm that the load tests are successul with trace enabled and uptrace running?

I will add prometheus in the same PR.

Yep, worked like normal:
image

What do you see?

@najeal
Copy link
Contributor Author

najeal commented Aug 6, 2023

@patrick-ogrady I see this:
Screenshot 2023-08-06 at 20 48 26
then :
Screenshot 2023-08-06 at 19 41 01

@patrick-ogrady
Copy link
Contributor

patrick-ogrady commented Aug 8, 2023

🤔 definitely seems like a new bug. This would happen if the calculation for how many times to call build block (based on the fee and any balance is wrong):

// sending 1 tx to each account
remainder := uint64(accts)*transferTxUnits + uint64(1_000_000)
// leave some left over for root
fundSplit := (genesisBalance - remainder) / uint64(accts)
gomega.Ω(fundSplit).Should(gomega.Not(gomega.BeZero()))
requiredBlocks := accts / maxTxsPerBlock
if accts%maxTxsPerBlock > 0 {
requiredBlocks++
}

This is some of the "jankier" logic in the codebase and think it could be cleaned up quite a bit.

@najeal
Copy link
Contributor Author

najeal commented Aug 8, 2023

But it works on your side 😩 .
I added some logs
We generate 500 000 txs
Looking at the logs each block from 0 to 109 is created with 4090 txs
the 110th has only 231 txs.
We should have created 122 blocks.

4090 * 110 + 231 = 450 131 txs

50 000 tx have been lost. Is it possible they got removed due to some logic?

@najeal najeal marked this pull request as ready for review August 8, 2023 23:13
@najeal
Copy link
Contributor Author

najeal commented Aug 8, 2023

@patrick-ogrady I wanted to generate prometheus config to export metrics from prometheus into Uptrace using remote_write. But this method only work for their saas currently.
If we want to use a local Uptrace we need to use an OpenTelemetry Collector.

So ready to be reviewed

trace/tracer.go Outdated
attribute.String("version", config.Version),
semconv.ServiceNameKey.String(config.Agent),
),
uptrace.ConfigureOpentelemetry(
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering why we import uptrace at all instead of just passing a header into the sdktrace options below like AvalancheGo: ava-labs/avalanchego#1727

The appeal there is that we can just use the stock OpenTelemetry?

Copy link
Contributor

Choose a reason for hiding this comment

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

In the process, we should just migrate to use this package (we don't need a separate trace package anymore because uptrace can use opentelemtry directly ❤️ ): https://github.com/ava-labs/avalanchego/blob/master/trace/tracer.go

Copy link
Contributor Author

@najeal najeal Aug 17, 2023

Choose a reason for hiding this comment

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

trace package has been updated. If you want to use trace package from avalanchego we need to update avalanchego to pass AppName and Version from the Config. Then we can use it from hypersdk

https://github.com/ava-labs/avalanchego/blob/e70a17d9d988b5067f3ef5c4a057f15ae1271ac4/trace/tracer.go#L73C2-L73C2

https://github.com/ava-labs/avalanchego/blob/e70a17d9d988b5067f3ef5c4a057f15ae1271ac4/trace/tracer.go#L74

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 that would be a good change. Can you open an issue for that? We can probably merge that quickly.

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 we should try to do so (use the trace package upstream)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It works 👍

@najeal
Copy link
Contributor Author

najeal commented Aug 22, 2023

@patrick-ogrady issue has been open avalanchego side and PR (ava-labs/avalanchego#1893)

@github-actions
Copy link

This PR has become stale because it has been open for 30 days with no activity. Adding the lifecycle/frozen label will exempt this PR from future lifecycle events..

@patrick-ogrady
Copy link
Contributor

@patrick-ogrady issue has been open avalanchego side and PR (ava-labs/avalanchego#1893)

Bumping this on the platform side

@github-actions
Copy link

This PR has become stale because it has been open for 30 days with no activity. Adding the lifecycle/frozen label will exempt this PR from future lifecycle events..

@najeal
Copy link
Contributor Author

najeal commented Feb 15, 2024

is it still relevant? The PR is old and there is a lot of conflicts.

@najeal najeal closed this Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants