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: add metric counting using OTL #15

Merged
merged 4 commits into from
Jul 6, 2023

Conversation

stephhuynh18
Copy link
Collaborator

No description provided.

@linear
Copy link

linear bot commented Jun 27, 2023

@smrz2001 smrz2001 self-requested a review June 28, 2023 21:39
RUN forge install openzeppelin/openzeppelin-contracts --no-git
RUN forge build --use 0.8.17
RUN forge install openzeppelin/openzeppelin-contracts@v4.8.0 --no-git
RUN forge build --use 0.8.13
ENTRYPOINT forge create --contracts ./src/CeramicAnchorServiceV2.sol --private-key $ETH_WALLET_PK --rpc-url $ETH_RPC_URL CeramicAnchorServiceV2
Copy link
Collaborator

Choose a reason for hiding this comment

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

Mind adding a newline at the end of this file?


// Metrics
// Counts
const CreatedBatchMetricName = "created_batch"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we make these into an enum?

type MetricName string

const (
	MetricName_CreatedBatch    MetricName = "created_batch"
	MetricName_ReplacedRequest MetricName = "replaced_request"
)

Copy link
Collaborator

@smrz2001 smrz2001 Jun 28, 2023

Choose a reason for hiding this comment

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

Do we need additional metrics?

  • Ingress requests for the Validation service so we can see how much load we're receiving
  • Ingress requests to the Batching service so we can see how many requests got past deduplication
  • Avg. number of requests in a Batch so we can see the pattern of batch sizes over time under different loads
  • Avg. batch linger (need to check if this is possible to measure) so we can see the time it's taking for batches to be issued.
  • Number of anchor jobs created by the Worker service
  • Number of failures received by the Failure Handler
  • Others?

Don't have to implement all these in this PR though we should track this list somewhere and add them in subsequent PRs.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also question for @gvelez17 here - when we replace the CASv2 Scheduler with the CASv5 Scheduler, will we lose any metrics you might have added to the old Scheduler? If so, then we probably need to make sure that at least those metrics, if still useful in the new design, are retained in the new code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll make a ticket

"go.opentelemetry.io/otel/sdk/resource"
)

type OTLMetricService struct {
Copy link
Collaborator

Choose a reason for hiding this comment

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

minor: Should this be named OtlMetricService?

Choose a reason for hiding this comment

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

i think not in case we change the internals later

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure I understand. Was just recommending changing OTL -> Otl to preserve camel casing. Should we not?

}

var exporter sdk.Exporter
collectorUrl := os.Getenv("COLLECTOR_URL")

Choose a reason for hiding this comment

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

the actual env variable is COLLECTOR_HOST

Choose a reason for hiding this comment

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

we normally pass this to the observability package from the caller

sdk.WithReader(sdk.NewPeriodicReader(exporter)),
)

meter := meterProvider.Meter("github.com/ceramicnetwork/go-cas/common/metrics")

Choose a reason for hiding this comment

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

maybe just 'go-cas'

later we can move this to a go observability repo and use caller again

"encoding/json"
"os"

"github.com/ceramicnetwork/go-cas/models"
Copy link
Collaborator

Choose a reason for hiding this comment

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

minor: Move this line to a new section after the imports below separated by a newline

Copy link
Collaborator

@smrz2001 smrz2001 left a comment

Choose a reason for hiding this comment

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

🚀

@stephhuynh18 stephhuynh18 merged commit 4131dd2 into develop Jul 6, 2023
1 check passed
@stephhuynh18 stephhuynh18 deleted the feature/cdb-2359-go-cas-metrics-and-alerts branch July 6, 2023 15:09
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.

3 participants