-
Notifications
You must be signed in to change notification settings - Fork 135
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
Feature: OCPP-J and Websocket server metrics #343
base: master
Are you sure you want to change the base?
Conversation
type OcppMetricsError string | ||
|
||
const ( | ||
ChargePointError = OcppMetricsError("charge_point_error") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any other suggestions for the errors?
@@ -58,8 +60,20 @@ func NewServer(wsServer ws.WsServer, dispatcher ServerDispatcher, stateHandler S | |||
dispatcher.SetNetworkServer(wsServer) | |||
dispatcher.SetPendingRequestState(stateHandler) | |||
|
|||
meterProvider := otel.GetMeterProvider() | |||
metrics, err := newOcppMetrics(meterProvider, "") | |||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: Error handling here should be improved
ocppj/server.go
Outdated
jsonMessage, err := call.MarshalJSON() | ||
if err != nil { | ||
s.metrics.IncrementOutboundRequests(context.Background(), clientID, request.GetFeatureName(), nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: Error handling not fully implemented
|
||
conn.SetPingHandler(func(appData string) error { | ||
log.Debugf("ping received from %s", ws.ID()) | ||
ws.pingMessage <- []byte(appData) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Todo: Measuring pingPong duration
Suggestions on the approach?
7a1d09a
to
a624578
Compare
I'll need some help with this PR to capture metrics at points where it makes most sense and since Im not that familiar with the flows right now, Im open to suggestions. |
Proposed changes
Based on my feature request in #334, I added support for OCPP-J and Websocket server metrics.
Watch out for a breaking change: Go version updated to 1.22, because the OTel SDKs require at least 1.22.
Types of changes
What types of changes does your code introduce?
Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any ofthem, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before
merging your code.
Further comments
List of things that should be noted/addressed in the future: