OpenTracing for Fission (#1079)
Added Opentracing integration using opencensus libraries for all Fission components.
This commit is contained in:
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
package buildermgr
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
@@ -37,7 +38,7 @@ import (
|
||||
// 3. Send upload request to fetcher to upload deployment package.
|
||||
// 4. Return upload response and build logs.
|
||||
// *. Return build logs and error if any one of steps above failed.
|
||||
func buildPackage(fissionClient *crd.FissionClient, envBuilderNamespace string,
|
||||
func buildPackage(ctx context.Context, fissionClient *crd.FissionClient, envBuilderNamespace string,
|
||||
storageSvcUrl string, pkg *crd.Package) (uploadResp *fission.ArchiveUploadResponse, buildLogs string, err error) {
|
||||
|
||||
env, err := fissionClient.Environments(pkg.Spec.Environment.Namespace).Get(pkg.Spec.Environment.Name)
|
||||
@@ -60,7 +61,7 @@ func buildPackage(fissionClient *crd.FissionClient, envBuilderNamespace string,
|
||||
}
|
||||
|
||||
// send fetch request to fetcher
|
||||
err = fetcherC.Fetch(fetchReq)
|
||||
err = fetcherC.Fetch(ctx, fetchReq)
|
||||
if err != nil {
|
||||
e := fmt.Sprintf("Error fetching source package: %v", err)
|
||||
log.Println(e)
|
||||
@@ -103,7 +104,7 @@ func buildPackage(fissionClient *crd.FissionClient, envBuilderNamespace string,
|
||||
|
||||
log.Printf("Start uploading deployment package: %v", buildResp.ArtifactFilename)
|
||||
// ask fetcher to upload the deployment package
|
||||
uploadResp, err = fetcherC.Upload(uploadReq)
|
||||
uploadResp, err = fetcherC.Upload(ctx, uploadReq)
|
||||
if err != nil {
|
||||
e := fmt.Sprintf("Error uploading deployment package: %v", err)
|
||||
log.Println(e)
|
||||
|
||||
@@ -82,6 +82,7 @@ type (
|
||||
fetcherImagePullPolicy apiv1.PullPolicy
|
||||
builderImagePullPolicy apiv1.PullPolicy
|
||||
useIstio bool
|
||||
collectorEndpoint string
|
||||
}
|
||||
)
|
||||
|
||||
@@ -105,6 +106,7 @@ func makeEnvironmentWatcher(fissionClient *crd.FissionClient,
|
||||
|
||||
fetcherImagePullPolicy := fission.GetImagePullPolicy(os.Getenv("FETCHER_IMAGE_PULL_POLICY"))
|
||||
builderImagePullPolicy := fission.GetImagePullPolicy(os.Getenv("BUILDER_IMAGE_PULL_POLICY"))
|
||||
collectorEndpoint := os.Getenv("TRACE_JAEGER_COLLECTOR_ENDPOINT")
|
||||
|
||||
envWatcher := &environmentWatcher{
|
||||
cache: make(map[string]*builderInfo),
|
||||
@@ -116,6 +118,7 @@ func makeEnvironmentWatcher(fissionClient *crd.FissionClient,
|
||||
fetcherImagePullPolicy: fetcherImagePullPolicy,
|
||||
builderImagePullPolicy: builderImagePullPolicy,
|
||||
useIstio: useIstio,
|
||||
collectorEndpoint: collectorEndpoint,
|
||||
}
|
||||
|
||||
go envWatcher.service()
|
||||
@@ -590,6 +593,7 @@ func (envw *environmentWatcher) createBuilderDeployment(env *crd.Environment, ns
|
||||
Command: []string{"/fetcher",
|
||||
"-secret-dir", sharedSecretPath,
|
||||
"-cfgmap-dir", sharedCfgMapPath,
|
||||
"-jaeger-collector-endpoint", envw.collectorEndpoint,
|
||||
sharedMountPath},
|
||||
ReadinessProbe: &apiv1.Probe{
|
||||
InitialDelaySeconds: 5,
|
||||
|
||||
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
package buildermgr
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
"time"
|
||||
@@ -160,7 +161,8 @@ func (pkgw *packageWatcher) build(buildCache *cache.Cache, srcpkg *crd.Package)
|
||||
log.Printf("Setup rolebinding for sa : %s.%s for pkg : %s.%s", fission.FissionBuilderSA, builderNs, pkg.Metadata.Name, pkg.Metadata.Namespace)
|
||||
}
|
||||
|
||||
uploadResp, buildLogs, err := buildPackage(pkgw.fissionClient, builderNs, pkgw.storageSvcUrl, pkg)
|
||||
ctx := context.Background()
|
||||
uploadResp, buildLogs, err := buildPackage(ctx, pkgw.fissionClient, builderNs, pkgw.storageSvcUrl, pkg)
|
||||
if err != nil {
|
||||
log.Printf("Error building package %v: %v", pkg.Metadata.Name, err)
|
||||
updatePackage(pkgw.fissionClient, pkg, fission.BuildStatusFailed, buildLogs, nil)
|
||||
|
||||
Reference in New Issue
Block a user