(ctx context.Context, sourceSpec specs.Source, destinationsSpecs []specs.Destination, invocationUUID string, m *metrics.Metrics, exitReason ExitReason)
| 62 | } |
| 63 | |
| 64 | func (c *AnalyticsClient) SendSyncMetrics(ctx context.Context, sourceSpec specs.Source, destinationsSpecs []specs.Destination, invocationUUID string, m *metrics.Metrics, exitReason ExitReason) error { |
| 65 | if m == nil { |
| 66 | // handle nil metrics |
| 67 | m = &metrics.Metrics{TableClient: map[string]map[string]*metrics.TableClientMetrics{}} |
| 68 | } |
| 69 | if c.client != nil { |
| 70 | sourcePath := sourceSpec.Path |
| 71 | if sourceSpec.Registry == specs.RegistryLocal || sourceSpec.Registry == specs.RegistryGRPC { |
| 72 | _, sourcePath = path.Split(sourceSpec.Path) |
| 73 | } |
| 74 | syncSummary := &analytics.SyncSummary{ |
| 75 | Invocation_UUID: invocationUUID, |
| 76 | SourcePath: sourcePath, |
| 77 | SourceVersion: sourceSpec.Version, |
| 78 | Destinations: make([]*analytics.Destination, 0, 1), |
| 79 | Resources: int64(m.TotalResources()), |
| 80 | Errors: int64(m.TotalErrors()), |
| 81 | Panics: int64(m.TotalPanics()), |
| 82 | ClientVersion: Version, |
| 83 | ExitReason: string(exitReason), |
| 84 | } |
| 85 | for _, destinationSpec := range destinationsSpecs { |
| 86 | destPath := destinationSpec.Path |
| 87 | if destinationSpec.Registry == specs.RegistryLocal || destinationSpec.Registry == specs.RegistryGRPC { |
| 88 | _, destPath = path.Split(destinationSpec.Path) |
| 89 | } |
| 90 | syncSummary.Destinations = append(syncSummary.Destinations, &analytics.Destination{ |
| 91 | Path: destPath, |
| 92 | Version: destinationSpec.Version, |
| 93 | }) |
| 94 | } |
| 95 | |
| 96 | _, err := c.client.SendEvent(ctx, &analytics.Event_Request{ |
| 97 | SyncSummary: syncSummary, |
| 98 | }) |
| 99 | return err |
| 100 | } |
| 101 | return nil |
| 102 | } |
| 103 | |
| 104 | func (c *AnalyticsClient) Host() string { |
| 105 | return c.host |
no outgoing calls
no test coverage detected