Skip to content

[surfacers] Provide a way to add new surfacer types - #1126

Merged
manugarg merged 4 commits into
mainfrom
surfacer_extension
Aug 13, 2025
Merged

manugarg merged 4 commits into
mainfrom
surfacer_extension

Conversation

@manugarg

@manugarg manugarg commented Aug 12, 2025 •

Copy link
Copy Markdown
Contributor

Interface to register new types will look like this:

//	import (
//		"github.com/cloudprober/cloudprober"
//		"github.com/cloudprober/cloudprober/surfacers"
//	)
//
//	func initFancySurfacer(conf *configpb.SurfacerConf) (*FancySurfacer, error) {
//		...
//	}
//
//	surfacers.RegisterSurfacerType(200, func(conf any) (Surfacer, error) {
//		fancyConf, ok := conf.(*configpb.SurfacerConf)
//		if !ok {
//			return nil, fmt.Errorf("got unexpected config type %T", conf)
//		}
//		return initFancySurfacer(fancyConf)
//	})
//
//	pr, err := cloudprober.Init()
//	if err != nil {
//		log.Exitf("Error initializing cloudprober. Err: %v", err)
//	}

@manugarg manugarg changed the title [surfacers] Provide a way to extend surfacer [surfacers] Provide a way to add new surfacer types Aug 12, 2025
@manugarg
manugarg merged commit 41821b7 into main Aug 13, 2025
@manugarg
manugarg deleted the surfacer_extension branch August 13, 2025 06:58
@manugarg manugarg linked an issue Aug 13, 2025 that may be closed by this pull request
@manugarg manugarg added this to the v0.14.1 milestone Aug 13, 2025
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.

Allow extending surfacers as extensions

1 participant